How to Deploy and Host a Joomla Website on Alibaba Cloud ECS — SitePoint

This article was originally published on Alibaba Cloud. Thank you for supporting the partners who make SitePoint possible.

Joomla! is a free and open source content management system (CMS), and is one of the most popular among them. According to the official website, Joomla! is built on a model-view-controller web application framework that can be used independently of the CMS, allowing you to build powerful online applications.

One of my personal favorite features of Joomla! is the multi-language support with its large library of language packs. You can also translate the website admin backend with language extensions, helping you to easily localize your website.

Requirements and Prerequisites

Before we deploy our Joomla! instance, we need to fulfill the following requirements. We need to set up an AlibabaCloud Elastic Compute Service (ECS) Linux server (Ubuntu 16.04) with basic configurations. You should also allocate administrator (sudo) privileges to a non-root user.

You can refer to this guide for setting up your Alibaba Cloud ECS instance. If you don’t have an Alibaba Cloud account, you can sign up for free and enjoy $300 of Free Trial credit.

Installing Joomla on an Ubuntu 16.04 ECS Instance

To install Joomla on our server, we need to first install a LAMP (Linux, Apache, MySQL, PHP) stack.

Step 1: Connect to Your Server

There are many ways to connect to your server, but I will be using the Alibaba Cloud console for simplicity. To do this, go to your instance section and click connect from your created instance. You will be redirected to the Terminal.

Enter username as Root and the password you created. If you didn’t create a password, just continue by hitting enter. You are logged in to your server as system administrator.

All the commands in the following sections should be typed in this terminal.

Step 5: Confirm LAMP Installation

To confirm LAMP stack has been installed on your Ubuntu 16.04 server, follow the procedures below.

Open the web browser and navigate to your server’s IP address. You’ll see the Apache2 Ubuntu Default page.

Note: To check your server’s public IP address, check your ECS Instance dashboard. You’ll see both private and public IP addresses. Use the public IP address to access your website. If you don’t see the public IP address consider setting up an Elastic IP address.

In order to confirm the PHP installation on your server, remove the default page and replace it with the PHP code below. To do this use the commands below.

rm /var/www/html/index.html

Replace with a new file:

touch /var/www/html/index.php
nano /var/www/html/index.php

Enter a sample PHP code below:

<?php
phpinfo();
?>

To check your page, navigate to your web browser and enter the public IP address. You should see information about PHP installation if the LAMP stack is correctly installed on your server.

Now remove the index.php file using commands below:

rm /var/www//html/index.php

Step 6: Install and Configure Joomla! on ECS

We are almost done. In this step we will be installing Joomla!.

Before downloading and installing Joomla!, we need to open the Apache web server’s root directory.

Step 7: Create a MySQL Database and User for Joomla!

Joomla! makes use of relational databases to store and manage sites and user data. In this tutorial, we will use MySQL on our ECS instance. However, for production purposes, I recommend using Alibaba Cloud Apsara DB for increased security and reliability.

Since we have installed MySQL before, we just need to create a database and user for Joomla. To do this, log in to your MySQL account using the command below.

mysql -u root -p

You’ll be prompted to enter the MySQL password you created above. After successfully logging in, you’ll be taken to the MySQL shell.

Let’s now create a database for Joomla!. You can name it anything you like. In my command below, I have used “joomla”.

mysql > CREATE DATABASE joomla ;

Remember that every command in MySQL ends with a terminator semicolon (;). Create a new user and grant it permission to the database. You can replace “user” and “password” with the username and password of your choice.

mysql>GRANT ALL PRIVILEGES on joomla.* to ‘ user'@ ‘locahost' identified by ‘password';

Now, flush the privileges so that the current MySQL instance is aware of the recent privilege changes that we have made. Enter the command below.

mysql>FLUSH PRIVILEGES ;

Exit from MySQL shell with this command:

msql>exit;

Now you should be back to your server terminal.

Step 8: Complete the Installation Process through Web Interface

First, we need to restart the Apache Web server. Enter the following commands to do that:

systemct1 restart apache2

Open your web browser and navigate to your server’s public IP address. You’ll see the Joomla! web interface. Continue with the installation process.

Fill out the remaining required information until you finish the installation process. That’s it!

Final Thoughts

As mentioned previously, if you’re planning to deploy a Joomla website for production, I would recommend using Alibaba Cloud ApsaraDB for RDS. Alibaba Cloud ApsaraDB for RDS (Relational Database Service) is an on-demand database service that will free you up from the administrative task of managing a database. This leaves you with more time to focus on your core business.