Drupal 7 or Drupal 8?With some research, I had an idea on which Drupal version to opt for. I got to know that D7 is more documented and actually has more modules than D8 whereas D8 is more user-friendly with improved editing flexibility but with some modules not ported yet. Finally, I decided to give a chance to the latest Drupal version. As a beginner, I do not think I will need to work with advanced modules. Therefore in this step by step document, we will be installing Drupal 8!
Step 1: Make sure everything is up to dateFirst, I made sure all of my system packages are up to date by running the following commands. Using sudo su was very useful for not to waste time entering the same password again and again.
sudo apt-get update
sudo apt-get upgrade
Step 2: Install LAMP(Linux, Apache, Mysql, Php)Using Tasksel allowed me to install all packages LAMP server contain. During the process, I had to enter a password for Mysql. This password was found to be needed later on. Commands:
sudo apt-get install tasksel
sudo tasksel install lamp-server
Optional: I tested if Apache is working by going to my web browser and search "localhost". A similar web page appeared.
Installing Php extensions:I actually missed some extensions and had some problems later on. Here's the correct way to do it:
sudo apt-get install php7.0 php7.0-mysql php7.0-gd php7.0-curl libapache2-mod-php7.0 php7.0-mbstring php7.0-xml nginx mysql-server php7.0-fpm php7.0-mcrypt
//if nginx is not installing, just run sudo service apache2 stop before running the command and sudo service apache2 start after.
Enable clean URLs on Apache:I did not do this step correctly and had a warning later on. To me, vim was kind of tricky to use but ended up finding it pretty easy at the end. That is, press i for editing mode, esc for normal mode, :x to save and quit. Without sudo command, it was found to be unwritable. The correct command was:
sudo vim /etc/apache2/apache2.conf
Then, I scrolled down till
Options Indexes FollowSymLinks
Require all granted
None to All as shown above. I finished up by restarting apache with: sudo service apache2 restart
Optional: Once LAMP was installed, it was easy to check if Php was correctly configured by entering these terminal commands one after the other.
sudo nano /var/www/html/test.php
<?php phpinfo(); ?>
I was then able to go to 'localhost/test.php' on my browser. Therefore Php was configured correctly!
Step 3: Install Drupal 8From https://www.drupal.org/project/drupal/releases, I took the download link location of the latest release of Drupal. For instance, here it is "https://ftp.drupal.org/files/projects/drupal-8.2.3.tar.gz"
From terminal, I installed Drupal from the copied link location
Once done, I then 1) extracted the file,
tar -xvzf drupal-8.2.3.tar.gz
2) created a root directory for Drupal,
3) moved Drupal files to localhost,
mv drupal-8.2.3/* drupal-8.2.3/.htaccess /var/www/html/drupal
4) created some file directories for Drupal,
5) changed permission of these new directories so that Drupal can access it,
sudo chown www-data:www-data /var/www/html/drupal/sites/default/files
6) created a Drupal configuration file,
sudo cp /var/www/html/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php
7) changed access authorization of the Drupal configuration file for Drupal.
sudo chown www-data:www-data /var/www/html/drupal/sites/default/settings.php
Step 4: Create a database and user for drupal 8I then logged into MariaDB shell as root and proceeded by setting up a database name, username and password.
Here is how,
mysql -u root -p
create database [database name];
create user [drupaluser]@localhost;
set password for [drupaluser]@localhost= password["your-password"];
grant all privileges on [database name].* to [drupaluser]@localhost identified by 'your-password';
Step 5: Finish Drupal installation on my web browser!I went the setup page using the place where I installed Drupal files (it could be an IP address, localhost or a domain name) followed by /drupal.
For example, it could be 220.127.116.11/drupal or, in my case, simply localhost/drupal.
Then I was to choose my preferred language, which was English.
Then, coming to requirements verification, in my case, I had 2 errors.
sudo apt-get install php7.0-gd [As gd extension was missing]
Followed by reinstalling some extensions
sudo apt-get install --reinstall php-common php-mysql
and reloading apache.
sudo /etc/init.d/apache2 reload
Concerning the clean URLs, the solution was then found. (Step 2)
Then, for database set up, previous database name, username and passwords were needed.
It should then proceed to 40 Drupal core modules installation.
Finally, I was to fill the site maintenance account & site information. In fact, these can be re-configured again if needed on the Drupal main page!
Here is how I installed Drupal 8 on Ubuntu 16.04!
* To me, the hardest part was to configure Apache and install the missing Php extensions. They took me quite some time and research. In the end, the process was wonderful as it made me acquire some terminal commands and Ubuntu knowledge while discovering Drupal at the same time.
Thank you for reading my blog!
Comments and suggestions are always welcome. 😃