Last updated 16 May 2016. Created on 6 September 2009.
Edited by hansfn, HongPong, Greg Boggs, calebtr. Log in to edit this page.

This page provides a summary of the command line instructions for installing Drupal on a typical UNIX/Linux web server. Every step contains a link to more detailed installation instructions where you also can find information about installing Drupal on other systems.

If you have problems, read Troubleshooting common problems.

Read more about system requirements (among which detailed PHP-settings and browser requirements).

For the fast command line based installation use Drush

Download and extract files

Download Drupal from and extract the download file to a folder on your hard drive. (Replace the 'xx' in drupal-x.x.tar.gz with the actual version you've downloaded.)

 tar -zxvf drupal-x.x.tar.gz

Move the files to a directory within your web server's document root or your public HTML directory using the following command, substituting drupal-x.x with the actual version number. (On many *nix computers the path from the server's root will be /var/www/.)

mv drupal-x.x /var/www/

You can install and use Drupal in other languages by downloading translations from Extract the files into your installation profile's translations directory. For instance, if you are using the Standard install profile, move the .po file into the directory: profiles/standard/translations/. Note for Drupal 6: This method is currently not working, please see for more information.

Read more about downloading and extracting Drupal (includes instructions for other operating systems).

Create the configuration file and grant permissions

In the sites/default directory, copy the default.settings.php file and rename the copied file to settings.php.

cp sites/default/default.settings.php sites/default/settings.php

Give the web server write privileges (666 or u=rw,g=rw,o=rw) to the configuration file.

chmod a+w sites/default/settings.php

Give the web server write privileges to the sites/default directory.

chmod a+w sites/default

Read more about settings.php and the files directory.

Create the Drupal database

To complete the installation, you must create an empty database and a user with full access to the newly created database for Drupal to use. You can do this by command line, or through phpMyAdmin or another database client.

mysqladmin -u username -p create databasename

Where 'username' is a MySQL user which has the CREATE and GRANT privileges. MySQL will prompt for the 'username' database password. Next you must set the access database rights. Log in to MySQL:

mysql -u username -p

At the MySQL prompt, enter:

  ON databasename.*
  TO 'username'@'localhost' IDENTIFIED BY 'password';


'databasename' is the name of your database
'username' is the username of your MySQL account
'localhost' is the server name used to access MySQL
'password' is the password required for that username

If successful, MySQL will reply with:

Query OK, 0 rows affected

Read more about creating the database (including instructions on using a browser-based control panel, phpMyAdmin, command line, MySQL, or PostgreSQL to create your database).

Run the installation script

You are now ready to run the installation script. Point your browser to the base URL of your website (e.g., or http://localhost/drupal).

The installation wizard will guide you through several screens to set up the database, add the first user account, and provide basic website settings. Follow the wizard to finalize the installation and start working with your Drupal website.

Quick installation with Drush

The fastest way to install a site is by using Drush. You can skip most of the other steps above too. Start with only the base of Drupal, which you can also get with Drush...

drush dl drupal --drupal-project-rename=example
cd example
drush site-install standard --db-url='mysql://[db_user]:[db_pass]@localhost/[db_name]' --site-name=Example

It will create the database for you if the db_user above has the privileges to.

By default the UID 1 account is given an "admin" username and a random generated password that gets echoed in terminal during the site installation process. You can bypass this and set your own predefined credentials with flags added to the command:

--account-name=admin --account-pass=[useruser_pass]

In case you don't get any password echoed in terminal (might be the case of an earlier drush version) try using admin as username and password.

The installation profile used can be left out, it defaults to standard, or set to something else. Use drush help si to see more flags available for the site-install command.

Resetting your Drupal build with drush site-install

In some cases, you might want to dump your data and rebuild the site from scratch. One example: if building a site based on Features modules, resetting the site would let you test your Features correctly.

To reset, i.e. delete a site's content and set up a "minimal" build, use the following. You can omit database connection strings if they are already hardcoded in settings.php .

$ drush site-install minimal --site-name=MYSITE
You are about to DROP all tables in your 'MYSITE' database. Do you want to continue? (y/n): y
Starting Drupal installation. This takes a while. Consider using the --notify global option. 
Installation complete.  User name: admin  User password: [shows random password generated]

Looking for support? Visit the forums, or join #drupal-support in IRC.


wolfrage’s picture

SQLite should be a path on this setup too, and it will require far less work, as D7 builds the SQLite DB it's self.

jsjouw’s picture

After following al the steps my the URL that works on my system = http://localhost/drupal-7.0/
The article states http://localhost/drupal/ wich does not work on my system.
is this an error in the article?

authentictech’s picture

http://localhost/drupal-7.0/ and http://localhost/drupal/ are equally correct; which you use is down to user preference. The discrepancy just reflects how you extracted the Drupal files.

You could have also used http://localhost/mywebsite/ or the web root directory for http://localhost/ or rename the directory to anything you want as long as the URL you point your browser to reflects the same name as the directory the Drupal files are stored in.

wayfarer_boy’s picture

I keep forgetting this flag in the tar command, and I sometimes find it difficult to find the handbook page on, so I thought I'd post it here.

I sometimes prefer to extract the tar archive directly to my root directory. A tar zxvf drupal-#.tar.gz command results in a drupal-#/ directory being created inside my root directory:

user:/var/www$ wget
user:/var/www$ tar zxvf drupal-7.0.tar.gz
user:/var/www$ ls
drupal-7.0  drupal-7.0.tar.gz

By using the --strip-components command, you can extract the drupal-# directory contents directly into your root directory:

user:/var/www$ tar -zxv --strip-components=1 -f drupal-7.0.tar.gz
user:/var/www$ ls
authorize.php      INSTALL.mysql.txt   misc        themes
CHANGELOG.txt      INSTALL.pgsql.txt   modules     update.php
COPYRIGHT.txt      install.php         profiles    UPGRADE.txt
cron.php           INSTALL.sqlite.txt  README.txt  web.config
drupal-7.0.tar.gz  INSTALL.txt         robots.txt  xmlrpc.php
includes           LICENSE.txt         scripts
index.php          MAINTAINERS.txt     sites

Better :)

omarsidd’s picture

It would be nice to have the actual script steps executed for things like install and update so there's room for scripting between using the GUI per-site, or using drush. (yes, I could read through both sets of code to figure it out for myself, but since others clearly have, why not make detailed directions available?)

TechNikh’s picture

If your password contains special characters, you have to encode it. otherwise it throws

parse_url(mysql://*****:#####localhost/^^^^^): Unable to parse URL

you can use tools like to encode


In 30 seconds set up Automated Visual testing of your website. Zero coding.
Ever dreamed of styling your view, We have a solution for you.

johnhorner’s picture

When I got to the end of my install, I got a very stern warning from Drupal that settings.php and sites/default need to be set back to safer permissions. But Drupal doesn't link to instructions and neither does this guide, at first glance.

The issue is that you need to reverse:

chmod a+w sites/default/settings.php
chmod a+w sites/default

by doing

chmod a-w sites/default/settings.php
chmod a-w sites/default


A second link here to which is described as instructions on "preparing the configuration file" (really it's about both preparing before and securing it after installation) would be good. The information is there but the link is a bit obscure.

Either that or just add "After successful installation, Drupal will tell you to secure the files. Here's how."

ttibensky’s picture

how to install ‪#‎Drupal‬ on ‪#‎ubuntu‬ using drush on command line, quick simple video

I hope it will help you :-)

Erik de Kamps’s picture

I usually take my google sheet (drush commands) and fill in what I need to.
This will create a full command I just paste into the command line to download and install the latest Drupal version.

timfelix’s picture

I had to remove the single quotes around my database url for the install to work with drush so:

drush site-install standard --db-url='mysql://[db_user]:[db_pass]@localhost/[db_name]' --site-name=Example

changed to:

drush site-install standard --db-url=mysql://[db_user]:[db_pass]@localhost/[db_name] --site-name=Example

antonio_pantano’s picture

There's a project developed by me that aims to ease the Drupal installation process.
The project is hosted on githib

ROrt’s picture

There is a very nice web aplication that can configure your server and install drupal out of the box.
go to
there are serveral tutorials on how to install drupal in CentOS 7 using your own cloud server.

kari.kaariainen’s picture

Where specifically? Couldn't find.