Installing and Configuring Apache, PHP, MySQL and Drupal on Ubuntu

StumbleThis
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

Apache2 Server Setup

1. Used Synaptic to install Apache2 as a part of Lamp
2. Install PHPMyAdmin from Synaptic to enable remote DB Access a bit easier. After this, changes were made in the confinguration file to support PHPMyAdmin

sudo gedit /etc/apache2/apache2.conf

At the bottom the following command was added

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

3. Server was restarted using the following command

sudo /etc/init.d/apache2 restart
4. Virtual Hosts were added by editing the following file

sudo gedit /etc/apache2/httpd.conf
5. The following Configuration XML Tags were added for the virtual host

<VirtualHost *>
ServerName localhost
DocumentRoot /home/user01/public_html

<Directory /home/user01/public_html/>
AllowOverride None
Order allow,deny
allow from all
</Directory >

</Virtualhost>

6. /home/user01/public_html -- > this is the place where we place all the PHP / HTML files that will be displayed by the server
7. All URLs are accessed by the following format http://localhost/~username. To enable this we must enable usedir feature in apache2
8. The UserDir configuration is located at

/etc/apache2/apache2.conf

9. Ensure the following lines are there

< IfModule mod_userdir.c >
UserDir public_html
UserDir disabled root
< Directory /home/*/public_html >
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
< /Directory >
< /IfModule>

10. The following commands where used to load this module into the apache2 server

sudo a2enmod userdir

11. Then the server was reloaded using this command

sudo /etc/init.d/apache2 reload

Installing MySQL and PHP5

Almost no configuration changes were required for these applications. All the extra effort that was required was the setting up of the Play / Sample databases in MySQL from MySQL Website.

PHP5 GD Library had to be installed for Drupal compatibility. After this the apache2 server was restarted using the command sudo /etc/init.d/apache2 restart

Installing Drupal

1. Download drupal 5.7 from http://drual.org, set up is as simple as copying the entire drupal folder to the virtual host directory of the apache2 configuration.

2. The ./drupal-5.7sites/default/settings.php, should me made writable to all the users

3. Once the things has been completed access the directory thru the browser.

4. Also a database named drupal_db has to be pre-made in the MySQL DB for drupal's usage.

5. After a couple of simple questions to be answered drupal is up and running.

Configuring Drupal

1. GD Libraries needed to be installed from PHP for proper functioning.

2. The getting started guide from http://drupal.org, is pretty good for getting to know how to use Drupal

Clean URLs Configuration in Apache2 for Drupal

Clean URLs take out the unwanted bits and ends on a normal drupal URL that exposes the node value etc. Now by enabling Clean URL one can have more meaningful URLs on the screen

This requires a new module to be loaded in to the Apache2 server which is not loaded by default.

1. Check if the mods are available in the /etc/apache2/mods-available directory, shows all the mods for Apache2

2. Check if it is loaded in the /etc/apache2/mods-enabled, alternately one can also use the apache2ctl -M to see the loaded modules

3. If the module is not loaded one can use “sudo a2enmod rewrite” command to load the module if it is avialable, else we need to get it installed.

4. Once done we need to restart the apache2 server
sudo /etc/init.d/apache2 force-reload
5. In the above Virtual Host configuration, change AllowOverride to All, from none

< Directory /home/user01/public_html/ >
AllowOverride All
Order allow,deny
allow from all
< /Directory >

6. Restart the Apache2 server
sudo /etc/init.d/apache2 restart

7. Go To Drupal Administration and enable clean URL

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Captcha
This question is for testing whether you are a human visitor
9 + 8 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.