how to install and configure drupal on ubuntu

Spread the love
Drupal is an opensource content management system that allows anyone to build amazing websites. It’s free and has a community of dedicated supporters building cool tools to enhance it. Drupal is a free and open source content-management framework written in PHP and distributed under the GNU General Public License. Drupal runs on any computing platform that supports both a Web server capable of running PHP and a database to store content and configuration.




Uptate the ubuntu packages.
#apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove




Install apache2 services and enable
# apt-get install apache2
# systemctl start apache2.service
# systemctl enable apache2.service




Install Mysql service and configure database.
# apt-get -y install mysql-server mysql-client
# systemctl start mysql.service
# systemctl enable mysql.service




Run the commands below to secure MySQL server.
# mysql_secure_installation




Login to mysql and configure database :
# mysql -u root -p




root@ip-10-0-1-59:/home/ubuntu# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 7
Server version: 5.7.21-0ubuntu0.16.04.1 (Ubuntu)


Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.


mysql> CREATE DATABASE drupal;
Query OK, 1 row affected (0.00 sec)




mysql> CREATE USER drupaluser@localhost IDENTIFIED BY ‘password’;
Query OK, 0 rows affected (0.00 sec)


mysql> GRANT ALL ON drupal.* TO drupaluser@localhost;
Query OK, 0 rows affected (0.00 sec)


mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)


mysql> exit;
Bye






Install Php and other modules :


# apt-get install php libapache2-mod-php php-mysql php-xml php-mysql php-curl php-gd php-imagick php-imap php-mcrypt php-recode php-tidy php-xmlrpc




Download latest drupal content :
# cd /tmp && wget ftp.drupal.org/files/projects/drupal-8.3.5.tar.gz




Extract the downloaded file
# tar xzvf drupal*




Move drupal content to apache root directory :
# mv drupal-8.3.5/* /var/www/html






Create setting.php file by copying the default.settings.php file.
# cp /var/www/html/sites/default/default.settings.php /var/www/html/sites/default/settings.php




Set permission and ownership of root directory :
# chmod -R 755 /var/www/html/*
# chown -R www-data:www-data /var/www/html/*




Enable Apache2 modules:
# a2enmod rewrite
# a2enmod env
# a2enmod dir
# a2enmod mime






Edit apache configuration file and change the setting as given below :
# vim /etc/apache2/sites-enabled/000-default.conf




<VirtualHost *:80>


     ServerAdmin vishal@vishalvyas.com
     DocumentRoot /var/www/html/
     ServerName vishalvyas.com
     ServerAlias www.vishalvyas.com
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined


      <Directory /var/www/html/>
           Options FollowSymlinks
           AllowOverride All
           Require all granted
      </Directory>
      <Directory /var/www/html/>
           RewriteEngine on
           RewriteBase /
           RewriteCond %{REQUEST_FILENAME} !-f
           RewriteCond %{REQUEST_FILENAME} !-d
           RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
      </Directory>


</VirtualHost>




Restart apache service :


# systemctl restart apache2


After restart Apache, open your web browser and browse your ip and you should see Drupal configuration wizard.










Select Standard installation and continue
See also  GoAccess a Real time Web Server Log Analyzer






Enter Database Information and continue.



Installing Drupal.






Enter your details and configure site.






It’s Done.



Your Drupal site is ready to use and implement.








By VishalVyas










Linuxguru

Leave a Comment