How To Remove/Uninstall OpenVPN Server Completely From CentOS/RHEL 6/7?
Awesome Tools Linux OpenVPN Tutorials

How To Remove/Uninstall OpenVPN Server Completely From CentOS/RHEL 6/7?

Our previous article was to install open VPN server for enhancing security by deleting old or unneeded client keys files and this article is to uninstall an OpenVPN server. Well, sometimes we need to uninstall a running OpenVPN environment. This article is also helpful for those who are learning and testing OpenVPN environment because you need to clear the installation every time.

Note: If you are a SUDO user then prefix every command with sudo, like #sudo ifconfig

If you want to read more article on OpenVPN then you may follow Given below links

Part 1:  How To Install And Setup OpenVPN Server On CentOS/RHEL 7?
Part 2: How To Install And Setup OpenVPN Server On CentOS/RHEL 6?
Part 3: Setup Linux And Windows Clients To Connect With OpenVPN Server In RHEL/CentOS 6/7
Part 4: How To Add/Create A New OpenVPN Client For OpenVPN Server In CentOS/RHEL 6/7
Part 5: How To Remove Revoke OpenVPN Server’s Clients From OpenVPN Server On RHEL/CentOS 6/7
Part 7: Security Measures For OpenVPN Server and Security Hardening

Prerequisites:

A Pre-Installed and running OpenVPN Server.

Scenario:

OpenVPN Server: 192.168.1.188 – Already Running

Note: You may also figure out the IP of your OpenVPN server using the following command

Well by the end of this article we have the knowledge to uninstall OpenVPN

Let’s Start

Step 1: Figure Out The Running Port And Protocol

To initiate the process of uninstalling OpenVPN, the first thing we need to do is to figure the working port and protocol for OpenVPN because there are many conditions when OpenVPN server is running on a custom port and Protocol.

For Port:

For Protocol:

So now we have an OpenVPN server running on 1194 port and using UDP protocol.

Step 2: Remove Firewall Rules.

Now we have information about running port and protocol and with this information, we can undo the firewall changes which we did at the time of installation. So follow the instructions according to your OS

For RHEL/CentOS 7

We will use both permanent and not permanent rules to avoid a firewalld reload.

For RHEL/CentOS 6

After doing changes in our firewall you may check that that rules were deleted.

Step 3: Disable SELinux For OpenVPN

If you have SELinux running on your server then you need to free OpenVPN port and protocol. Now, to check the SELinux status use the following command.

And to verify we should use the following command

As this output shows that SELinux is working. so we need to run the following command to change SELinux context.

Step 4: Remove Packages

Now we have freed our protocol and server port from OpenVPN so we can move ahead for package and directory removal. So run below command for package removal.

And Run below command for OpenVPN directory removal

We have successfully removed our OpenVPN server.

You May Like These Also

Part 1:  How To Install And Setup OpenVPN Server On CentOS/RHEL 7?
Part 2: How To Install And Setup OpenVPN Server On CentOS/RHEL 6?
Part 3: Setup Linux And Windows Clients To Connect With OpenVPN Server In RHEL/CentOS 6/7
Part 4: How To Add/Create A New OpenVPN Client For OpenVPN Server In CentOS/RHEL 6/7
Part 5: How To Remove Revoke OpenVPN Server’s Clients From OpenVPN Server On RHEL/CentOS 6/7
Part 6How To Remove OpenVPN Server from CentOS/RHEL 6/
Part 7: Security Measures For OpenVPN Server and Security Hardening

Kapendra
Love to write technical stuff with personal experience as I am working as a Sr. Linux Admin. and every day is a learning day and Trust me being tech geek is really cool.
http://kapendra.com

Leave a Reply