Article directory
Preface
Linux system
download
Different download addresses can be selected from the official website
wget
deploy
Unzip
tar -zxf openvpn-version.tar.gz
cd openvpn-version
Configure openvpn
./configure
Possible problems during configuration
Some errors may occur during the execution process. Observe the last error message and handle it according to the error prompts. Most of the errors I encountered are missing dependent packages. After processing an error
each time, then re-execute the ./configure file. If an error occurs, The error can be handled similarly until. ./configure was executed successfully
libnl-genl-3-dev and pkg-config are missing
checking for tap-windows.h... no
checking whether TUNSETPERSIST is declared... yes
checking for setcon in -lselinux... no
checking for pam_start in -lpam... no
checking for PKCS11_HELPER... no
checking for LIBNL_GENL... no
configure: error: libnl-genl-3.0 package not found or too old. Is the development package and pkg-config installed? Must be version 3.4.0 or newer for DCO
At this time, it is because of the lack of dependencies, so you need to install it manually.
# 先查找,名称不一定一致
sudo apt search libnl-genl-3
The input results are as follows:
root@civildog:~/openvpn-2.6.4# apt search libnl-genl
Sorting... Done
Full Text Search... Done
libnl-genl-3-200/jammy,now 3.5.0-0.1 amd64 [installed,automatic]
library for dealing with netlink sockets - generic netlink
libnl-genl-3-dev/jammy 3.5.0-0.1 amd64
development library and headers for libnl-genl-3
libnl-idiag-3-dev/jammy 3.5.0-0.1 amd64
development library and headers for libnl-genl-3
Generally choose the one with -dev suffix, which is a development dependency library.
sudo apt install libnl-genl-3-dev
Enter the following:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libnl-3-dev
The following NEW packages will be installed:
libnl-3-dev libnl-genl-3-dev
0 upgraded, 2 newly installed, 0 to remove and 117 not upgraded.
Need to get 113 kB of archives.
After this operation, 700 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 libnl-3-dev amd64 3.5.0-0.1 [101 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy/main amd64 libnl-genl-3-dev amd64 3.5.0-0.1 [11.7 kB]
Fetched 113 kB in 2s (69.7 kB/s)
Selecting previously unselected package libnl-3-dev:amd64.
(Reading database ... 78227 files and directories currently installed.)
Preparing to unpack .../libnl-3-dev_3.5.0-0.1_amd64.deb ...
Unpacking libnl-3-dev:amd64 (3.5.0-0.1) ...
Selecting previously unselected package libnl-genl-3-dev:amd64.
Preparing to unpack .../libnl-genl-3-dev_3.5.0-0.1_amd64.deb ...
Unpacking libnl-genl-3-dev:amd64 (3.5.0-0.1) ...
Setting up libnl-3-dev:amd64 (3.5.0-0.1) ...
Setting up libnl-genl-3-dev:amd64 (3.5.0-0.1) ...
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
In addition, pay attention to other descriptions of the error message.
Here, you need to install the pkg-config library. Similar to the above, first check the relevant libraries, and then install them through the library name.
sudo apt search pkg-config
sudo apt install libpkgconf-dev
OpenSSL is not the latest library
At this time, just choose to install the latest libssl-dev library.
sudo apt install libssl-dev
Lack of suitable LZ4 compression library
This kind of error cannot be solved even if lz4 is installed. The matching lz4 library may not be found, but we can disable this configuration option.
./configure --disable-lz4
lzo is enabled but not found
Install library liblzo2-dev
sudo apt install liblzo2-dev
libpam is enabled but not found
Install library libpam0g-dev
sudo apt install libpam0g-dev
Note: If no similar library is found, upgrade and update the apt package management
At this point, basically all the errors in the checking process have been successfully resolved.
Missing make build tool
However, some machines will still report errors in the creating part after executing ./configure.
Install cmake.
sudo apt install cmake
Then execute ./configure --disable-lz4 again
compile
make
Install
make install
At this point, the entire openvpn deployment is complete. As for starting as a server or starting as a client, you can choose according to actual needs.
Deploy the server
Deploy client
Go into the sample file and find the script files that start the server and client.
cd /openvpn-version/sample/sample-config-files/
Directory structure:
Execute the following command to start:
Note that the client.conf file needs to be changed to automatic configuration. The default client.conf after installation cannot be used and cannot be started.
openvpn-startup.sh client.conf