How to install and configure Drupal on Ubuntu

Estimated reading: 4 minutes 185 views

Developing your website from scratch can be a daunting task. It’s time-consuming and expensive if you are planning to hire a developer. An easy way to get your blog or website off the ground is using a CMS (content management system) like Drupal.

Drupal is an open-source content management system (CMS), written in PHP and released under GPL. It was first released in January 2001 to power personal blogs, corporate websites, and any kind of websites that people may need. Today, Drupal is one of the most famous CMS in the world running millions of websites worldwide.

The latest version of Drupal at the time of writing this guide is Drupal 9.

Drupal Features

  • Free and open-source.
  • Basic features like the ability to publish posts, pages, and a comment system, RSS feed, user registration. install and modify templates & add-ons.
  • More than 30000 available modules to download for free from the Drupal store.
  • Available in more than 110 languages with support for RTL languages like Arabic.
  • Multi-site support and Multi-user content editing and creation support.
  • Support for creating blogs, forums, polls using modules that are installed by default.
  • Very-well updates system to notify you about security updates.
  • Many other features.

There are some steps to setup Drupal on Ubuntu:

Step 1: Update the System

$ apt update

Step 2:Install Apache2

$ apt install apache2
  • Start & Enable the Apache2 service.
$ systemctl start apache2
$ systemctl enable apache2

Step 3: Install PHP

$ apt install php libapache2-mod-php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-intl php-mbstring php-curl php-xml php-pear php-tidy php-soap php-bcmath php-xmlrpc

Step 4: Install MySQL Server

$ apt install mysql-server
  • Start & Enable the MySQL server.
$ systemctl start mysql
$ systemctl enable mysql

Step 5: Configure the MySQL Database.

  • Login to MySQL Shell.
$ mysql -u root -p
  • Provide the Password or Press the Enter.
  • Here is the command output.

  • Create a User & Set a password.
CREATE USER drupal@localhost IDENTIFIED BY "your password_here";
  • Create database.
create database drupal;
  • Run Grant all privileges command
GRANT ALL ON drupal.* TO drupal@localhost;
  • Run Flush privileges & Exit commands.
FLUSH PRIVILEGES;
exit

Note: If you want, you can replace the user name and database name with any other name.

  • Here is the command output.

Step 6: Now Download the Drupal on system.

$ wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
  • Here is the command output.

  • Extract the downloaded folder.
$ tar -xvf drupal.tar.gz
  • Move the extracted folder to /var/www/html/.
$ mv drupal-9.4.8 /var/www/html/drupal
  • Provide the following permissions.
$ chown -R www-data:www-data /var/www/html/drupal/
$ chmod -R 755 /var/www/html/drupal/
  • Here is the command output.

Step 7: Configure the Apache virtual host file.

  • Create a file.
$ nano /etc/apache2/sites-available/drupal.conf
  • Add the following lines:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/drupal/
ServerName example.com
ServerAlias www.example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/drupal/>
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>

Save and exit the configuration file.

  • Disable the default file.
$ a2dissite 000-default.conf
  • Enable the file.
$ a2ensite drupal.conf
  • Run rewrite command.
$ a2enmod rewrite
  • Restart the Apache2 service.
$ systemctl restart apache2

Step 8: Open Drupal Web Interface.

http://server-ip
  • Here is the output.
  • Select the Language.
  • Click on Save & Continue.

  • Select Standard profile for Installation.
  • Click on Save & Continue.
  • Configure the database,provide the db username,db name & db password.
  • Click on Save & Continue.

  • Now Installation is started.

  • Configure the Site.
  • Provide the required information such as Site name,Email-address,username & password.

  • Select country & Time zone.
  • Click on Save & Continue.

  • Now Drupal is Ready.

Good Luck!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Leave a Comment