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 Server Setup
1. Run the following command to install apache on your machine
sudo apt-get install apache2 libapache2-mod-php5
2. Install PHPMyAdmin from Synaptic to enable remote DB Access a bit easier. 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 gedit /etc/apache2/httpd.conf
At the bottom add the following
# Enable PHPMyAdmin
Include /etc/phpmyadmin/apache.conf
3. Restart the server using the following command
sudo /etc/init.d/apache2 restart
4. 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
5. 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
6. Edit /etc/apache2/mods-available/userdir.conf
and change the AllowOverride line to just read
AllowOverride All
Install MySQL and PHP5
sudo apt-get install mysql-client mysql-server mysql-query-browser mysql-admin mysql-navigator
sudo apt-get install apache2 libapache2-mod-php5 php5-mysql php5-gd
sudo /etc/init.d/apache2 restart
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
1. 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
1. 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
Comments
Ubuntu Configuration
Step by step its looking
FreeBSD
am wondering if this would work at all on f.ex FreeBSD, anyone who know?
http://heriman.wordpress.com/
http://heriman.wordpress.com/2008/08/05/enabling-apache-user-home-public...
This way is much easier. We don't need to change the contents of apache2.conf and httpd.conf. I tested it.
PHP pages wont open, they keep trying to download
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.
Step 9 of the Apache2 Server Setup
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.
Post new comment