Tuesday 22 September 2015

How to Install OpenLiteSpeed, PHP and MariaDB on CentOS 7

First thing first, I have to say sorry for not updating this blog with any new article because of some personal offline businesses. So here I am trying my best to get back online bringing a short tutorial, again.
Going back to laptop, this article is a tutorial with screenshots on how to install OpenLiteSpeed, PHP and MariaDB on your CentOS 7 VPS. I believe it will work on any VPS running on any vitualization either OpenVZ, KVM, or Xen. Please report back if it doesn’t.
So what is it anyway? The OpenLiteSpeed Web Server (or we may simply call it OLSWS) is the free version of its well known premium version, LiteSpeed / LSWS. It is a lightweight, high-performance web server that anyone can download it, install it, use it and even modify it freely because it is an Open Source software. It is now currently version 1.4.7 at the time of writing. I believe sometimes soon it will reach version 2.x.x.
OLSWS is still an event-driven architecture web server capable to perform fast and deliver websites faster. It is super lightweight with very minimal CPU and small memory footprint. Think OLSWS as Nginx plus ability to support Apache’s rewrite rule (.htaccess). Yet, it also has WebAdmin GUI with real-time statistics. It sounds cool enough? So let’s install it.

What You Need?

First stuff is of course a VPS running CentOS 7. I use CentOS 7 x86_64 minimal. OLSWS basically supports to run on many Operating Systems including CentOS 5, 6 and 7, Ubuntu 8.04 and up, Debian 4 and up, Solaris(x86): Sun0S 5.8 and up, OS X 10.3 and up, FreeBSD 4.5 and up. But as per the tittle of this guide, you’ll need CentOS 7 up and running on your VPS. Looking for a good VPS to try this tutorial? I believe DigitalOcean or RamNode will be a good place to start.
Also, some basic knowledge about Unix command and using Putty will help you. The last thing, you may also want to have a cup of coffee or tea placed next to your keyboard.

What Will We Do?

  1. Install OLSWS
  2. Install PHP
  3. and Install MariaDB
  4. Shortly, we are going to build a LOMP server (Linux, OLSWS, MariaDB and PHP).
Step 1 – Login to your server as root or as a user with root privilege (ability to use sudo). In this guide I simply login as root.
login-vps
Step 2 – Luckily, LiteSpeedTech has created repository so we can have a quick install. Currently it is available for only CentOS 5,6 and 7 so other OSs have to build from source or simply wait for the repo to become available. Use this command to add the repo into your VPS:
1
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm
It should be quick and easy:
add-openlitespeed-repo
Step 3 – Now install OpenLiteSpeed with this simple yum command:
1
yum install openlitespeed -y
this will install OLSWS along with dependencies required.
install-olsws-yum
once done, you’ll see something like this:
olsws-installed
Step 4 – Now install MariaDB server using this simple command:
1
yum install mariadb-server -y
screenshot:
install-mariadb-olsws
Step 5 – Next, let’s install PHP v5.6. Just FYI that basically when OLSWS installed, there is already PHP 5.3 installed but we can replace that with newer PHP version which in this case is 5.6. Issue this command:
1
yum install lsphp56 lsphp56-mysql -y
screenshot:
install-php-56-olsws
Step 6 – Now enable PHP 5.6 by simply linking it into the location that OpenLiteSpeed calls when attempting to execute PHP code. Issue command below:
1
ln -sf /usr/local/lsws/lsphp56/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
screenshot:
use-php-56
Step 7 – this is an important step, to change default username and password of your newly installed OLSWS. There is a file you have to execute it:
1
/usr/local/lsws/admin/misc/admpass.sh
Make sure you remember your newly created password.
p.s: default username is “admin” with “123456” as default password.
change-openlitespeed-password
Step 8 – Do not forget to also setup your Mariadb server:
1
2
systemctl start mariadb
systemctl enable mariadb
The first command is to start and the second one is to enable it during server reboots. Next, setup some basic configuration using this command:
1
mysql_secure_installation
Sorry but I don’t put screenshot pics as I write it already which you can read here.
Step 9 – That’s it. Now you can give it a test whether OLSWS is running or not:
1
service lsws status
pic:
check-olsws-status
Next, open up your favorite browser like Firefox and type the IP address of your VPS plus port 8088:
1
http://xxx.xxx.xxx.xxx:8088
olsws-welcome-page
Step 10 – You can also open OLSWS web based GUI / interface which is available via port 7080.
1
http://xxx.xxx.xxx.xxx:7080
olsws-admin-login
That’s all. Enjoy
Coming up next: Initial configuration of OpenLiteSpeed Web Server.

No comments:

Post a Comment