Monthly Archives: February 2018

How to install cPanel / WHM on CentOS 7

Hi there, cPanel is an online Linux-based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. This tutorial will show you the steps involved to install cPanel / WHM on CentOS 7.

There are some steps that need to be taken before we begin the install. First we need to stop and disable the network manager as cPanel won’t install with it enabled. To do so run the following two commands:

  • sudo service NetworkManager stop
  • sudo chkconfig NetworkManager off

Next set your hostname, cPanel will look for one with two dots in the name for example test.testsite.com. Run the below command but be sure to set your hostname.

  • hostnamectl set-hostname mysite.darren.com

Now restart your network just to insure all changes take effect:

  • sudo service network restart

Next insure you have perl installed by running

  • sudo yum install -y perl

Now move into the home directory by running:

  • cd /home

Now lets get the cPanel install script.

  • sudo wget https://securedownloads.cpanel.net/latest

When the script is donwloaded run:

  • sudo sh latest

The script will take 30 to 40 minutes to run when the script has run, open your browser and navigate to your IP address with the port 2087 for example:

  • 192.168.0.157:2087.

When prompted to login enter root and your root password that you use for your CentOS machine.

Once logged in follow the prompts to complete your installation.

A full video tutorial can be seen below:

How To Install Tomcat on CentOS 7

Hi there,

This short tutorial will show you how to install Tomcat 7 on CentOS 7.

“The Apache Tomcat® software is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies.”

The steps that you need to follow are detailed below. Just copy and paste them into your CentOS 7 server and all should work. If not please do comment below and I will respond as soon as I can.

First we need to download Tomcat:

  • sudo yum install tomcat

Now we will edit the tomcat.conf file, enter the below command to you CentOS machine:

  • sudo vi /usr/share/tomcat/conf/tomcat.conf

Now appened the below line to the end of the file.

JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx1026m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC"

Next we’ll install the web application manager and the documentation, run the two following commands:

  • sudo yum install tomcat-webapps tomcat-admin-webapps
  • sudo yum install tomcat-docs-webapp tomcat-javadoc

Now we’ll edit the user.xml file to allow use to get into the web manger application, enter the following command:

  • sudo vi /usr/share/tomcat/conf/tomcat-users.xml

 

Next add this line between the <tomcat-users> Tags.

<user username="admin" password="password" roles="manager-gui,admin-gui"/>

Note the username and password, we will need this shortly.

Enter the two following commands to start the service and to ensure that the service is started when Centos powers on

  • sudo service tomcat start
  • sudo chkconfig tomcat on

Now, open a browser and navigate to localhost over port 8080

  • https://localhost:8080

you should see Tomcat running:

Now click Manager app

Enter the following details:

  • Username: admin
  • Password: password

You are now in the Web application manager.

 

How to Install WordPress on Nginx on CentOS 7

Hi there,

This tutorial will show you how to install WordPress using Nginx on CentOS 7. You will need the following commands to follow along with this tutorial.

First we’ll need to install additional repos that include php71 and then install php71. The commands to do so are:

  • sudo wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  • sudo rpm -Uvh remi-release-7.rpm
  • sudo yum install yum-utils -y
  • sudo yum-config-manager –enable remi-php71
  • sudo yum –enablerepo=remi,remi-php71 install php-fpm php-common
  • sudo yum yum –enablerepo=remi,remi-php71 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

 

Next we will download WordPress, place it in the directory that we want and then correct the permissions for that folder.

  • sudo wget https://wordpress.org/latest.tar.gz
  • sudo mv latest.tar.gz /usr/share/nginx/htm
  • cd /usr/share/nginx/htm
  • sudo tar -zxvf latest.tar.gz
  • sudo chown -R nginx:nginx /usr/share/nginx/html/wordpress
  • sudo chmod -R 755 /usr/share/nginx/html/wordpress
  • sudo setenforce 0

Now lets set up a config file for our wordpress site. Run the command below and then copy and paste the text into your file, insuring that you enter your IP address into the file.

  • sudo vi /etc/nginx/conf.d/default.conf
server {
 listen 80;
 server_name YOURIPADDRESS;
 
 # note that these lines are originally from the "location /" block
 root /usr/share/nginx/html/wordpress;
 index index.php index.html index.htm;
 
 location / {
 try_files $uri $uri/ =404;
 }
 error_page 404 /404.html;
 error_page 500 502 503 504 /50x.html;
 location = /50x.html {
 root /usr/share/nginx/html;
 }
 
 location ~ \.php$ {
 try_files $uri =404;
 fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 include fastcgi_params;
 }
}

Next make some final changes to your php configuration. Run the command:

  • sudo vi /etc/php-fpm.d/www.conf

Make the following changes to this file.

  • user = apache to user = nginx
  • group = apache to group = nginx
  • listen.owner = nobody to listen.owner = nginx
  • listen.group = nobody to listen.group = nginx
  • Finally append under  this line listen = 127.0.0.1:9000
    • listen = /var/run/php-fpm/php-fpm.sock

Now restart all relevant services and ensure that they are all configured to start when the server boots.

  • sudo service php-fpm restart
  • sudo service nginx restart
  • sudo chkconfig php-fpm on
  • sudo chkconfig nginx on

Now lets do the DB settings needed.

  • mysql -u root -p
  • CREATE DATABASE wordpress;
  • GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY ‘password123’;
  • FLUSH PRIVILEGES

How to Install Nginx Web Server on CentOS 7

NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. It is a rival to the Apache web server and used extensively throughout the internet.

This tutorial will show you how to install Nginx on CentOS 7.

So to begin we’ll need to ensure that we have epel repository installed. We can do so by running the command:

  • sudo yum install epel-release

Next we can install Nginx using yum. The command to do so is:

  • sudo yum install nginx.

Next we’ll start the Nginx web server and insure it starts when the server is powered on. The two commands to do this are:

  • sudo service nginx start
  • sudo chkconfig nginx on

Now we need to navigate to our localhost. To do so open a browser window and type in localhost. You should see a screen similar to the one below:

Now that we know that Nginx is working as we expect, lets remove the default Index.html and enter our own. First delete the default index.html by running:

  • sudo rm /usr/share/nginx/html/index.html

Now create your own file using vi:

  • sudo vi /usr/share/nginx/html/index.html

Enter some test text into your file and save it. Now refresh your browser window. You should see the changes replicated. When we refreshed ours it looked like the image below:

 

A full video tutorial on how to install Nginx can be found here: