Install PyroCMS on Alibaba Cloud

By Arslan Ud Din Shafiq, Alibaba Cloud Community Blog author and Alibaba Cloud MVP.

PyroCMS is a Laravel PHP Framework based web application built using Laravel and has a versatile admin panel and is responsive and compatible with all screen sizes as well as supports multilingual system.

In this tutorial, I will be installing and setting up PyroCMS on an Alibaba Cloud Elastic Compute Service (ECS) instance with Ubuntu 16.04.

Prerequisites

  • You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you don’t know how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 2GB RAM and 2 Core processor.
  • A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  • Domain name must be pointed to your Alibaba Cloud ECS’s IP address
  • Access to VNC console in your Alibaba Cloud or SSH client installed in your PC
  • Set up your server’s hostname and create user with root privileges.

Setting up Your Environment

Setting up Your Server

Before proceeding with installation of any kind of package, run the following command to update your Ubuntu system. To run this command, remember to login from non-root user with sudo privileges.

Installing PHP

PyroCMS requires PHP 7.0 or later. In this tutorial, you will install PHP 7.2. To do so, run the following steps.

First, you’ll need to install python software properties and software properties common. To do so, run the command below.

Add a repository for newer versions of PHP.

Then, update the system to refresh the available repositories.

To install PHP 7.2, run the following command.

Installing the Required PHP Extensions

PyroCMS requires the following PHP extensions:

  1. php7.2-cli
  2. php7.2-fpm
  3. php7.2-mysql
  4. php7.2-curl
  5. php7.2-sqlite3
  6. php7.2-gd
  7. php7.2-mbstring
  8. php7.2-dom

To install the above extensions of PHP, run the following command.

When you have done installation of the above extensions, apache2 will be installed automatically, so in other words you won’t need to install it manually.

Run the following command to check installed PHP version.

Installing MariaDB

PyroCMS supports MySQL, PostgreSQL, MSSQL, Redis and SQLite. In this tutorial, you will use MariaDB server for MySQL. By default, Ubuntu repository has older version of MariaDB server. To use new version of MariaDB, you will need to add MariaDB repository to your Ubuntu system. To do so, follow the steps below.

Verify the keys by running the command below.

Add the repository by running the command below.

Update the system by running the command below.

Install MariaDB by running the following command.

Start and enable the MariaDB server so that after reboot, so that the server can start automatically.

Run the following command to enhance security of MariaDB server and set password for the root user.

Connect to the MySQL shell as root user using the command below and enter your password.

Run the following MySQL queries in your MariaDB server.

Installing Unzip

You will need to install unzip which will be used to unzip the compressed zip folder. To install unzip, run the following command.

Installing Curl

To install curl, run the following command.

Installing Git

To install git, run the following command.

Installing Composer

To install and setup composer, run the following commands.

You can check if composer installed successfully by running the command to check the version of composer.

Installing and Setting up PyroCMS

To install PyroCMS, you will need to follow the steps.

Navigate to /var/www/html using the command.

Change ownership of /var/www/html directory to aareez.

Remove index.html file using the command below.

Download the latest stable release of PyroCMS by running the command below.

Provide ownership of /var/www/html to www-data so that apache server can access the required files.

Configuring the Apache Server

Create virtual host configuration file for PyroCMS by running the following command. Afterwards, a file will be opened in nano text editor.

Copy and PyroCMS the following code and save the file.

Run the command below to disable default site.

You will need to enable the newly created virtual host. To do so, run the command below.

Now you will need to enable rewrite mod. You can do so by editing configuration file in apache2 directory or you can simply run the command below.

Now you will need to enable SSL engine. You can do so by editing configuration file in apache2 directory or you can simply run the command below.

Now you will have to restart apache server to apply the changes and load the settings by running command below.

Now you can access PyroCMS via your domain name or ECS IP address. In my case, I have accessed via http://softpedia.xyz .

Check the checkbox shown below to indicate that you agree with these terms.

Configuring the Database

Now enter your information in the following form for configuring database.

Configuring the Admin Account

To access admin panel of PyroCMS, you will need administrator’s account. To create admin account, enter your information into the following form.

Configuring the Basic Settings

You will need to set name, primary domain name, language and timezone for PyroCMS. To do this, enter this information into the form given below and click the install button to continue.

You will see the following screen during installation. It may take a few minutes for it to install.

After completion of successful installation, you may click login to access admin panel and view site to navigate to your website.

On clicking login, you will see the following screen.

After successful login to your admin panel, you will see the following dashboard.

Installing the SSL Certificate

We will install SSL certificate using Let’s Encrypt with Certbot. To do so, execute the following steps.

Update the package.

Install software-properties-common.

Add the certbot repository by running the command below.

Update the package to load the added certbot repository.

Stop apache before issuance of SSL certificate.

Install python-certbot-apache by running the command below.

Execute the following command to get Let’s Encrypt SSL issued.

Select the option 2 to redirect the link to https and update virtual host settings for SSL. Restart apache server.

You can access your website at https<span>://your_domain_name</span>.tld

Setting up Firewalls and Ports

If you have activated firewalls, you will have to define a rule in Alibaba Cloud security group for your cloud server to add exception for port 80/tcp and 443/tcp. You can enable these ports while creating ECS instance, but in case if you forgot to unblock these ports, you can follow the procedure in this guide: Setting security group rules.

Original Source

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.