Tag Archives: CentOS7

How to Install MariaDB/MySQL on CentOS 7

In this guide we’ll go through the steps for installing the latest version of MariaDB on CentOS 7.

All Commands – without sudo

yum update -y
echo -e "[mariadb]\nname=MariaDB Repository\nbaseurl=http://yum.mariadb.org/10.3/centos7-amd64\ngpgcheck=1\ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" | tee /etc/yum.repos.d/MariaDB.repo
yum install mariadb-server mariadb-client -y
systemctl start mariadb 
systemctl enable mariadb

All Commands – with sudo

sudo yum update -y
sudo yum install mariadb-server mariadb-client -y
echo -e "[mariadb]\nname=MariaDB Repository\nbaseurl=http://yum.mariadb.org/10.3/centos7-amd64\ngpgcheck=1\ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" | sudo tee /etc/yum.repos.d/MariaDB.repo 
sudo systemctl start mariadb 
sudo systemctl enable mariadb
sudo mysql_secure_installation


MariaDB is the default database management system in CentOS 7 and is a drop-in replacement for MySQL. It is an opensource relational database that uses the Structured Query Language (SQL) to manage its data. 


  • A CentOS 7 VPS
  • Sudo access

Update Your System

Log in as a sudo user and then update your system.

yum update -y

Install MariaDB

At the time of writing this article, the latest version of MariaDB is version 10.3. If you want a different version of MariaDB, go to the official MariaDB repositories page and generate a repository file for the specific MariaDB version you require.

To enable the MariaDB repository, create a repository file named MariaDB.repo and add the following content in /etc/yum.repos.d/MariaDB.repo

name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64

Install the MariaDB server and client packages using yum.

yum install mariadb-server mariadb-client -y

Now that MariaDB has installed successfully, run the following command to start and enable the service.

systemctl start mariadb

systemctl enable mariadb

To prevent unauthorized access to your database and remove some dangerous defaults run the following command.


You will be prompted with an option to change the MariaDB root password, remove anonymous user accounts, disable root logins outside of localhost, remove test databases and reload privileges. It is recommended that you answer ‘yes’ to these options to secure the database server.

Verify the Installation

Run the following to test to get info about the installation of MariaDB.

mysqladmin -u root -p version

You’ll see an output similar to what shown below,

mysqladmin Ver 9.1 Distrib 10.3.13-MariaDB, for Linux on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Server version 10.3.13-MariaDB
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 35 sec

Threads: 7 Questions: 16 Slow queries: 0 Opens: 18 Flush tables: 1 Open tables: 12 Queries per second avg: 0.457


We’ve successfully installed and secured MariaDB on your CentOS 7 server. If you have any questions, please feel free contact our technical support.

How to Install OpenLiteSpeed Web Server on CentOS 7

In this guide we go through the steps for installing OpenLiteSpeed Web Server on CentOS 7.

All Commands – without sudo

yum update -y
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
yum install openlitespeed
/usr/local/lsws/bin/lswsctrl start
yum install epel-release
yum install lsphp70 lsphp70-mysqlnd
firewall-cmd --zone=public --permanent --add-port=7080/tcp 
firewall-cmd --reload

All Commands – with sudo

sudo yum update -y
sudo rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
sudo yum install openlitespeed
sudo /usr/local/lsws/bin/lswsctrl start
sudo yum install epel-release
sudo yum install lsphp70 lsphp70-mysqlnd
sudo /usr/local/lsws/admin/misc/admpass.sh
sudo firewall-cmd --zone=public --permanent --add-port=7080/tcp 
sudo firewall-cmd --reload

OpenLiteSpeed is a free, open source and lightweight web server from LiteSpeed. In this guide, we will demonstrate how to install OpenLiteSpeed, and then configure PHP version PHP 7.x.


  • A CentOS 7 VPS
  • Sudo access

System Update

Log in as a sudo user and the update your system,

yum update -y

Add the OpenLiteSpeed Repository

Add the OpenLitespeed Repository to install the latest version of OpenLiteSpeed.

rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm

Install OpenLiteSpeed

Install the latest version of OpenLiteSpeed using the command below.

yum install openlitespeed

Start OpenLiteSpeed using the command below.

/usr/local/lsws/bin/lswsctrl start

Note: To stop it, run /usr/local/lsws/bin/lswsctrl stop.

Install PHP

OpenLiteSpeed uses LSPHP 5 by default which has reached its end of service life.  We recommend that you install the latest stable version of LSPHP 7.x (at least 7.1 currently as 7.0 is EoL) as it has many improvements and new features.

To install the latest PHP version we need to add EPEL repository from which we can install PHP 7 with the following command.

yum install epel-release

Install PHP 7 and its MySQL extension with the command below,

yum install lsphp70 lsphp70-mysqlnd

Configure OpenLiteSpeed

OpenLiteSpeed has a WebAdmin console which is accessed through port 7080. Start by configuring the username and password for the WebAdmin console.


Pick a username for the administrative account, or press Enter to accept the default value for the username which is “admin”.

Next, you need to provide and verify a password for the Admin user. When choosing a password, choose a strong password as the WebAdmin console is open to the internet.

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]:

Please specify the administrator's password.
This is the password required to login the administration Web interface.

Retype password: 
Administrator's username/password is updated successfully!

Update the firewall rules to allow the port 7080 to access the WebAdmin console.

firewall-cmd --zone=public --permanent --add-port=7080/tcp
firewall-cmd --reload

Open your web browser and type the following URL to access WebAdmin console.


Enter the username and password that you’ve set and login.

OpenLiteSpeed WebAdmin Console

OpenLIteSpeed WebAdmin Login Page

Note: OpenLiteSpeed uses LSPHP 5 by default, we need to make few changes to setup LSPHP 70.

Login to the WebAdmin console and go to Server Configuration >> External App . There, you will find an external application named “lsphp5”. Click the Edit icon on the right hand side in order to edit this application as follows:

Name: lsphp70
Address: uds://tmp/lshttpd/lsphp.sock
Notes: LSPHP70 Configuration 
Max Connections: 35
Initial Request Timeout (secs): 60
Retry Timeout : 0
Command: /usr/local/lsws/lsphp70/bin/lsphp	

Click on the Save button to save the configurations.

Setup Script Handlers

Script handlers specifies OpenLiteSpeed which scripts should go to which external application. To setup a script handler we need to set OpenLiteSpeed to serve all .php scripts with the lsphp70 external application.

Click the Script Handler tab, and then use the Edit icon to update the script handler as follows:

Suffixes: php
Handler Type: LiteSpeed SAPI
Handler Name: lsphp70

Click the Save icon to save your changes.

The default port of OpenLiteSpeed is 8080, we need to change it to 80.

To do so, Click on Listener > Default, click the Edit icon on the right hand side, and then modify the settings as shown below:

Listener Name: Default
IP Address: ANY
Port: 80

To save these changes, gracefully restart OpenLiteSpeed by clicking the Graceful Restart icon at the top right corner.


OpenLiteSpeed WebAdmin Interface

Click Yes to restart OpenLiteSpeed.


Congrats, OpenLiteSpeed has been successfully installed on your system. For additional information, refer to the OpenLiteSpeed Homepage: https://open.litespeedtech.com/mediawiki/