Friday, October 3, 2014

Installing openvpn 2.3 on CentOS 7

Those of you who run CentOS probably know that the openvpn server package isn't available in the base distribution, nor in the CentOS Plus repositories.  When you peruse the website, they recommend using RepoForge builds (the old DAG repos).  The problem with that is that the repository for CentOS 7 doesn't yet have an openvpn server rpm.  What to do?

It turns out that it's comically simple to build your own RPM, so that's what I'm going to show you.  The instructions come mostly from the openvpn installation documentation.


Go get the latest source tarball from the openvpn downloads page.  At the time of this blog post (Oct 2014), the current version is 2.3.4, so I just used wget to pull it down
 Before I try to build that source code into an RPM, I need to make sure the dependencies are installed and available.  So I used yum to install them:
sudo yum install openssl-devel lzo-devel pam-devel
 Then I follow the instructions for building an RPM (note that the output of this next command creates an rpmbuild folder, so be mindful about where you run this command):
rpmbuild -tb openvpn-2.3.4.tar.gz
After some checking and compilation, there's an rpm in rpmbuild/RPMS/x86_64, and you can install it right from there:
sudo rpm -ivh rpmbuild/RPMS/x86_64/openvpn-2.3.4-1.x86_64.rpm
And now you have an openvpn server installed as a daemon!