Installing Drupal 7
Updated by Linode Written by Linode
Drupal is an advanced and powerful content management framework, built on the PHP scripting language and supported by a database engine like MySQL. Drupal provides a flexible system that can be used to manage websites of all different types and profiles. Drupal is capable of providing the tools necessary to create rich, interactive “community” websites with forums, user blogs, and private messaging. Drupal can also provide support for multifaceted personal publishing projects and can power podcasts, blogs, and knowledge-based systems, all within a single, unified platform.
As the system’s functionality is highly modular, one might even be inclined to think about Drupal not strictly as a content management system but rather as a content management framework. In addition to the core infrastructure, there are a number of Drupal modules that allow administrators of Drupal sites to provide specific functionality to the users of their sites without needing to spend resources on custom development. Furthermore, Drupal has an advanced theming engine that allows for a great amount of flexibility for displaying content in a visually useful and productive manner.
Before we begin with the Drupal installation, there are few other guides that provide instructions for installing the necessary prerequisites.
- If you’re new to Linux system administration, consider our Linux System Administration Basics guides.
- Before you can install Drupal, please complete our Getting Started guide to get a fully updated and running system.
- Then, you will want to use one of the LAMP guides, or for beginners, the Hosting a Website guide to get a functioning Linux/Apache/MySQL/PHP stack installed on your Linode.
- If you want more information about installing Apache or the MySQL database, our guides provide some additional information regarding these dependencies.
With these dependencies installed and running, we’re ready to begin installing the Drupal content management system. We assume that you have a working SSH connection to your server and database credentials to access your database server.
NoteThe steps required in this guide require root privileges. Be sure to run the steps below as
rootor with the sudo prefix. For more information on privileges see our Users and Groups guide.
Download and Install Drupal 7
The Drupal software is frequently updated as bugs are patched and security vulnerabilities are found and removed. Visit the Drupal download page to find the latest version of the Drupal 7 Release, and download that file rather than the file mentioned in the example below. A sample release chart is pictured below.
If you installed and configured your Apache server as described in our other guides, the publicly accessible DocumentRoot will be in a directory similar to
/var/www/example.com/public_html/. You will change directories to the non-publicly accessible
/var/www/example.com/directory, using the following command:
Download Drupal with
Extract the file:
tar -zxvf drupal-7.32.tar.gz
Now, we can copy this instance of Drupal to a new web-accessible directory:
cp -R drupal-7.32/* /var/www/example.com/public_html/drupal/
Move the following files to the new directory as well:
mv drupal-7.32/.htaccess /var/www/example.com/public_html/drupal/ mv drupal-7.32/.gitignore /var/www/example.com/public_html/drupal/
NoteIf you want Drupal to be installed in the root level of your domain, copy the files into the
public_html/directory rather than into the
Drupal depends on a graphics library of PHP5 called GD. Install GD with the following command:
apt-get install php5-gd
Optional: To name URLs, Drupal 8 requires that the Apache2 rewrite module is turned on. This is optional for Drupal 7. To enable rewrites enter the following command:
Apache2 prompts you to restart:
service apache2 restart
Remember to change the commands above to reflect the latest version or version that you want to download.
Configure Drupal Settings
Change directories to Drupal’s
cp default.settings.php settings.php
drupal/sites/default/files/directory that’s writable by the web server by changing the group ownership and permissions of the directory to
www-dataor whichever user group your Apache instance runs under:
mkdir /var/www/example.com/public_html/drupal/sites/default/files/ chgrp www-data /var/www/example.com/public_html/drupal/sites/default/files/ chmod 775 /var/www/example.com/public_html/drupal/sites/default/files/
Grant Drupal - and thus the web server - the ability to read and write the
settings.phpfile during the setup process. Note that we will revoke these permissions after completing the setup. Issue the following command while still in the
chmod 757 settings.php
Now, follow the Drupal installation process by visiting
http://example.com/drupal/install.phpand then altering the URL to reflect your domain or IP address and the actual path to your Drupal files. You will arrive at an iconic Drupal page where, if you select “Install Drupal in English,” you will enter the installation process.
The installation process is fairly straightforward and asks you to provide information regarding your database, your site, and your administrative users. Follow each step as instructed. When you’ve completed the installation process you can remove the write access to the
settings.phpfile with the following command:
chmod 755 /var/www/example.com/public_html/drupal/sites/default/settings.php
NoteDuring the creation of the LAMP stack, you should have created a MySQL database. If you have forgotten the name of that database, log back into MySQL with the
mysql -u root -pcommand and then enter the
You’re now ready to begin using Drupal.
Because Drupal is such a flexible and versatile system, it is difficult to recommend any particular set of practices for effective Drupal administration. The following guidelines and suggestions may be helpful on your journey:
- Drupal sites tend to consume a great deal of system resources because of the way the system interacts with the database server. If you’re having this kind of problem, consider resizing your Linode for more RAM or running your database on a dedicated database server.
- While it may be tempting to use many modules, it’s often prudent to restrict your use of contributed modules to only those that provide functionality that you actively need. Turn off modules that you’re not using to reduce your risk of running out of system resources or presenting possible security vulnerabilities.
- Linode - and the Drupal community - recommend that you avoid doing development work on you production machine. If at all possible, keep a clone of your production environment on an alternate server or on your local machine. This will allow you to test new modules and changes without affecting your live site.
Join our Community
This guide is published under a CC BY-ND 4.0 license.