Showing posts with label Linux Tutorial. Show all posts
Showing posts with label Linux Tutorial. Show all posts

Monday, January 17, 2011

How To Install OpenVPN Server on CenOS

First of all we have to check wheter TUN device enabled
[root@gilby ~]# cat /dev/net/tun
cat: /dev/net/tun: File descriptor in bad state


The reply shows that TUN device is enabled

Next we have to install needed applications. Type this command
yum install gcc rpm-build autoconf.noarch zlib-devel pam-devel openssl-devel make

After installin that packages now we have to download the Openvpn package. Type this command
wget http://openvpn.net/release/openvpn-2.0.9.tar.gz



Then Type this command
wget http://openvpn.net/release/lzo-1.08-4.rf.src.rpm

And we have to build that packages. So Type this command
rpmbuild --rebuild lzo-1.08-4.rf.src.rpm
then type this
rpm -Uvh /usr/src/redhat/RPMS/i386/lzo-*.rpm
then type this
rpmbuild -tb openvpn-2.0.9.tar.gz
And then type this
rpmbuild -tb openvpn-2.0.9.tar.gz


Now We Have OpenVPN installed on Our Server :D
What to do next is copying All configuration files into /etc/openvpn  folder. Then we must type this command
cp -r /usr/share/doc/openvpn-2.0.9/easy-rsa/ /etc/openvpn/

The Next Step is Creating Certificates
cd /etc/openvpn/easy-rsa/2.0
source ./vars
./vars
./clean-all
./build-ca



./build-key-server server
./build-dh

Then we have to copy that Certificates. So Type this command
cp /etc/openvpn/easy-rsa/2.0/keys /etc/openvpn/keys -R