📅  最后修改于: 2023-12-03 15:15:50.681000             🧑  作者: Mango
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.
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.
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
Once the server is updated, you can proceed to install the UFW package on CentOS.
sudo yum install ufw -y
After installing UFW, you can start configuring the firewall rules for your CentOS server.
By default, UFW is disabled on the CentOS server. To enable UFW, run the following command:
sudo ufw enable
If you are accessing the CentOS server remotely via SSH, you need to allow the SSH connection on the firewall.
sudo ufw allow ssh
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
To check the status of UFW and the active firewall rules, run the following command:
sudo ufw status
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.