Install Drupal 7 on the One-Click LEMP Application

Published on: Sun, May 10, 2015 at 11:23 pm EST
Linux Guides Server Apps

Introduction

Drupal is a popular open-source content management platform. In this article, we will show you how to install Drupal 7 on a Vultr server based on the One-Click LEMP application.

Prerequisites

Deploy a One-Click LEMP app on your Vultr account. Once the app has finished installing, login as the root user. You may also login as a non-root user, but you will need to use the sudo command throughout this tutorial.

Step one: Create a database

Display the MySQL root password in the terminal, then log into MySQL using that password.

cat /root/.my.cnf
mysql -u root -p

Setup a MySQL database for Drupal. Substitute the database name (drupal) and the username/password (myusername/mypassword) in the example below, if you would like.

create database drupal;
create user 'myusername'@'localhost' identified by 'mypassword';
grant all privileges on drupal.* to 'myusername'@'localhost' identified by 'mypassword' with grant option;
flush privileges;
exit;

Step two: Download the Drupal package

First, delete the default template files created by Vultr.

cd /usr/share/nginx/html/
rm -f background.jpg index.php logo.png

At the time of writing, the latest stable version of Drupal is 7.37. Download and unzip the Drupal package to a user-friendly directory by running the following commands.

wget http://ftp.drupal.org/files/projects/drupal-7.37.tar.gz
tar --strip-components=1 -zxvf drupal-7.37.tar.gz

Remove the archive file that you just downloaded.

rm -f drupal-7.37.tar.gz

Step three: Configure and install Drupal from your browser

Before the installation, you need to copy the default configuration file default.settings.php as a new file called settings.php in the same directory. Do not simply rename the default file, because you need both files for the Drupal installation.

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

Also, you need to add write permissions to directory sites/default and file sites/default/settings.php, or you will encounter a permission error.

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

Visit http://[SERVER_IP]/ in your browser. Substitute the [SERVER_IP] with the IP address of your VPS. Follow the on-screen instructions to configure Drupal.

On the step of "Choose profile", you can choose "Standard" to use the standard settings. If you are an experienced Drupal user, you can choose "Minimal" to customize your installation. Click the button labeled "Save and continue".

On the step of "Choose language", click "Save and continue" to use English (built-in). If you want to use a language other than English, click the "Learn how to install Drupal in other languages" link.

On the step of "Set up database", you need to input database parameters as specified below.

Remember to replace the database name drupal, the database username myusername, the database password mypassword, and the table prefix drupal_ with your own ones. Do not modify other fields.

Database type: MySQL, MariaDB, or equivalent
Database name: drupal
Database username: myusername
Database password: mypassword
Database table prefix: drupal_

On the step of "Configure site", the installation wizard will notify you to remove write permissions to directory sites/default and file sites/default/settings.php. Input the following commands in your terminal window:

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

Next, input the site name, site email address, administrator's username, password, and email address from your browser. Select the default country and time zone. Click "Save and continue" to proceed.

On the step of "Finished", click "Visit your new site" to finish the installation.

That's it. You have installed Drupal 7 onto your Vultr VPS.

Want to contribute ?

You could earn up to $300 by adding new articles