Hi there, I'm writing this post to explain the process of installing and configuring Drupal 8.2.4 on Ubuntu 16.10 Desktop.
STEPS
STEP 1
Before installing Drupal,we first need to install LAMP(Linux,apache2,MySQL,PHP). For that, the following commands were used:
sudo su (for allowing root permission)
apt-get update(update list of available packages)
apt-get upgrade (updating repositories)
Then we run the following command to install :
apache: the web server that we are going to use
php: a server-side scripting language
php-mysql: the php extension for mysql
MySQL-client: the program that we are going to use to send commands to the MySQL server
Mysql-server: will install the MySQL database server that is an
open source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL).
libapache2-mod-php: the PHP extension for apache
PHP gd,PHP curl,PHP-XML: extensions that drupal requires.The list can be found using the apt-cache command.Besides, drupal will alert you if they aren't installed during drupal's configuration.
adding -y at the end will make it so that you are not prompted again and again for confirming the installation.
apt-get install apache2 php php-mysql mysql-client mysql-server libapache2-mod-php php-gd php-curl php-xml -y (installing LAMP manually)
Note: I initially had used tasks to install the lamp server, where you only have to type two commands.However, it didn't work properly for me, so I restarted using the above command where each component of LAMP is installed manually. I think I may have had a problem because tasksel trying to install php5 instead of PHP 7.0, but I'm not sure.If you want to try the easy way, type the following command:
apt-get install tasksel(install tasksel tool)
tasksel install lamp-server (tell tasksel tool to install lamp)
STEP2
Now that we have installed LAMP, we need to setup the database for Drupal for in Mysql and configure the php.ini file.Use the following commands to connect to the MySQL shell and run the following commands to create the database, database user and to set permission for database user:-
mysql -u root -p (start mysql)
CREATE USER drupal@localhost IDENTIFIED BY "123";(create user named drupal with password 123)
create database drupal;(create database named drupal )
GRANT ALL ON drupal.* TO drupal@localhost;(grant all priveleges on the drupal database to the user named drupal)
FLUSH PRIVILEGES;(reload privelages)
exit (exit mysql)
Now edit the
php.ini file located in the path
/etc/php/7.0/apache2 and search for the
expose_php and
allow_url_fopen parameter inside the
php.ini file and set it ‘
off ‘ for both option. Then remove the
semicolon(;) before the parameter
‘extension=msql.so’
vim /etc/php/7.0/apache2/php.ini(open php.ini file in vim editor)
expose_php=off( This is not a command!. This and the other two lines are fields you have to edit.)
allow_url_fopen=off
extension=msql.so
When you have finished editing, press the Esc key, then press the colon (:) key to enter command mode. Then press x and press the Enter key.This will save the file and close it at the same time.
STEP 3
Now Open the
apache2.conf file located in
/etc/apache2 and change
AllowOverride None to
AllowOverride all for all the parameters.
vim /etc/apache2/apache2.conf(open apache.conf file in vim editor)
AllowOverride all
After that, we have to enable the rewrite functionality for the Apache server. After enabling we have to restart the service for apache.
a2enmod rewrite(activate mod rewrite module)
service apache2 restart(restart apache's service)
STEP 4
Use the following link to download drupal by using the wget command
https://www.drupal.org/project/drupal
wget https://ftp.drupal.org/files/projects/drupal-8.2.4.tar.gz download the drupal zip)
After that use the following command to extract the files:
tar -zxf drupal-8.2.4.tar.gz(extract drupal zip)
STEP 5
Now we have to create a directory for drupal.Then we have to copy the extracted files and .htaccess
files into it. The file ‘.htaccess’ is responsible for redirecting the links to our website.
mkdir /var/www/html/drupal (make directory named drupal)
cp -R drupal-8.2.4/* drupal-8.2.4/.htaccess /var/www/html/drupal/(copy files to our new directory)
We are required to create a subdirectory
in the default site installation directory. It is used by the files such as custom logos, site photos and other media associated with our new site.
mkdir /var/www/html/drupal/sites/default/files(make directory named files)
chown www-data:www-data /var/www/html/drupal/sites/default/files
(change owner of files)
We are also required to create the initial configuration files for the default site and to restart
the services.
cp /var/www/html/drupal/sites/default/default.settings.php /var/www/html/drupal/sites/default/settings.php(copy files)
chown www-data:www-data /var/www/html/drupal/sites/default/settings.php(change owner of file)
STEP 6
Now we have to navigate to either
http://yourdomain.com/drupal or HTTP://<your-ip-address>/drupal
 |
| select your language |
Now select the
installation profile that suits you and click
save and continue.
 |
| select your preferred installation profile. |
At this point, I encountered two errors.One, my PHPextensions were disabled.Two, clearurls were disabled.
To solve the first error, I ran the following commands:
apt-get install php-xml(enable xml extension)
apt-get install php-gd(enable GD extensiom)
To solve the clear URLs problem, I opened the apache.conf file using the following command:
vim /etc/apache2/apache2.conf(open apache.conf in vim editor)
then edited the following fields:
<Directory /usr/share/drupal8/>
Options +FollowSymLinks
AllowOverride All
order allow,deny
allow from all
</Directory>
everywhere where there is 'none' in your file in that field, replace by 'all'.
save and exit using the following key sequence: {Esc},{:},{x},{Enter}
after that we have to restart apache, run another command, and restart again:
service apache2 restart(restart apache's service)
a2enmod rewrite(enable mod rewrite module)
service apache2 restart(restart apache's service)
Next, re-open
HTTP://<your-ip-address>/drupal and continue like before, then you will see the following page, where you have to fill out the fields.
 |
| enter your details |
After that, configure your site as needed, and you're done.
 |
| Hooray! |
Thank you for following along through-out my blog, hopefully it helped you install and configure drupal.