How To Setup Drupal On Ubuntu Server

In this tutorial we will install Drupal 7 on Ubuntu Server. If you would like steps on how to setup Ubuntu server visit one of the following URLs:

Install Ubuntu Server 11.04: ../ubuntu/how-to-install-and-configure-ubuntu-1104-as-a-web-server.html

Install Ubuntu 10.04 LTS Server:


In the following steps we will assume that you are installing this on a fresh install of Ubuntu server with no other web sites running. If you already have other sites adjust the steps to fit your enviroment.

Note: Drupal can some time render weird if you don't have it in the root directory or virtual host setup.





We will be installing the most current version of Druapl (7.8 as of writing this).

If you would like to install a different version grab the .tar file from


You can also use the offical drupal documentation for additional help.


Login to your ubuntu server with a user that has sudo privilages.

Change directories into the web server directory. (Default: /var/www/)

cd /var/www



Change directories to ubuntu apache web server root directory /var/www/




If you issue the ls command you can see the files located in this directory. Note that by default there is a file called index.html. This is the default file when you first install apache. This file can be deleted.



Use the ls command to see files located in ./var/www - Note the default index.html file



By default apache has a index.html file that is used to test the default web server. We will want to remove this file.

sudo rm index.html



Lets remove the default index.html file with the rm command sudo rm index.html



Enter your password



Enter Your Password



Now if we do the ls command again we should just have a blank folder.




Doing the ls command we should now see the root web directory empty



we will now want to download the drupal files from We will use wget to pull these down.

sudo wget



Use wget to download the druapl files


you should now see that wget downloaded the drupal .tar.gz file



Once it completes we will ls again to confirm that it downloaded




Use ls to list the files and confirm that the drupal tar.gz file downloaded



We will now want to untar are drupal download

Note: I am using a * in the command so if a new release is out when you are reading this it should still untar it.

sudo tar -xvf drupal*.tar.gz



untar the drupal directory tar -xvf drupa*.tar.gz



Drupal File being untared on the ubuntu server



Since we have sucessfully untared it we will want to clean up and remove the tar file.

rm drupal*.tar.gz



remove the drupal tar file with rm drupal*.tar.gz command



Now lets change directories into the drupal folder

cd drupal*



Change directories into the new untared drupal file



Now we are going to want to copy all the files in the untared drupal folder to the root of the web server /var/www/

sudo cp -R * /var/www/



Copy all the files in the drupal directory to /var/www/ (root of web server)



We will also want to make sure we moved the .htaccess file

sudo cp .htaccess /var/www/



copy the .htaccess file to the root of the web directory /var/www/ | cp .htacess /var/www/



Lets move back a directory so we are in the root of the web server directory.

cd ..



lets move back a diretory to the root of the web server /var/www/



we will use the ls command once again . This time lets use the  -a option to display all files. The reason for this is the .htaccess file is hidden by default. We want to make sure this file os located here.

ls -a



issue the ls -a command to view all the files - Confirm that .htaccess is here.



We will want to do one more clean up. We can now remove the folder we just copied all the files from (drupal-version-number).

sudo rm -r drupal*



Remove the drupal directory we just coped all the files from since we don't need this any more. | rm -r drupal*



We will now need to make 2 directories

sudo mkdir /var/www/sites/default/themes

(This is the directory you can download your themes to)


Make a themes directory in /var/www/sites/default



sudo mkdir /var/www/sites/default/modules

(This is the direcory you can download all your modules to)



Make a modules directory to download your modules into /var/ww/sites/default/modules



We will need to make a few temporaty permission changes to a directrory and file for the install. Once we are done we will change permissions back.

sudo chmod a+w /var/www/sites/default



Change the permissions on the /var/www/sites/default folder



Last but not least we need to create a settings.php and change permissions  to it.

sudo cp /var/www/sites/default/default.settings.php /var/www/sites/default/settings.php



copy the default.settings.php file and make a file called settings.php



We need to make sure the server has write permissions for the install.

sudo chmod a+w /var/www/sites/default/settings.php



change permission on the freshly created settings.php file



Setting Up the Database:


To keep things simple we will use phpMyAdmin to setup a database and a database user. If you need steps on how to install phpMyAdmin on your Ubuntu system visit the following link:



Once you have phpmyadmin installed open up a brower and type the IP Address of your soon to be drupal server followed with /phpmyadmin (example:



Type your servers IP Address/phpmyadmin in a browser. (example:



Click on the Privilages tab



Click on privileges tab in phpMyAdmin


Click on Add A New User link (located just below the list of current users)



Click on Add new User )located below current users)



Create A name for the user (Example: drupal)

Set host to localhost

Generate and copy the password or create your own. (You should only need this password for the first setup of the drupal site.)



Create a username and password for the database user



Select the Create database with same name and grant all privileges radio button



Select  Create database with the same name and grant all privileges



Scroll down to the bottom and select Go

You should see a message saying that You have added a new user.



New user add phpMyAdmin message



We now have are drupal MySQL database created with a username.



Configuring Drupal:


We are getting close to having things up and running. Open up your web browser and type the IP address of you drupal web server .

Select Standard Install and click Save and continue



open up a browser and type the IP address of your server



Select English and click Save and continue



Selecyt English and click Save and continue



Enter Your database username that you created in phpmyadmin

Since we created the database to be the same as the username I enter it again

Enter the password for your MySQL database

Click on Save and continue


Enter Your database, username and password created in phpMyAdmin



It should take a few minutes to install all the modules.



Takes a few minutes to install default modules



Create A name for your website. This could be anything you want.

You can add a email address or use a fake one such as

Create a username that you want to use to login to the site.

Enter the email address of that user. I would recommending using your real email address.

create a password

Confirm password

Set Country

Set Time Zone

Click Save and continue



Enter SiteName, Create a user, create a password, enter email address



Congrats you have a basic drupal site up and running



drupal Site install complete on ubuntu server 11.04



Click on the visit your new website link to see what it looks like.



Default Drupal Site Home Page - Ubuntu server , Drupal 7



Now that we have are site up and running we need to go back to the server and secure two things. We need to change permissions on a folder and a file that holds are database information. We really want to make sure settings.php is secure.

sudo chmod go-w /var/www/sites/default



Change permissions on the default folders after drupal install complete



sudo chmod go-w /var/www/sites/default/settings.php



Change the permissions back after your drupal install is complete



You should be all set to start enjoying the powers of drupal on your Ubuntu Linux Sever. In later articles we will exploreer configuring drupal and covering some of the basic concepts.


If you enjoyed this post, please share it on your favorite social network by clicking on the “Share / Save” bar below.




Simple Steps to install and configuring a website using wordpress on Ubuntu