How to install Joomla with LEMP stack on CentOS 7 VPS (Part 1)
Joomla is a popular open source Content Management System(CMS), which is used to build websites and online application. It is separated into front-end and back-end templates.
In Joomla CMS the more focused on portal-like websites.
In this tutorial, you are going to learn how to install Joomla with LEMP(Linux,Nginx,MySQL,and PHP) on CentOS 7 VPS.
Table of Content
- Install MySQL 8.0
- Configure Database in MySQL
- Install & Configure PHP 7.2
- Install Nginx
- Configure Firewall
- Configure Nginx File
- Install Joomla File
- Test Joomla
You should also run basis command on server to check the following things-:
# df -h (To check the disk space on the system.)
# cat /etc/os-release (To verify the version of the VPS.)
# yum -y update (To update all the packages of the VPS)
Install MySQL 8.0
Joomla uses a MySQL database for storage, MySQL is used in stack for storing user details in database.
For installing MySQL on Centos 7 first you need to enable MySQL repository and then you can install MySQL.
# yum localinstall -y https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
The command used for installing MySQL in CentOS 7 VPS is as follows:
# yum install mysql-server -y
Then check the MySQL version by typing following command:
# mysql -V(‘V’ is in uppercase)
After the installation is completed MySQL will start automatically and you can check it’s status by typing:
# systemctl status mysqld
If MySQL is not start automatically you can write the following command:
# systemctl start mysqld
Before going for the next step you should generate a temporary password to access MySQL root user with the following command:
# grep ‘temporary password’ /var/log/mysqld.log
Now configure the MySQL secure installation to improve the security by typing the following commands.
Login with the temporary password and assign new password, after that in this configuration it ask several questions you can give Y or N according to your requirement.
Change the password for root ? N
Remove anonymous users? Y
Disallow root login remotely? Y
Remove test database and access to it? Y
Reload privilege tables now? Y
Configure Database in MySQL
Now create database for Joomla in MySQL for that first login with MySQL server by using the following command:
# mysql -u root -p
And give its password, after that create database in it with the command:
mysql> CREATE DATABASE joomla;
You can also check that database is created or not with the command:
mysql> SHOW DATABASES;
Now create user and assign him password by using command:
mysql> CREATE USER ‘joomla’@’localhost’ IDENTIFIED
After that grant all privileges to the user created under that database with the command:
mysql> GRANT ALL ON joomla.* TO ‘joomla’@’localhost’;
Then flush all privileges on MySQL server with the command:
mysql> FLUSH PRIVILEGES;
Now exit from the MySQL server you can use commands:
Note-: In MySQL you must end each command with a semicolon(;).
4. Install & Configure PHP 7.2
PHP is used by Joomla to do various functions done by PHP like calling plugin, calling theme, validating user permissions, checking option, grab from database, etc.
In this Blog we are using PHP 7.2 versionand install it with epel-release with remi repository.
Firstly, install yum-utils packages using the following command:
# yum -y install yum-utils
After that, install epel-release package by using command:
# yum -y install epel-release
Then import remi repository from the command:
# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Enable the remi repository by typing:
# yum-config-manager –enable remi-php72
After that install PHP and all required modules by using command:
# yum -y install php-fpm php-mysql php-mbstring php-xml php-gd php-cli php-json php-opcache php-curl
Now after the installation completed you can check the PHP version with the command:
# php -v (‘v’ is in smallcase)