CentOS Server - Server Applications

Server Applications Installations For CentOS Web Server

Application Install Checklist

Application Install Checklist

Server Applications Checklist

Applications Checklist

  √ To Do
1   Install MySQL
2   Install Postfix
3   Install PHP
4   Install Apache
5   Install Let’s Encrypt

 

Applications

Applications

Install MySQL

Installing MySQL on Centos

Uninstall MariaDB

  1. Uninstall MariaDB from the server
yum remove MariaDB-server MariaDB-client

Add the MySQL repository

  1. Download and add the following MySQL Yum repository
Downloading respository data
============================

wget https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm

Installing the repository data
==============================

yum localinstall mysql80-community-release-el7-1.noarch.rpm

Verify if the MySQL Yum repository has been added successfully

  1. with the command below very that the MySQL Yum repository has been added successfully
yum repolist enabled | grep "mysql.*-community.*"

The result should be similar to

012.PNG

Installing MySQL Release Series

If a specific release series is required follow the following steps

  1. If not already installed, install yum-config-manager

    yum update && yum install yum-utils

  2. Disable the current active sub-repository, where [xx] replaces the version number

    yum-config-manager --disable mysql[xx]-community
  3. Enable the appropriate sub-repository, where [xx] replaces the version number

    yum-config-manager --enable mysql[xx]-community

Install MySQL

  1. Install MySQL with the command below

    yum install mysql-community-server

Start and enable MySQL

  1. Start and enable MySQL with the commands below
Start mySQL
===========

systemctl start mysqld

Enable Mysql
============

systemctl enable mysqld

Secure MySQL installation

  1. Lastly, secure the installation of MySQL by running the command below and following the prompts
mysql_secure_installation

 

Applications

Install Postfix

Installing Postfix

Uninstall SendMail

  1. Run the command below to ensure that SendMail is removed/not installed
yum remove sendmail

Install Postfix

  1. Install Postfix with the below command

    yum install postfix

  2. Make postfix as default MTA for your system using the following command

    alternatives --set mta /usr/sbin/postfix

Use the command below, if the above command does not work

alternatives --set mta /usr/sbin/sendmail.postfix

Start and Enable Postfix

  1. With the below commands, start and enable Postfix
Start Postfix
=============

service postfix start

Enable Postfix
==============

chkconfig postfix on

Open Firewall Port

  1. Open the firewall with the below commands to allow Postfix to communicate
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -m state --state NEW -m udp -p udp --dport 25 -j ACCEPT
Applications

Install PHP

Installing PHP

Installing Repositories

  1. If not already installed, install the EPEL repository with the command below

    yum install epel-release

  2. Install the Remi repository to get the latest versions of PHP with the command below

    yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

  3. If not already installed, install yum-utils

    If not already installed, install

  4. Use yum-config-manager (a utility provided by yum-utils), to Remi repository as the default repository for installing PHP,  [xx] represents the version of PHP

    yum-config-manager --enable remi-php[xx] 

Installing PHP

  1. Install PHP with the command below with the default set of "add-ons" used by most PHP applications
yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

 

Applications

Install Apache

Installing Apache Web Server

  1. Run the commands below to install Apache web server
Installing Apache Web server
============================

yum install httpd

Install SSL module for Apache Web server
========================================

yum install mod_ssl

Disable HTTP_PROXY

  1. To prevent an attack through the HTTP_PROXY vulnerability, disable HTTP_PROXY header in apache globally
echo "RequestHeader unset Proxy early" >> /etc/httpd/conf/httpd.conf

Start And Enable Apache Web Server

  1. To start and enable Apache Web Server use the commands below
Start Apache Web Server
=======================

service httpd start

Enable Apache Web Server
========================

chkconfig httpd on

 

Applications

Install Let’s Encrypt

Installing Let’s Encrypt on the web server

  1. Ensure that the CentOS EPEL repository is installed

    yum install epel-release

  2. Install Let's Encrypt with the command below
yum install certbot python2-certbot-apache mod_ssl

To allow the installation to finish, accept the GPG key by typing y and pressing ENTER when prompted to do so