Skip to content

Instantly share code, notes, and snippets.

@asasuou
Forked from lj0014/install_ocserv.sh
Created October 6, 2015 08:02
Show Gist options
  • Save asasuou/a98e1bc3689221ee0fe3 to your computer and use it in GitHub Desktop.
Save asasuou/a98e1bc3689221ee0fe3 to your computer and use it in GitHub Desktop.
install ocserv in ubuntu
#install deps
apt-get update
apt-get install -y gnutls-bin iptables libnl-route-3-200 libseccomp2 libwrap0 openssl curl --no-install-recommends
buildDeps=" \
autoconf \
autogen \
ca-certificates \
gcc \
gperf \
libgnutls28-dev \
libnl-route-3-dev \
libpam0g-dev \
libreadline-dev \
libseccomp-dev \
libwrap0-dev \
make \
pkg-config \
xz-utils \
";
apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/*
#install lz4
LZ4_VERSION=`curl "https://github.com/Cyan4973/lz4/releases/latest" | sed -n 's/^.*tag\/\(.*\)".*/\1/p'`
curl -SL "https://github.com/Cyan4973/lz4/archive/$LZ4_VERSION.tar.gz" -o lz4.tar.gz
mkdir -p /usr/src/lz4
tar -xf lz4.tar.gz -C /usr/src/lz4 --strip-components=1
rm lz4.tar.gz
cd /usr/src/lz4
make && make install
#install ocserv
OC_VERSION=`curl "http://www.infradead.org/ocserv/download.html" | sed -n 's/^.*version is <b>\(.*$\)/\1/p'`
curl ftp://ftp.infradead.org/pub/ocserv/ocserv-$OC_VERSION.tar.xz -o ocserv.tar.xz
mkdir -p /usr/src/ocserv
tar -xf ocserv.tar.xz -C /usr/src/ocserv --strip-components=1
rm ocserv.tar.xz
cd /usr/src/ocserv
sed -i '/#define MAX_CONFIG_ENTRIES /{s/96/200/}' src/vpn.h
./configure --enable-linux-namespaces
make && make install
mkdir -p /etc/ocserv
cp /usr/src/ocserv/doc/sample.config /etc/ocserv/ocserv.conf
#clean deps
cd /
rm -fr /usr/src/lz4
rm -fr /usr/src/ocserv
apt-get purge -y --auto-remove $buildDeps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment