Install APF on Plesk or CentOS

install apf
install apf

How to install APF on Plesk or CentOS

This post explains how to install APF on Plesk or CentOS. Advanced Policy Firewall (APF) is iptables based firewall system. It is commonly used in Plesk servers.

cd /usr/local/src/
tar xvzf apf-current.tar.gz
cd apf-*

You may receive the following error while installing APF. You can safely disregard this message.

Installing APF 9.7-2: eth0: error fetching interface information: Device not found


You need to edit the APF configuration file to make the basic configuration.

vim /etc/apf/conf.apf

First of all, you need to correct the interface section on the apf configuration file.


If you are using eth0, you need to add eth0 here.

Then, you need to ensure the following line and configuration value is changed as following.


This is because iptables is installed into the kernel. APF will not function properly if you haven’t set this.

Please add the custom SSH port (if you have configured) on the following setting.


You can open desired TCP port using the following field.


Then you can save the configuration and start APF.

apf -s

You will be notified that the development mode is enabled. It is a safety feature added on APF. It will flush the firewall rule every 5 minutes. i.e., if you have misconfigured the firewall and blocked from accessing your server, this feature will help you to gain access to your server after 5 minutes.

Now you have to verify the connections are working properly. Once you have checked all the connections, you need to disable the development mode.


Save the changes and restart APF.

apf -r

That’s it!

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at