📜  install ufw centos - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:15:50.681000             🧑  作者: Mango

Install UFW on CentOS

If you are looking for a simple way to manage your firewall rules on your CentOS server, UFW could be one of the best choices for you. UFW (Uncomplicated Firewall) is a frontend tool to manage iptables firewall rules. In this guide, we will show you how to install UFW on CentOS.

Prerequisites

Before starting this tutorial, you need to have a server running CentOS. You will also need a user account with sudo privileges to perform the installation and configuration.

Step 1: Update the System

Before installing any new software on the server, it is essential to update the system's packages to the latest version.

sudo yum update -y
Step 2: Install UFW

Once the server is updated, you can proceed to install the UFW package on CentOS.

sudo yum install ufw -y
Step 3: Configure UFW

After installing UFW, you can start configuring the firewall rules for your CentOS server.

Enable UFW

By default, UFW is disabled on the CentOS server. To enable UFW, run the following command:

sudo ufw enable
Allow SSH Connection

If you are accessing the CentOS server remotely via SSH, you need to allow the SSH connection on the firewall.

sudo ufw allow ssh
Allow HTTP and HTTPS

If you are running a website or web application on the CentOS server, you need to allow the HTTP and HTTPS traffic on the firewall.

sudo ufw allow http
sudo ufw allow https
Check the Status of UFW

To check the status of UFW and the active firewall rules, run the following command:

sudo ufw status
Conclusion

In this tutorial, you have learned how to install UFW on CentOS and how to configure the firewall rules for your server. UFW is a simple and straightforward tool to manage iptables firewall rules, and it can help you secure your CentOS server easily.