Originally published by apeschel on July 11, 2016, 6:35 p.m.
Set up chroot build environment
Digital Ocean has a good guide for setting up a build chroot available here:
The only thing of note is that they recommend putting your chroot in your root /
directory on your base host. I suggest using /srv/schroot/
instead.
The instructions provided here are for Ubuntu trusty
, which is what we will be using to build OpenVPN.
sudo apt-get update
sudo apt-get install dchroot debootstrap
sudo mkdir -p /srv/schroot/ubuntu14.04
sudo debootstrap --variant=buildd --arch amd64 trusty /srv/schroot/ubuntu14.04/ http://us.archive.ubuntu.com/ubuntu/
proc /srv/schroot/ubuntu14.04/proc proc defaults 0 0
sysfs /srv/schroot/ubuntu14.04/sys sysfs defaults 0 0
sudo mount proc /srv/schroot/ubuntu14.04/proc -t proc
sudo mount sysfs /srv/schroot/ubuntu14.04/sys -t sysfs
sudo cp /etc/hosts /srv/schroot/ubuntu14.04/etc/hosts
sudo chroot /srv/schroot/ubuntu14.04/ /bin/bash
Set Up Build Environment
https://community.openvpn.net/openvpn/wiki/TesterDocumentation http://packaging.ubuntu.com/html/
Having a text editor in our chroot environment will reduce the number of times we have to leave and enter the chroot, thus it is installed for convenience.
apt-get install vim
Our chroot environment will have a very bare-bones sources.list
. We will need to add some entries to it.
vim /etc/apt/sources.list
Add the following text.
deb-src http://us.archive.ubuntu.com/ubuntu trusty main
deb http://us.archive.ubuntu.com/ubuntu trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu trusty universe
We need to update Ubuntu's policy-rc.d
to let it know that we are in a chroot environment.
vim /usr/sbin/policy-rc.d
Add the following to the file
#!/bin/sh
exit 101
Now we will install any additional build tools that will be required. We will use bzr
(bazzar) to build the OpenVPN package.
cd $HOME
locale-gen en_US.UTF-8
apt-get update
apt-get install net-tools autoconf libtool dialog
apt-get install bzr bzr-builddeb devscripts
Build OpenVPN
apt-get build-dep openvpn
Using Canonical Bazaar
Here we download the 14.04 OpenVPN source in a new package branch.
cd $HOME
bzr branch lp:ubuntu/trusty/openvpn
The TLS keys that are used for the OpenVPN tests in the 14.04 source have expired. This will cause the tests to fail. We can use the keys from the latest OpenVPN release instead to fix this.
apt-get install git
git clone git://git.code.sf.net/p/openvpn/openvpn-testing openvpn-openvpn-testing
cp openvpn-openvpn-testing/sample/sample-keys/* openvpn/sample/sample-keys/
Now to finally build the OpenVPN package.
cd $HOME
cd openvpn
bzr bd -- -b -us -uc
Build Raw binaries using make
This will skip the testing phase, which takes a long time with the OpenVPN package. However, it will not create a package and will require installation via make install
cd $HOME
apt-get source openvpn
cd openvpn-*
autoreconf -vi
./configure
make all
make check
Build openvpn-auth-ldap
This follows the same core process as building the OpenVPN package.
apt-get build-dep openvpn-auth-ldap
Using Canonical Bazaar
cd $HOME
bzr branch lp:ubuntu/trusty/openvpn-auth-ldap
cd openvpn-auth-ldap
bzr bd -- -b -us -uc
Using Make
cd $HOME
apt-get source openvpn-auth-ldap
cd openvpn-auth-ldap-*
./configure
make
Top comments (0)