Installing and Configuring Apache, PHP, MySQL and Drupal on Ubuntu
https://www.zyxware.com/sites/default/files/styles/user_image/public/pictures/zyxlogo.png?itok=NCFkMd_w
BY webmaster
13 years ago
Technical-Solution
10 comments comment
Most of the web based systems that we build at Zyxware uses Drupal as the content framework. The following are the steps involved in setting up Apache, PHP, MySQL and Drupal on a freshly installed Ubuntu 8.04 system. If you follow the instructions you should be able to set it up as is but if you face problems let us know and we will try to help you.
This is divided into subsections each dealing with a specific task.

1. Apache2 Server Setup
2. Installing MySQL and PHP5
3. Installing Drupal & Configuring Drupal
4. Clean URLs Configuration in Apache2 for Drupal
5. Other Tweaks

Apache2, MySQL, PHP Setup

1. Run the following command to install apache on your machine
sudo apt-get install apache2 libapache2-mod-php5

sudo apt-get install mysql-client mysql-server mysql-query-browser mysql-admin mysql-navigator php5-mysql php5-gd
sudo /etc/init.d/apache2 restart

2. Install PHPMyAdmin. After this, make changes in the confinguration file to support PHPMyAdmin. You can skip this step if you prefer to use MySQL GUI based administration.

sudo apt-get install phpmyadmin

sudo gedit /etc/apache2/httpd.conf

At the bottom add the following

# Enable PHPMyAdmin
Include /etc/phpmyadmin/apache.conf

sudo /etc/init.d/apache2 restart

3. Enable usedir module in apache2 to allow URLs of the following format http://localhost/~username. Also enable mod_rewrite to allow for Drupal Clean URLs

cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/userdir.load
sudo ln -s ../mods-available/userdir.conf
sudo ln -s ../mods-available/rewrite.load
sudo /etc/init.d/apache2 reload

4. Create folder /home/<username>/public_html -- > this is the folder which we are going to use as the document root for local development. So you will be accessing your local websites as http://localhost/~username/sitename

5. Edit /etc/apache2/mods-available/userdir.conf and change the AllowOverride line to just read AllowOverride All

Install Drupal

1. Download the latest drupal version from http://drupal.org and extract it to the folder of your choice under ~/public_html. Say ~/public_html/drupal

2. In the drupal folder change permissions of /default/settings.php to 766 to make it writable to by all users

3. Once the things has been completed access the directory through the browser. If you had named the drupal folder as drupal you can now access it as http://localhost/~username/drupal

4. Create a database named drupal_db (your choice) in MySQL through the MySQL Query Browser or throuh the mysql command line client for Drupal. Also create a user for drupal. You can do by running the following query
GRANT ALL PRIVILEGES ON drupal_db.* TO 'some_username'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

5. After a couple of simple questions to be answered Drupal should be up and running.

Configuring Drupal

Clean URLs converts the querystrings that come in a normal URL into an integral part of the URL. By enabling Clean URLs you would improve the readability of the URL and also increase your google page ranking. We had already enabled mod_rewrite above. So we just have to make sure that Clean Urls is enabled in Drupal administration

Other Tweaks

Install sendmail to be able to send out mails from drupal.
sudo apt-get install sendmail


Edit: We have updated the information about enabling userdir module and its configuration. Thanks Kirri


RELATED ARTICLE

/themes/custom/zyxpro_light/images/placeholder.png
close

on 04th April 2007 / by webmaster
Linux is the epitome of the FLOSS model. Technical Solution Linux installation Dewey J. Corl (not verified) access_time 20 Sep 2021 - 18:02 Linux is not ready for the general public! (I am a Ubuntu user). For proof, 1. try to simply print labels on a Dymo label printer. It takes a LOT of work to get to the ease of label printing already available in Windows and Mac. 2. try syncing a modern Palm based PDA. Yes, jpilot and others will sync the main data, but pictures and midi files do not get transferred without a lot of extra setup. These are examples of applications that are not ready for the general public. Since an operating system only supports applications, Linux is not ready to be a common desktop for the general public. While we are waiting for the applications to catch up, keep up the good work!! Anoop John (not verified) access_time 20 Sep 2021 - 18:02 Dewey Yes you may be right. But these are not applications that a common man would use. A common man would use one of these applications - Internet browser, Chat Client, Email Client, Document Writer, Presentation Creator, Spreadsheet Editor, Movie Viewer, Music Player, CD/DVD Writer. Both examples you cited are more specific applications that only a small percentage of the whole population uses. It will take time before those hardware vendors identify the need from their perspective to address the Linux community. Krishnadas (not verified) access_time 20 Sep 2021 - 18:02 Dear Mr Anoop, Thank you very much for the free installation of LINUX done in my PC. I am getting immersed in the LINUX and seeing the versatility. To my surprise, I am able to read one of my old backup CD(wherein lot of my valuable file exist) done in DIRECT CD wizard (a custom cd writing software of Easy Cd creator in WIN98) which could not be read in XP. Installation of old version of easycd creator/direct cd program was not possible in XP. I thought that possible i lost all data. Very pleasant start! Srikanth N. S. (not verified) access_time 20 Sep 2021 - 18:02 Hi Anoop, My friend is thrilled with Ubuntu. One of his grouses with windows was that after OS installation, everything else is to be installed separately which is a real headache. WHereas if u install Linux, everything is installed as a package and he is thrilled to bits! Let linux installation spread in Trivandrum and your service in this direction is highly appreciated. Kepp up the good work Regards. PDA Freak (not verified) access_time 20 Sep 2021 - 18:02 Is it possible to install linux on a packardbell notebook ? webmaster access_time 20 Sep 2021 - 18:02 In reply to Is it possible to install by PDA Freak (not verified) Sir, It should be possible. Try installing and if it shows any issues please inform us. May be we could help you. Thank You Team Zyxware

Comments


author-image
Tim (not verified)
access_time 20 Sep 2021 - 22:48

I checked the apache2.conf file and the lines of code in step 9 do not appear. To this point i have followed the instructions exactly, until step 11. I even tried to add the code manually but the gedit /etc/apache2/apache2.conf didn't work. Any ideads what i may be doing wrong? I tried skipping over and finishing the steps but didn't work and i ended up reinstalling ubuntu and starting over. Now i don't want to move on till i get each step. Thanks for any help you can give me.


author-image
Tim (not verified)
access_time 20 Sep 2021 - 22:48

When i try to open the /var/www/sites/default/settings/php firefox just stries to download it, instead of open it... I can't figure out why.



author-image
PlusNoob (not verified)
access_time 20 Sep 2021 - 22:48

am wondering if this would work at all on f.ex FreeBSD, anyone who know?


author-image
directory (not verified)
access_time 20 Sep 2021 - 22:48
Step by step its looking easier I,ll try this if i found anything new I,ll definitely share with you grate work keep it on thanx for a valuable information

author-image
the exchange board (not verified)
access_time 20 Sep 2021 - 22:48
I have always found ubuntu easy to use as a desktop OS however as a server platform, it is different from other linux distros I have been used to. I am going to use your step by step guide to install apache/php/mysql & ubuntu and see whether it sways my preference ! Thanks for your post ;)

author-image
Anonymous (not verified)
access_time 20 Sep 2021 - 22:48

1) there is no sudo gedit /etc/apache2/httpd.conf file.
2) the first step is to install apache2 and the php module. then modify the apache config. then the last installs step is

sudo apt-get install apache2 libapache2-mod-php5 php5-mysql php5-gd

which redoes the apache2 install and makes no sense. Furthermore, when you install phpmyadmin, it installs mysql. My point is there is a lot of redundancy in this guide and it is not very clear.

why not rework the ordering of the steps in this guide. I suggest get all the software, then do all the configuration.


author-image
Anonymous (not verified)
access_time 20 Sep 2021 - 22:48

How to install and configure a web development using Apache PHP MySQL making use of LVS using any linux platform


author-image
poker (not verified)
access_time 20 Sep 2021 - 22:48

Thanks so much for this tuto, i could have a lot of headaches trying to do it by myself, and must be a lot of complex to me, but you made it easy.


author-image
Anto Jose (not verified)
access_time 20 Sep 2021 - 22:48

Please add the following info to the instructions.

[Concerning STEP 1]

[Solution found at
http://mohamedaslam.com/how-to-fix-apache-could-not-reliably-determine-… ]

__________________________________________________________________
PROBLEM:
In Step 1, While executing the line "sudo apt-get install apache2 libapache2-mod-php5",
Apache server gives the following error:

Could not reliably determine the server's fully qualified domain name,
using 127.0.1.1 for ServerName

The same error appears when you try restarting apache.
__________________________________________________________________

SOLUTION:
To fix this, you need to edit the httpd.conf file. Open the terminal and type,
sudo gedit /etc/apache2/httpd.conf

By default httpd.conf file will be blank. Now, simply add the following line to the file.

ServerName localhost

Save the file and exit from gEdit.

Finally restart the server.
sudo /etc/init.d/apache2 restart

This should solve the issue.