centos Archives - CloudMinister

How to install WordPress with LEMP stack on CentOS 7 VPS (Part2)

5. Install Nginx

Nginx, pronounced as “Engine X” and is a very fast and lightweight web server, that can be used to support static files, used as a reverse proxy and also for load balancing.

Firstlly, update all the software packages by typing the following command:

# yum -y update

After that install EPEL repository that is required for Nginx packages by using command:

# yum -y install epel-release

Now install Nginx by typing the command:

# yum -y install nginx

After the installation is completed you must Enable and Start Nginx server by typing command:

# systemctl start nginx

And enable it with the command:

# systemctl enable nginx
Also check its status with

# systemctl status nginx

6. Configure Firewall

After completed with installation part, configure the firewall settings with the following command:

Open HTTP port by typing command with:

# firewall-cmd –permanent –zone=public –add-service=http

If firewalld package is not available then you can install it with command:

# yum -y install firewalld

And start firewalld service with command:

# systemctl start firewalld

Now reload firewall configuration file by typing:

# firewall-cmd –reload

Now verify your installation of Nginx by visiting the following URL on any browser you like with http://ip_address

7. Configure Nginx File

An Nginx server configuration file plays an important role, So you should be more careful when setting up this file.

For configuring Nginx file go inside the following path with the following command:# cd /etc/nginx/conf.d

# vi default.conf

And write the following code in the above file i.e. default.conf.

Also change your domain in place of ip_address

server {

listen 80;

server_name 54.161.140.2;

root /usr/share/nginx/html/wordpress;

index index.php index.html index.htm;

location / {

try_files $uri $uri/ =404;

}

error_page 404 /404.html;

location = /40x.html {

root /usr/share/nginx/html/wordpress;

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root /usr/share/nginx/html/wordpress;

}

location ~* \.php$ {

try_files $uri =404;

fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;

fastcgi_index index.php;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

}

}

And save it with :wq command, after that edit the configuration file of php-fpm with the following command:

# vi /etc/php-fpm.d/www.conf

Open the file with above command and edit the following lines i.e.

user = nginx

group = nginx

Add new listen under listen = 127.0.0.1:9000

listen = /var/run/php-fpm/php-fpm.sock

And also add

listen.owner = nginx

listen.group = nginx

Remove comment (;) from the above two lines and save it with :wq.

8. Install WordPress File

You can easily download WordPress archive file from the link I provided in this blog.
First go inside /tmp directory by typing below command:
# cd /tmp
Download the latest WordPress setup by using wget command
# wget https://wordpress.org/latest.tar.gz
And if wget command not work then you can download it with the following command
# yum -y install wget
Now extract the downloaded file using below command:
# tar xzvf latest.tar.gz
After that move wordpress directory in /var/www/html directory by using command:
# mv wordpress /usr/share/nginx/html
Also change the ownership of /var/www/html directory by using the following command
# sudo chown -R nginx: /usr/share/nginx/html
# chmod -R 755 /usr/share/nginx/html

9. Test WordPress

Now for testing the server of WordPress you should restart the server for that follow the command:
# nginx -t (If the command shows ‘successfully’ message then the changes in file are correct and else the changes are wrong in the nginx configuration file.)
# systemctl restart php-fpm
# systemctl restart nginx

Then open any browser and type inside URL i.e http://ip_address/

After then configuration page i.e. http://ip_address/wp-admin/ is open and select language.

 

 

 

CONCLUSION

After this installation, you will be able to create or manage blog in wordpress CMS in Centos VPS.

 

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

  1. Prerequisites
  2. Install MySQL 8.0
  3. Configure Database in MySQL
  4. Install & Configure PHP 7.2
  5. Install Nginx
  6. Configure Firewall
  7. Configure Nginx File
  8. Install Joomla File
  9. Test Joomla

     1. Prerequisites

Before you start the installation of Joomla with (LEMP) stack on Centos 7 VPS, you must have one Centos 7 VPS with root privileges on it or you can use sudo for non-root user.  

 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)

  1. 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.

# mysql_secure_installation

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

  1. 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 

BY ‘Password’;

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:

    mysql> exit;

    mysql> \q;

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)

 

To be Continued…….

How to configure Domain Name with VirtualHost in Centos 7 VPS and attach SSL certificate?

Several providers provides Domain Name service to its customer so that people need not remember the IP address of the web server. With the help of DNS the IP address can easily resolve with Domain Name and Vise Versa.

Prerequisite

1. Domain Name – Free(Freenom), Paid(Godaddy)

VPS – Centos 7
3. Web Server – apache, nginx

Configure Domain Name

In this blog we are going to take Free Domain Name from https://www.freenom.com, you can also purchase it from Godaddy.

Now follow the steps to configure the Domain Name:

Open the above given website and search for new domain.
Select the required domain and click on checkout option.
Now click on Use DNS option and also give the IP address of your VPS, also select the period from top right corner and then click on continue.

Click On Agree all the Terms and Condition checkbox and complete the shopping.

After that go inside the Domain Name and click on DNS management for your Domain.

Configure VPS

VPS stands for Virtual Private Server are the servers provided by many organizations like AWS, Azure that are used as

Web Server for Website Hosting and Database Server for storing database of all the customer.

For Example, Centos, Ubuntu, etc.

Now follow the steps to configure VirtualHost in Centos 7 VPS.
1. Open the server with SSH and type sudo command for non-root users.

After that go inside the /var/www/html directory and create new directory over their with the Domain Name by using the following command:

# sudo cd /var/www/html

# sudo mkdir yourdomain.com

# sudo cd yourdomain.com

# sudo vi index.html

After then write “Website under construction”.

Now create new conf file with server name in conf. directory

# sudo cd /etc/httpd/conf.d

# sudo vi yourdomain.com.conf

Now write the following code to create Virtual Host,

 

DocumentRoot “/var/www/html/learalot.ga”

ServerName learnalot.ga

ServerAlias www.learnalot.ga

<Directory “/var/www/html/learnalot.ga”>

Options FollowSymLinks

AllowOverride All

Options -Indexes

 

Redirect Permanent / https://learnalot.ga <—-> If you want to redirect http traffic to https.

 

DocumentRoot “/var/www/html/learnalot.ga”

ServerName learnalot.ga

ServerAlias www.learnalot.ga

<Directory “/var/www/html/learnalot.ga”>

Options FollowSymLinks

AllowOverride All

Options -Indexes

 

 

And save the file with :wq command.

Configure Web Server

For configuring Web Server you first decide which server you want to use for hosting website, Like apache, nginx, Microsoft IIS select any server based on your requirement.

In this we are going to install apache web server by using the following command:

# yum install -y httpd

# systemctl start httpd

# systemctl enable httpd

Configure SSL certificate

SSL stands for Secure Sockets Layer is a standard security technology for establishing an encrypted connection between the server and the client, Like Mail Server and Web server(Browser) and Mail Client.

Steps to configure the Let’s Encrypt Free SSL certificate in centos7 VPS.
1. Open this URL https://certbot.eff.org/ and click on Get certbot  instruction options.

Now select the software and VPS in which your website is running.

Run VPS with SSH and use sudo if you don’t have root privileges.
Enable EPEL repository by using the following command:
# yum install -y
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Now after that enable the optional channel by using the following command:

# yum -y install yum-utils

# yum-config-manager –enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

6. Install certbot by using following command:

# yum install certbot python2-certbot-apache

Run this command to get a certificate and have Certbot edit your Apache configuration automatically to serve it, turning on HTTPS access in a single step.

# certbot –apache

Set up automatic renewal

# echo “0 0,12 * * * root python -c ‘import random;

import time; time.sleep(random.random() * 3600)’ && certbot

renew” | sudo tee -a /etc/crontab > /dev/null

Confirm that certbot worked by clicking on the particular website.

https://www.ssllabs.com/ssltest/

Enter your domain name and it will show that website is secured or not.

Test your Domain Name

Now after completing the above installation go to any browser and type the Domain Name yourdomain.com in the URL to check the configuration.

Before

After

CONCLUSION-

In this blog you can learn how to configure Domain Name with VirtualHost in centos 7 VPS and also learn how to configure SSL certificate in your website by using Let’s Encrypt Free SSL service provider.

Choosing the correct hosting control panel for your Hosting VPS or dedicated server

There are lots of open source as well as paid control panel through you can manage vps and dedicated servers, Control are being used by server admin to setup and manage the server and all services required for hosting like mail server , LAMP stack i.e apache, mysql, php and its modules effectively and By deciding correct control panel admin and user can save lots of its time and money too.

There are some advantages and disadvantages of control panels I am going to explain here .

1. GUI interface for admin and user end
2. resource consumption
3. Automation
4. Paid or open source
5. Advantages over multiple site hosting (shared Hosting)
6. Tomcat Hosting

1. WHM and cpanel

Advantages:

  • GUI of whm is best for admin and user end.
  • Automation is good in terms of auto backup, php modules installation configuration ,security ,multiple php modules.
  • Best for multiple site hosting (shared server for hosting companies).
  • All mysql versions can be installed by whm graphically in no time.
  • Best for Reseller Hosting.

Dis Advantages:

  • License for vps is 14.95 USD per month and for dedicated is 34.95 USD per month.
  • Resource hungry required minimum 2 GB RAM for installation and generally high load issue arise when resources are less.
  • Manual installation of nginx as a reverse proxy and varnish ,litespeed caused many issues over apache.
  • Apache is only supported be default as a web server.
  • Only support linux server.
  • Tomcat automation is not good on whm like setup and war file deployment is not quite easy.

2. Centos Web Panel

Advantages:

  • GUI of whm is good for admin and user end.
  • Automation is good in terms of auto backup, php modules installation configuration ,security ,multiple php modules.
  • Best for standalone servers or few personal websites server.
  • All php versions can be installed by cwp graphically in less time.
  • multiple web server support with front end cache server like nginx as a reverse proxy and varnish with apache.
  • Its a opensource control panel .
  • Consume less resources.

Dis advantages:

  • Not good for shared server where thousands of websites are hosted.
  • Mysql automation for upgrade option is missing.
  • Only support linux servers.
  • Tomcat automation is not good on centos web panel like setup and war file deployment is not quite easy.
  • Not good for Reseller Hosting.

3. Plesk control panel

Advantages:

  • GUI of whm is good for admin and user end.
  • Automation is good in terms of auto backup, php modules installation configuration ,security ,multiple php modules.
  • Good for Shared hosting servers .
  • All php versions and mysql versions can be installed graphically in less time.
    nginx and apache both supported .
  • support linux and windows OS .
  • Tomcat automation is good on plesk like setup and war file deployment is quite easy.
  • Good for reseller Hosting.

Disadvantages:

  • License cost for vps and dedicated on monthly basis.
  • Resource hungry required minimum 2 GB RAM for installation and generally high load issue arise when resources are less.
  • Manual installation of nginx as a reverse proxy and varnish ,litespeed caused many issues over apache.
  • Some times typical issues arise troubleshooting for admin is hard.
  • Do not support DKIM authentication on mail server yet.

4. Virtualmin

Advantages:

  • GUI of virtualmin is not so good for admin and user end.
  • Automation is less.
  • Can be used for standalone server.
  • nginx and apache web server both supported but manual install is required .
  • Its a opensource control panel .
  • Pro license has some cost for support .
  • Used less resources of server for automation.

Disadvantages:

  • Not good for shared server where thousands of websites are hosted.
  • Mysql automation for upgrade option is missing .
  • Manual installation of nginx as a reverse proxy and varnish ,litespeed caused many issues over apache.
  • Some times typical issues arise troubleshooting for admin is hard.
  • Only support linux servers.
  • Tomcat automation is not good on virtualmin like setup and war file deployment is not quite easy.
  • Not good for Reseller Hosting.

CentOS Web Panel

 A Free Web Hosting control panel designed for quick and easy management of Linux Dedicated & Linux VPS Server offers a huge number of options and features for remote server management services in its control panel package.

 

Please follow this link to see the CWP feature.

 

Installation CWP steps

Pre Requirements

– CWP supports static IP addresses. We do not support dynamic, sticky, or internal IP addresses.

– CWP does not provide an uninstaller. After you install CWP, you must reinstall the Linux VPS server to remove it.

– Only install CWP on a freshly installed operating system without any configuration changes.

System Requirement 

1. Setup Hostname

     # hostnamectl set-hostname admin.domain_name.com

2. Setup Server IP addresses

    -Setup fix ip to cwp server

3. Hardware Requirement
-32 bit operating systems require a minimum of 512 MB RAM
-64 bit operating systems require a minimum of 1024 MB RAM (recommended)
-Recommended System: 4 GB+ RAM so you would have the full functionality such as Anti-virus scan of emails.

4. Preparing server install some require packages like:-
# yum -y install wget vim
# yum -y update

5. Download cwp script file

     # wget http://centos-webpanel.com/cwp-el7-latest

6. Run cwp script

    # sh cwp-el7-latest

How to install centos web panel on CentOS 7

Note: wait for 5 to 10 min to complete the script and after copy all cwp details

7. After installation set root password to login in cwp panel using

     # passwd root

8. Open cwp panel in the browser using https://SERVER_IP:2031

How to install centos web panel on centos 7

conclusion

you can manage your all domain & website using remote server management in cwp panel with all security features.

Get started with CloudMinister Today