Verified and Tested 09/28/15
In this How-To, we will walk you through the install and configuration of Drupal on CentOS 7 with Apache. Drupal is a free content management system that will facilitate the way your content is organized and managed. It has a user-friendly interface that makes customizing your content easy and simple with little effort.
– You need a CentOS 7 server that is configured with a static IP address. If you do not have a server already, you can visit our Cloud Hosting page and spin a new server up in under 30 seconds.
– You will also need to have LAMP (Linux, Apache, MySQL, PHP) installed. If your server doesn’t have LAMP installed already, see our guide here for a quick installation run through.
Installing Drupal on CentOS 7 with Apache
To get started, log in to your CentOS 7 server via SSH or Console. If you are using the Atlantic.Net cloud service, note that they are setup with minimal installations to avoid having unnecessary packages from being installed and never used. If some software packages that you’re used to using aren’t installed by default, feel free to install them as needed.
Let us download wget and unzip so we can simplify this tutorial.
sudo yum install wget unzip
Before moving on, let’s make sure the system is up to date:
sudo yum update
Creating a Database and User for Drupal on CentOS 7
For Drupal to function, we must create a database in MySQL. Let us begin access MySQL with the following command:
mysql -u root -p
Now, we must first begin creating the database that Drupal will use. This can be done by running the following command, replacing yourdbname with your desired database name:
CREATE DATABASE yourdbname;
With the database created we must now create a user so it can access the Database. Again, this can be done by running the following command, replacing yourdrupaluser with your desired username and yourdrupalpassword with your desired password.
CREATE USER yourdrupaluser@localhost IDENTIFIED BY 'yourdrupalpassword';
Now that we have a new database and database user, we must grant access to your recently created user so that it can make changes to your database. This is done by running the following command:
GRANT ALL PRIVILEGES ON yourdbname.* TO yourdrupaluser@localhost;
Additionally, we must refresh MySQL so the system can flush the newly added privileges and for the changes to take effect, then exit your session. This can be accomplished with the following commands:
FLUSH PRIVILEGES; exit
Installing Drupal on CentOS 7
The system is now ready for us to download and install Drupal. Start by downloading the latest version from the Drupal site:
Next, install the necessary PHP dependencies so that Drupal can function properly after the install is completed:
yum install php-mbstring php-gd php-xml php-pear php-fpm
After we have installed the requires dependencies, we can continue with the installation of Drupal. Run the following command to unzip the Drupal package that we downloaded.
Since, Drupal is currently in the root directory, let us copy the folder and move it into the default httpd directory:
cp -r ~/cp -r ~/drupal-7.39/* /var/www/html
Now to finalize the configurations on the servers side, we must change the create a settings file in the sites default directory. Let’s change to that directory with the following command:
Copy the default.settings.php file and rename it to settings.php with the following command:
cp -p default.settings.php settings.php
We need to modify the permissions so that the Drupal installer can edit
chmod 666 settings.php
We also need to make a files directory, do so with the following command:
Modify the permissions of files with the following command:
chmod 777 files
We need to restart Apache since we installed the PHP extensions.
systemctl restart httpd.service
Drupal’s Web Configuration on CentOS 7
Your server is now configured correctly to run the web-based installation by going to the following:
You will see the Drupal installation procedure’s initial page. Select the standard install.
Choose the language of your choice.
On the next screen, we need to enter in the Database information that we created from before. Enter the Database name, username and password, once done hit “Save an continue.”
After entering the Database info, all you need to do now is answer Drupal’s questions for your site.
Congratulations! You have just installed and configured Drupal with Apache on your CentOS 7 Cloud Server. Thank you for following along in this How-To and check back with us for any new updates.