Drupal 7.31 Released – Installing and Configuring on Debian/Ubuntu
Drupal is an open-source content management system (CMS), written in PHP and released under GPL. It was first released in January 2001 to power personal blogs, corporations websites and any kind of websites that people may need. Today, Drupal is one of the most famous CMS in the world running millions of websites worldwide.
Features
- Free and open-sourced.
- Basic features like the ability to publish posts, pages, and a comment system, RSS feed, users registration. install and modify templates & add-ons.
- More than 30000 available modules to download for free from the Drupal store.
- Available in more than 110 languages with support for RTL languages like Arabic.
- Multi-site support and Multi-user content editing and creation support.
- Support for creating blogs, forums, polls using modules that are installed by default.
- Customized Drupal releases called “Distributions”, like Linux distributions, Drupal distributions are a pre-configured Drupal installations for specific kind of websites, they have some pre-installed modules and templates as well.
- Very-well updates system to notify you about security updates.
- Many other features.
This article will guide you to install the latest version of Drupal 7.31 on Debian/Ubuntu Server.
Step 1: Install Apache, PHP and MySQL
1. To install Drupal, you will require a running web-server and a database server, in this article we will work with Apache2, PHP5 and MySQL, you can install them easily with the help of package manager tool called apt.
$ sudo apt-get install apache2 php5 php5-mysql mysql-client mysql-server
2. During package installation, it will ask you about the password for the MySQL root user. Enter the new password for MySQL root user.
Retype the password again.
That’s it, you’ve successfully installed all the required packages and also added MySQL password. Now it’s time to move forward and create database for drupal installation.
Step 2: Create Drupal Database
3. We’ll need to create a database for our Drupal installation, to do so, run the following command to connect to the mysql shell.
$ mysql -u root -p
Note: It will ask you to enter the MySQL root password, that you’ve entered while installing MySQL package, enter it and you will be prompted to the mysql terminal.
4. Next, run the following series of commands on the MySQL terminal to create new ‘drupal‘ user, database and grant privileges.
## Creating New User for Drupal Database ## CREATE USER drupal@localhost IDENTIFIED BY "your_password_here"; ## Create New Database ## create database drupal; ## Grant Privileges to Database ## GRANT ALL ON drupal.* TO drupal@localhost; ## FLUSH privileges ## FLUSH PRIVILEGES; ## Exit ## exit
Note: If you want, you can replace user name and database name with any other name.
Step 3: Download and Install Drupal 7.31
5. Drupal is available to download from the official Ubuntu/Debian repository as a package, however it is an old version from Drupal which has many security vulnerabilities (at the time of writing this article, it is 7.26, and the current Drupal version is 7.31), that’s why we will be downloading Drupal from the official website.
At the time of writing this article, the latest version from Drupal is 7.31 which we’ll be working with here, but you may check for the latest version from the link provided below.
6. Alternatively, you may use the following ‘wget‘ command to grab the latest version directly.
$ wget http://ftp.drupal.org/files/projects/drupal-7.31.tar.gz
7. Replace 7.31 with the latest version number, if it was different, now let’s extract the file and take it away to /var/www/html/ (which is the default root folder for apache2 after installation) inside the Drupal folder.
$ tar -xf drupal-7.31.tar.gz $ sudo mkdir -p /var/www/html/drupal $ sudo cp -R drupal-7.31/* /var/www/html/drupal
8. Now all, what you have to do is to, open your browser and go the any of following links to begin installation.
http://yourdomain.com/drupal OR http://your-ip-address/drupal
9. Now in the requirements page you will see many error messages like missing packages, missing configuration and permission issues.
10. To fix these above errors, run the following commands.
$ sudo apt-get install php5-gd $ sudo service apache2 restart $ sudo mkdir -p /var/www/html/drupal/sites/default/files $ sudo chmod 777 /var/www/html/drupal/sites/default/files $ sudo cp -R /var/www/html/drupal/sites/default/default.settings.php /var/www/html/drupal/sites/default/settings.php $ sudo chmod 777 /var/www/html/drupal/sites/default/settings.php
Once you done with the above commands, refresh the page in the browser.. and you will be able to continue to the next step.
11. In the Database configuration, enter the database name “drupal”, the username “drupal” and the password you’ve set in the step #4 above, and continue.
12. In the Configure site section, you will be asked to configure your website information, like site name, email address, username and password, fill those boxes as you want.
13. After installation finishes, don’t forget to change the permissions of configuration files to avoid security risks if any.
$ sudo chmod -R 755 /var/www/html/drupal/sites/default/ $ sudo chmod 755 /var/www/html/drupal/sites/default/files
That’s it your installation is ready to use.
Now go to any of following links and your website will be there.
http://yourdomain.com/drupal OR http://your-ip-address/drupal
Step 4: Configure Drupal
Drupal is a very configurable CMS, you may check those settings pages that you see at the top bar to change the settings you need.
If you want to install templates, head to following link and download the template you want, extract it to /var/www/html/drupal/themes/, where all themes are stored, and go to the “Appearance” tab to change the default theme.
If you want to install modules, head to following link and download the modules you need, extract them to /var/www/html/drupal/modules/, where all modules are stored, and head to the “Modules” tab in order to install the new modules and configure them.
For further documentation, you may visit the official docs that are provided by the Drupal project at.
Have you ever installed Drupal before? What do you think about it comparing it to other CMS’s like WordPress and Joomla? Please give your feedbacks at our comment section below.
Great Content, thank you. Just correct the the number 13. where we change the permissions once again, you wrote 777 instead of 755
Best regards!
@David,
Thanks for finding this content useful and also thanks for notifying about that permission issue at number #13, corrected in the writeup…
Installing Drupal on Debian is much easier than this if you are using Cloudways platform. You just have to login to their platform, select Drupal app, select hosting provider and server package and click launch. Within minutes, your Drupal app will be live on Debian server without using composer or anything.
If you want you can manually configure your app as well. Here is more info about this: https://www.cloudways.com/en/drupal-cloud-hosting.php
I’d like to correct you on a very common misconception: the drupal version in debian is *not* vulnerable to any known security vulnerability. Per debian policy, once a version of a program is released to a stable version of the distro, newer versions are not incorporated; instead, the debian mantainers backport the security fix to the version in the distribution.
You may notice that drupal’s version in debian wheezy (which is suported until 2018) is 7.14 and in debian Jessie (supported until 2020) is 7.32. This is *not* due to the fact that the maintainer “forgot” to update the version in wheezy, quite the contrary. Check out the changelog for the 7.14 version of drupal in wheezy here: http://metadata.ftp-master.debian.org/changelogs//main/d/drupal7/drupal7_7.14-2+deb7u10_changelog . You will notice a lot of “backported from 7.38” items (7.38 is the latest drupal release as I write this).
Also for Debian you could remove the “html” part of paths, root path is /var/www/ only.
step 10:
sudo mkdir -p /var/www/html/sites/default/files
shoudl be :
sudo mkdir -p /var/www/html/drupal/sites/default/files
Thanks Lemon for pointing out error, we’ve corrected now.
Great work!
I’ve followed your instructions and when I type the 4 line of step 10 it says that it’s not OK. As a result, when I install Drupal and type the DB (step 11) it gives me a white screen and I can’t go on
Thx
Hello Carlos.
Can you please paste the error message that you get in step 10?