Durpal is a free and open-source content-management system written in PHP language which allows us to create and maintain our websites without needing to know any coding languages. It is freely distributed under the GNU General Public License version or later. It is used as a back-end framework for at least 2.1% of all Web sites worldwide ranging from personal blogs to corporate, political, and government sites. The Drupal Developers has recently released a new version with a huge updates and bugfixes and is called as Drupal 8. The latest build Drupal 8 has over 200 new features and improvements and is also known as the world' best free and open source content management system. Here are some of the hundreds features and improvements made in the latest release of Drupal 8.
- It has a comprehensive content modeling out of the box with entities, fields, and views.
- It consists of an awesome Administrative Interface for the customization of content page, even forms and administrative pages.
- The localization and translability of Drupal has been improved.
- Mobile-first, responsive, HTML5 output with awesome frontend design and REST-first native web services.
- It has the ability to integrate some modern PHP standards and practices with popular libraries such as Composer, Symfony2, Guzzle, and Twig.
- Drupal 8 contains enhanced caching and integration with CDNs and reverse proxies.
- It is made full compatibility with PHP7, and the PostgreSQL and SQLite databases and many more.
Here in this article, we'll learn how to install Drupal 8 Content Management System with LEMP Stack on machine running Ubuntu 15.04 and CentOS 7.
1. Installing LEMP Stack
First of all, we’ll need to setup a complete LEMP Stack in our machine running Ubuntu 15.04 or CentOS 7. LEMP stack is the composition of Nginx web server, MariaDB database server and PHP modules. To install the LEMP stack in our machine, we’ll need to open a terminal or console and run the following command in it according to the distribution we're running.
On Ubuntu 15.04
# apt-get update
# apt-get install nginx mariadb-server mariadb-client php5-mysql php-pear php5-gd php5-intl php5-curl php5-xdebug php5-dev php5-xcache php5-fpm
In Ubuntu 15.04, we'll be asked to enter a new password for the MariaDB root user as shown below. We'll need this password in future for accessing the root user of MariaDB database server.
On CentOS 7
# yum update
# yum install nginx mariadb-server mariadb-client php-mysql php-pear php-gd php-xml php-intl php-curl phpxdebug php-dev php-mbstring php-xcache php5-fpm
2. Configuring MariaDB
As we have already configured password for our MariaDB root user in our Ubuntu 15.04 machine, we'll simply skip this step of configuring MariaDB and continue the next step of creating the database for our Drupal 8. But if we are running CentOS in our machine, we'll need to follow this step in order to configure our MariaDB and set a password for the database root user. To configure MariaDB and assign a root password, we’ll need to run the following command.
# mysql_secure_installation
This will ask us to enter the password for root but as we haven’t set any password before and its our first time we’ve installed mariadb, we’ll simply press enter and go further. Then, we’ll be asked to set root password, here we’ll hit Y and enter our password for root of MariaDB. Then, we’ll simply hit enter to set the default values for the further configurations.
….
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!
…
installation should now be secure.
Thanks for using MariaDB!
After its done, we'll start the MariaDB server by running the following command.
# systemctl start mysql
Then, we'll move forward towards the creation of a database user and a database so that Drupal 8 can use it to store its data.
3. Creating MariaDB Database
Next, we'll go further towards the creation of our new database so that drupal 8 can utilize it to store its data. To do so, we’ll need to first login to the MariaDB command prompt as root. Here, we’ll need to enter the password of the MariaDB root account that we had set above.
# mysql -u root -p
After we’re logged in into the mariadb command prompt, we’ll create the database, database user, password and assign full privileges to that database. To do so, we'll need to run the following MariaDB console commands.
> CREATE DATABASE drupaldb;
> CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'Pa$$worD';
> GRANT ALL PRIVILEGES ON drupaldb.* TO 'drupaluser'@'localhost';
> FLUSH PRIVILEGES;
> EXIT;
4. Configuring PHP5-FPM
Next, we'll configure our PHP5-FPM configuration which is located at /etc/php5/fpm/php.ini using our favorite text editor.
# nano /etc/php5/fpm/php.ini
After the file is opened with the text editor, we'll need to append the file using the following configuration required to run Drupal 8.
cgi.fix_pathinfo=0
xdebug.max_nesting_level=256
Once done, we'll simply save the file and exit the text editor.
5. Configuring Nginx Server
We'll now configure our Nginx server and create the configuration file for making our drupal site working. To do so, we'll need to open /etc/nginx/sites-available/drupal.linoxide.com using a text editor.
# nano /etc/nginx/sites-available/drupal.linoxide.com
Then, we'll simply append the following configuration into the file.
server {
listen 80;
root /var/www/drupal.linoxide.com;
index index.php index.html index.htm;
server_name drupal.linoxide.com;
location / {
try_files $uri $uri/ /index.php?$args;
}location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_index index.php;
fastcgi_pass unix://var/run/php5-fpm.sock;
include fastcgi.conf;
}
}
Once done, we'll save and exit the file. After that, we'll need to activate the configuration file. To do so, we'll need to create a new link of the newly created nginx file under /etc/nginx/sites-enabled/ directory.
# sudo ln -s /etc/nginx/sites-available/drupal.linoxide.com /etc/nginx/sites-enabled/drupal.linoxide.com
6. Downloading Drupal 8
Now, we'll download the latest release of Drupal ie version 8 from the Official Download Page. We'll open the download site and get the link of the tarball file. Then, we'll simply download it using wget command in a terminal or console under /tmp/ directory.
# cd /tmp/
# wget http://ftp.drupal.org/files/projects/drupal-8.0.2.tar.gz--2016-01-16 12:48:04-- http://ftp.drupal.org/files/projects/drupal-8.0.2.tar.gz
Resolving ftp.drupal.org (ftp.drupal.org)... 103.245.222.68
...
Connecting to ftp.drupal.org (ftp.drupal.org)|103.245.222.68|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11720487 (11M) [application/octet-stream]
Saving to: 'drupal-8.0.2.tar.gz'
drupal-8.0.2.tar.gz 100%[=====================>] 11.18M 69.8MB/s in 0.2s
2016-01-16 12:48:04 (69.8 MB/s) - 'drupal-8.0.2.tar.gz' saved [11720487/11720487]
Once the Drupal 8 tarball is downloaded successfully, we'll gonna extract it.
# tar -xzf drupal-8.0.1.tar.gz
Then, we'll move the entire files extracted from the tarball to our webroot we had set above in the nginx server configuration file ie /var/www/drupal.linoxide.com . We can do that by running the following command.
# mkdir -p /var/www/drupal.linoxide.com
# mv drupal-8.0.1/* /var/www/drupal.linoxide.com
7. Enabling and Restarting Services
As all the configurations are done, we'll simply restart our servers in order to take those configurations into effect. Once done, we'll set our servers to start in every system boot. To do so, we'll need to run the following systemctl command.
On Ubuntu 15.04
# systemctl restart mysql nginx php5-fpm
# systemctl enable mysql nginx php5-fpm
On CentOS 7
# systemctl restart mariadb nginx php5-fpm
# systemctl enable mariadb nginx php5-fpm
8. Allowing Firewall
We'll need to allow port 80 to expose on the internet so that our site is accessible in the same network. To enable http or allow port 80, we'll need to run the following command.
On Ubuntu 15.04
As we know, iptables is a very popular firewall solution program used in Ubuntu system. So, to allow or expose port 80, we'll need to execute the following iptables command.
# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
# iptables-save > /etc/iptables-up.rules
On CentOS 7
CentOS 7 is shipped with systemd as the default init system and we'll have firewalld installed for as a firewall solution. To allow port 80 or http service, we'll need to run the following commands.
# firewall-cmd --permanent --add-service=http
# firewall-cmd --reload
9. Web Installation
Once everything is setup and configured as in the above steps, we'll now go forward towards the web installation of Drupal 8. We need to point our web browser to our server's ip address or domain name as http://ip-address/ or http://domain.com/ according to the configuration. Here, in this tutorial, we'll point our web browser to http://drupal.linoxide.com/ as shown in the image below.
We'll now need to select our language then click on Save and Continue to proceed further towards the installation. Then, we'll be asked to choose an installation profile between Standard and Minimal. In this tutorial, we'll go with Standard profile as it installs drupal configured with the commonly used features.
A database setup page will load in which we are required to enter the MariaDB database login details so that Drupal 8 can use that database for storing its data.
Once done, the web installer will then setup our Drupal 8 according to the configuration as shown below.
After the installation is completed, we're required to configure our website with the required information like Site name, email address, site maintenance account login details and more.
If everything went correct as expected, we'll see the homepage of our Drupal 8 website. Later, in order to login to the admin panel, we'll require the username and password we had just create above.
Conclusion
Finally, we have successfully installed Drupal 8 in our server running ubuntu 15.04 and CentOS 7 linux distributions. Once, the installation is completed, we can customize and develop beautiful websites of our requirements and desire. The above installation steps are pretty easy making Drupal 8 very simple and easy to setup by anyone with basic linux command knowledge. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-)
The post How to Setup Drupal 8 with LEMP Stack on Ubuntu 15.04 / CentOS 7 appeared first on LinOxide.