×


Category: ModSecurity


Configure Firewall with FirewallD on CentOS 7

This article covers how to configure and manage the FirewallD service on your CentOS system. A Linux firewall used to protect your workstation or server from unwanted traffic. You can set up rules to either block traffic or allow through. You can add or delete or update firewall rules without restarting the firewall daemon or service. The firewall-cmd act as a frontend for the nftables. In CentOS 8 nftables replaces iptables as the default Linux network packet filtering framework. 


To Start and enable firewalld, run the commands:

$ sudo systemctl start firewalld
$ sudo systemctl enable firewalld

To Stop and disable firewalld, run the commands:

$ sudo systemctl stop firewalld
$ sudo systemctl disable firewalld

To Check the firewalld status, run the command:

$ sudo firewall-cmd --state

To Command to reload a firewalld configuration when you make change to rules, run the command:

$ sudo firewall-cmd --reload

To Get the status of the firewalld service, run the command:

$ sudo systemctl status firewalld


Install MariaDB on CentOS 7 Server - Step by Step Process ?

This article covers how to install and Secure MariaDB on a CentOS 7 server. MariaDB is a fork of MySQL managed by the original MySQL developers. It's designed as a replacement for MySQL, uses some commands that reference mysql, and is the default package on CentOS 7.


To Install MariaDB 5.5 on CentOS 7:

1. Install the MariaDB package using the yum package manager: 

$ sudo yum install mariadb-server

2. Once the installation is complete, start the MariaDB service and enable it to start on boot using the following commands: 

$ sudo systemctl start mariadb 
$ sudo systemctl enable mariadb


To install MariaDB on CentOS 8:

1. Open the terminal application. Another option is to log in using the ssh command:

 ssh user@centos-8-server-ip

2. Install the MariaDB on CentOS 8 by running the command:

$ sudo yum install mariadb-server

3. Secure the MariaDB server in CentOS 8 by running the command:

$ sudo mysql_secure_installation

4. Finally test MariaDB installation by running the command:

$ mysql -u root -p


MariaDB vs MySQL:

Even though MariaDB is a fork of MySQL, these two database management systems are still quite different: 

MariaDB is fully GPL licensed while MySQL takes a dual-license approach.

MariaDB supports a lot of different storage engines. 

In many scenarios, MariaDB offers improved performance.


Install LEMP Stack on CentOS 7 - Step by Step Process ?

This article covers how to install LEMP stack on CentOS 7. LEMP stands for the Linux operating system, with the ENginx web server (which replaces the Apache component of a LAMP stack). The site data is stored in a MySQL-based database, and dynamic content is processed by PHP.

A LEMP software stack is basically a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps.


To install Nginx on CentOS:

1. Add the CentOS 7 EPEL repository, run the following command:

$ sudo yum install epel-release

2. Now that the EPEL repository is installed on your server, install Nginx using the following yum command:

$ sudo yum install nginx

3. Once the installation is finished, start the Nginx service with:

$ sudo systemctl start nginx


Install phpMyAdmin with Nginx on CentOS 7 - Step by Step Process ?

This article covers how to install phpMyAdmin with Nginx on CentOS 7 system. phpMyAdmin helps to handle the database administration of MySQL, MariaDB and Drizzle servers over the web. It basically provides the intuitive web interface and supports most of the MySQL features to create and drop databases, create/drop/alter tables, delete/edit/add columns, execute any SQL statement and to manage indexes on columns.


To install phpMyAdmin, run the following commands:

# yum install epel-release
# yum install phpmyadmin


To restart nginx, mariadb and php-fpm services, run the following commands:

# systemctl restart mariadb.service
# systemctl restart nginx.service
# systemctl restart php-fpm.service


Install phpMyAdmin with Apache on CentOS 7 - Step by Step Process ?

This article covers how to Install phpMyAdmin with Apache on CentOS 7 system. phpMyAdmin is a database utility used for managing MySQL databases through a graphical web-based interface. It can be configured to manage a local database (on the same system), or a remote database (over a network).


To Install EPEL Repository:

1. Get access to the EPEL repository – the Extra Packages for Enterprise Linux, by running the command.

$ sudo yum install -y epel-release

2. Once that operation finishes, it's a good idea to refresh and update the EPEL repository.

$ sudo yum –y update


To Install Apache Web Server:

1. Install Apache on CentOS use the command.

$ yum install httpd -y

2. Verify the status of Apache by running with the command.

$ systemctl status httpd


To install PHPMyAdmin on CentOS, enter the command:

$ sudo yum -y install phpmyadmin


Secure Nginx with Let's Encrypt on CentOS 7 - How to do it ?

This article covers how to use the certbot Let’s Encrypt client to obtain a free SSL certificate and use it with Nginx on CentOS 7. 

Let's Encrypt is a new Certificate Authority (CA) that provides an easy way to obtain and install free TLS/SSL certificates, thereby enabling encrypted HTTPS on web servers. It simplifies the process by providing a software client, Certbot, that attempts to automate most (if not all) of the required steps. 

Currently, the entire process of obtaining and installing a certificate is fully automated on both Apache and Nginx web servers.


To Install the Certbot Let's Encrypt Client:

1. Enable access to the EPEL repository on your server by typing:

$ sudo yum install epel-release

2. Once the repository has been enabled, you can obtain the certbot-nginx package by typing:

$ sudo yum install certbot-nginx


How to Install Nginx on CentOS ?

1. To install Nginx, run the command:

$ sudo yum install nginx

2. Then, start Nginx using systemctl:

$ sudo systemctl start nginx


How to configure firewall on CentOS ?

If you have a firewall enabled, make sure port 80 and 443 are open to incoming traffic.

1. If you have a firewalld firewall running, you can open these ports by typing:

$ sudo firewall-cmd --add-service=http
$ sudo firewall-cmd --add-service=https
$ sudo firewall-cmd --runtime-to-permanent

2. If have an iptables firewall running, the commands you need to run are highly dependent on your current rule set. For a basic rule set, you can add HTTP and HTTPS access by typing:

$ sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
$ sudo iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT