Install Drupal on Ubuntu

Install Drupal on Ubuntu, drupal commerce

drupal commerce, 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.

Like WordPress and Joomla, Drupal also is base on the LAMP stack. It requires a Linux machine, a webserver, database server and PHP scripts. Follow the easy steps below to get Drupal installed.

PREPARE UBUNTU

The first step getting Drupal installed is to prepare the Ubuntu machine. To do that, run the commands below to update all installed packages on the Ubuntu machine.

sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove

After updating the Ubuntu machine, you may have to reboot the system.

INSTALL APACHE2

Now that Ubuntu is updated, run the commands below to install Apache2 webserver.

sudo apt-get install apache2

After installing Apache2, the commands below the can be used to stop, start and enable Apache2 web server.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

INSTALL MYSQL

After installing Apache2 webserver, run the  commands below to install MySQL database server.

sudo apt-get install mysql-server mysql-client

During the installation, you may get a prompt to create and confirm MySQL root password. Please create the root password as you’ll need it to manage the server. After installing MySQL, the commands below can be used to stop, start and enable MySQL.

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

Next, run the commands below to secure MySQL server.

sudo mysql_secure_installation

After running the commands above, continue below to create a database and user for Drupal. To do that, logon to MySQL server by running the commands below.

mysql -u root -p

After logging in, run the sql statement below to create a database called drupal.

CREATE DATABASE drupal;

Next, run the statement below to create a database user called drupaluser and provide a password for the user.

CREATE USER drupaluser@localhost IDENTIFIED BY ‘new_password_here’;

Now that the database and user are created, give the user rights to manage the database. You can do that by running the commands below.

GRANT ALL ON drupal.* TO drupaluser@localhost;

After that, run the commands below to flush the permission to disk and apply changes made above

FLUSH PRIVILEGES;
exit

Exit MySQL

INSTALL PHP AND OTHER MODULES

Finally, run the commands below to install PHP and other PHP related modules.

sudo 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 DRUPAL CONTENT, drupal commerce

At this point, you should have the LAMP stack installed, MySQL database created with its user and all necessary PHP modules installed.

Your next task is to download Drupal files from online. At the time of writing, the latest version is.  Run the commands below to download Drupal 8.3.5.

cd /tmp && wget ftp.drupal.org/files/projects/drupal-8.3.5.tar.gz

Change the version number if newer ones are available. Next, run the command below to extract the downloaded file.

tar xzvf drupal*

Then, move Drupal content to Apache default root directory. The default root directory is at /var/www/html.

sudo mv drupal-8.3.5/* /var/www/html

Next, create a 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

One thing you might want to do is remove Apache2 default html test file. To do that, run the commands below:

sudo rm /var/www/html/index.html

Next, change the file permission and ownership of the root directory.

sudo chmod -R 755 /var/www/html/*
sudo chown -R www-data:www-data /var/www/html/*

After that, enable Apache2 modules by running the command below:

sudo a2enmod rewrite
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

Finally, open Apache2 default config file and make the highlighted changes below, then save the file.

sudo nano /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>

     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/
     ServerName example.com
     ServerAlias www.example.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 Apache2.

sudo systemctl restart apache2

After restart Apache2, open your web browser and browse to the server hostname or IP address and you should see Drupal configuration wizard as shown below.

Install Drupal on Ubuntu

On the next screen, select Standard installation and continue

Enter the database information and continue.

Install Drupal on Ubuntu

Wait for the installation to finish, then configure the site name, admin email, site maintenance account and password and finish the installation.

Congratulations! You have just installed Drupal CMS on Ubuntu.

job posting sites
joomla web development company
matrimony website design
real estate website design
restaurant website
School management system
social websites
travel websites
wordpress website development

Corundum
Logo
Register New Account
Reset Password
Compare items
  • Total (0)
Compare
0