How To Install Drupal 7 on Ubuntu Server 12.04

in How To, Web Server

Drupal is a free and open-source content-management system (CMS) based on PHP and Mysql, Drupal allows an individual or community of users to publish, manage and organize a variety of content, Drupal integrates many popular features of content management systems, weblogs, collaborative tools and discussion-based community software into one easy-to-use package.

Drupal also possible to install it on a Ubuntu Server 12.04. Currently, the Latest version of Drupal (drupal 7) is available in Official Ubuntu Software repository. Here’s a step-by-step guide on how to install drupal 7 on ubuntu server 12.04

Step-by-Step Install Drupal 7 on Ubuntu Server 12.04 via Ubuntu Software Repositories

Step 1. Make sure LAMP (Linux,Apache,MySQL,PHP) has been installed on ubuntu server 12.04, you can found a step-by-step how to install LAMP Server on Ubuntu Server 12.04 -> Here

Step 2.  Install latest version of drupal (drupal7) from the repositories with following commands:

sudo apt-get update
sudo apt-get install drupal7

Step 3. Registering Drupal to apache with following command:

sudo cp /etc/drupal/7/apache.conf /etc/apache2/mods-enabled/drupal.conf
sudo /etc/init.d/apache2 restart

Step 4. Create database with command below,in case we’ll create database with name “dbdrupal”

mysql -u root -p

Step 5. Install drupal from your favorite browser by typing http://host/drupal7/install.php

Step-by-step Installing Drupal 7 Manually

Step 1. Download and extract all drupal files into /var/www/ directory:

sudo -i
cd /var/www
tar xvf drupal-7.15.tar.gz
mv drupal-7.15/ drupal

Step 2. Change an ownership of all Drupal installation files to www-data user.

chown -R www-data.www-data /var/www/drupal/

Step 3. Create a MySQL database to be used by our new Drupal 7 installation, Let’s create and use following credentials:

  • Database: dbdrupal
  • User: drupaluser
  • Password: drupalpass
mysql -u root -p
create database dbdrupal;
CREATE USER drupaluser;

Create password: “drupalpass” for user: “drupaluser”

SET PASSWORD FOR drupaluser = PASSWORD("drupalpass");

Grant user drupaluser all permissions on the database.

GRANT ALL PRIVILEGES ON dbdrupal.* TO drupaluser@localhost IDENTIFIED BY "drupalpass";

Logout from mysql server


Step 4. Navigate your browser to Apache’s hostname or IP address and follow Drupal 7 installer (http://hostname/drupal) to complete your own Drupal  installation.

Link Reference:

  • Ioannis Smith

    Step 2 i think is wrong.

    Drupal files should not be owned by the webserver user

  • Ben

    Using the Ubuntu Repositories is a good method, however your command line tutorial is wrong, for installing on localhost. First your command for registering to apache

    you have:

    sudo cp /etc/drupal/7/apache.conf /etc/apache2/mods-enabled/drupal.conf

    it should be:

    sudo cp /etc/drupal/7/apache2.conf /etc/apache2/mods-enabled/drupal.conf

    you forgot to add apache2.conf, you had apache.conf

    The browser install you have:


    It Should Be:


    Not trying to critique good post, just figured I would add that so you could correct your install method via repository

    • ubuntusg

      you right ben, thanks for correcting

  • morda

    7 does not but 8 work exelence

Previous post:

Next post: