How to install web server OpenLiteSpeed on instance Oracle Cloud. 
Tags: cloud, webserver, oraclecloud, openlitespeed
Published: 2021-04-03 09:06:22

###Hello Everyone, Let's Learn With Me!

In my post this time, We will learn how to install the OpenLiteSpeed web server on instance Oracle Cloud. 

![openlite speed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0dje1b19ad42o8ltrfom.png)
Pay attention to the topology above. On topology, we can see that in the VCN with CIDR 10.0.0.0/16, we will create a new instance. within the new instance, we will install OpenLiteSpeed`s web server. With an internet gateway, we can access the Web server on the internet. 

####Log in Oracle Cloud
we must log in to the platform Oracle Cloud in https://cloud.oracle.com/ first. 
Put in your name tenancy here, and click next. 
![login tenancy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pshcj4xa2ycjs9q9bh4m.png)

You can log in with your user. then click sign in. 
![username](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ob0sesnnungwb35470w.png)

###Prepare Server 
####Create VCN
After we login, click the menu button we will create a new VCN in the aksb tenancy. Okay, we just create it. !
![home page oracle cloud](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ioacq463io81r20abnqs.png)
Click Networking's menu, and then click  Virtual Cloud Network.
![VCN menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9xuljk6zqyqtudt4ph8.png)

Don't forget to choose your compartment. 
![comparment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z3nvgatv63ngagh9i2b9.png)

Click Create VCN 
![create VCN](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nqp3p1e6he29xek66lwz.png)

In here, my VCN, I named is VCN-Web with training's compartment. As a topology, the CIDR is 10.0.0.0/16. Click create VCN to create it. 
![vcn web](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6kgkdx4h4mul1n48t1wg.png)

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hlujl8rjfy2171xzs6d7.png)

####Create Subnet 
In the VCN-Web, we will create a new public subnet. Click Create Subnet button.
![create subnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1sr796pm6esyunfdjrlt.png)

for the CIDR, use 10.0.1.0/24 
![public subnet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fy972ctp2lp54o8kyun8.png)

Don't forget to choose a public subnet. For the route-table and DHCP option, you can choose by default. 
![bydefault](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cp5v9slojep77m3i66gt.png)

And for security lists choose by default too. And then click Create Subnet to create it. 
![security list](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x72ia38ari1sfxah116w.png)

Wait a minute, and your subnet running or available. 
![running](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbvsj8poa7ftp2e7wo48.png)

If VCN and subnet already, the next step we will create a new instance for the server. 
####Create instance 
Okay, click the menu button, and select Compute and choose Instances. 

![instance menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bp4t2ga0ip9rct23r0ar.png)

Here we can create a new instance. Click create a new instance. 
![create instance](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v2g3xh6hlpc8x6dkh3si.png)

The instance named is OpenLiteSpeed-VM in Availability Domain 1. 
![name ad](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qquolf0kb6e1ds59b148.png)

For Image, I use CentOS 7, you can change the image as wish you. And for shape, I change to 1 GB. 
![shape image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2rt382gstvhxmgvorrp.png)
 
For network, make sure you choose VCN-Web and select public-subnet for the subnet. 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9h0wq41wd9m0ntz9a7ya.png)

And now, you create an ssh-key in your pc. Here, I use WSL2 (Windows Subsystem for Linux 2) Ubuntu 20.04. 
use `ssh-keygen` for command. 
And see with `cat` command, to see RSA public. 
For example: `cat /home/aksb/.ssh/id_rsa.pub` 
![cat id_rsa.pub](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e4nj72q028yvhp1x5bgo.png)
 
Copy then paste on console SSH Keys. And click Create. 
![copypaste-ssh](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ohwwltmatnm4i2p5vmbk.png)

![available](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c7nk1981h8bdl64ul6d9.png)

The next step, try to connect OpenLiteSpeed-VM with SSH. 
![failed-ssh](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xwnc5awkymr2zg89oly4.png)
Yes, the result is failed. We can't still connect in VM. Because VM still not allowed to connect. Therefore, we must add an Internet Gateway on VCN-Web. 

####Create Internet Gateway
Log in to VCN-Web, select Internet Gateway. As you can see, we do not have an Internet Gateway for access to the internet. Click Create Internet Gateway to add it. 
![internetgateway-menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ufd6dvfil0aaf6sfq50.png)
![add](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m0fzelx0whuzozywndte.png)

![IGW-run](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3gkz37upg1ooiks3ozmn.png)

Then, add Internet-Gateway-WEB to Route Table. Choose Default Route Table. 
![route table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8f0q8t05wcl7ds9xj1w7.png)

In Route Rules, click Add Route Rules.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gty4r3a8pqzqoovk3ppz.png)

In Route Rule, choose Internet Gateway for the target type. And 0.0.0.0/0 for destination CIDR. Choose Internet-Gateway-WEB that we have created. Click Add Route Rule. 
![add route table](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p32ab3t4wpq3t77zv0y5.png)

![internetgatway in route rule](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ex0z9a0s468ffcszl816.png)

####Connect Instance
Try to connect VM again with ssh. 
`ssh username@ippublicserver`
For example: `ssh opc@168.138.47.185` and then Enter

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/46wiav49tn0zyl6txoai.png)
Yaps! We have successfully login in with SSH. 

###Install OpenLiteSpeed
After login to the OpenLiteSpeed-VM instance, we can start to Install OpenLiteSpeed now. 

####Add repo 
`sudo rmp -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm`

![add repo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gqhy73e5obw0ezktojl4.png)

####Install epel-release
`sudo yum install epel-release` 
![epel-release](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u6ikxgcbw9lifi0iwb8e.png)
 
####Install OpenLiteSpeed
`sudo yum install openlitespeed`
![install openlitespeed](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fh0svverujdhw7w6lmp3.png)

####Install PHP 
`sudo yum install lsphp74 lsphp74-json lsphp74-xmlrpc lsphp74-xml lsphp74-tidy lsphp74-soap lsphp74-snmp lsphp74-pspell lsphp74-process lsphp74-pgsql lsphp74-pear lsphp74-pdo lsphp74-opcache lsphp74-odbc lsphp74-mysqlnd lsphp74-mcrypt lsphp74-mbstring lsphp74-ldap lsphp74-intl lsphp74-imap lsphp74-gmp lsphp74-gd lsphp74-enchant lsphp74-dba lsphp74-common lsphp74-bcmath lsphp74-memcached lsphp74-redis`
![install PHP](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sgl5l9qtfmkajkfzp06l.png)

####Check OpenLiteSpeed
Checking the status OpenLiteSpeed, whether it's running or not.
You can check with this command :
`sudo /usr/local/lsws/bin/lswsctrl status`
![stop](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v3zpaz4izxfyx12ni9h7.png)
If not running you must enable OpenLiteSpeed first. And then, check the status again. 
`sudo /usr/local/lsws/bin/lswsctrl start` 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b1v8bdw0wlfeliaur3yz.png)
 
###Firewall Configuration On Server
####Enable port 
In OpenLiteSpeed-VM enable ports 8088 and 7080 to OpenLiteSpeed web server can access on the internet(public).  
`sudo firewall-cmd --zone=public --permanent --add-port=8088/tcp`
`sudo firewall-cmd --zone=public --permanent --add-port=7080/tcp`
![firewall](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/prod3c4qu2846thko4n9.png)

####Reload firewall configuration
`sudo firewall-cmd --reload`
![reload](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hvsgy8tdwgta6vxidqmk.png)

###Adding Port on Security List 
So that the web server can be accessed via the internet by using a port from OpenLiteSpeed, we must add ports 7080 and 8088 to the Security list in Oracle Cloud. 

Open VCN-Web, and then select Security List. Edit default security list. 
![menu security](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/omeux3jkfy4mki5yugl8.png)

In the ingress rule, click Add Ingress Rules
![menu ingress rule](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kg3k80dmdm0hwfbwajj0.png)

For CIDR use 0.0.0.0/0 with TCP protocol and 8088 and 7080 for the port. 
![add ingress rule p.8088](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ufyp7vp9101n4zn4pfq.png)
 
![7080](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tl1wpipw8kmyw1zirjc.png)
 
![finish](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2vqjovfeuk6xdnyquj7l.png)
 
 ###Check Web Server 
Copy your IP public and add port 8088 to check.
`ipserver:8088`
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g9oo2b5d6wwv1dpqrkvd.png)
Yaps.. you have successfully installed the OpenLiteSpeed Web Server. 

###Setting WebAdmin
####Web Admin 
And add the port 7080 to login Web Admin. 
`ipserver:7080` 
If your web like this, click Advance button. 
![web1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tnxln8p8k8zx6xn6dm0t.png)

Click proceed to your IP (unsafe) 
![web2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xrv3fmjvpxhn2lwvrit3.png)

![login](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zrv498pvws6f1msgcdd5.png)

####Change Username and Password 
`sudo /usr/local/lsws/admin/misc/admpass.sh`

![admin](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/892unbwg0f4d2we0bjui.png)

And then check again, and log in with a new username and password 
![u np!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5atwkmalamoe9s33g9o5.png)
 
You can set configuration here. 
![web](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ysjr4ba4gre9tp4x7o15.png)

Okay, that is all my post about how to install the OpenLiteSpeed web server on the Oracle Cloud instance. 
###Thank you for reading:)