Jun
4

Installing OpenVPN Access Server

06/04/2023 12:00 AM by Publisher in Linux


Hi there,

in this post I'll create some bash files in linux (ubuntu) for easy installation of openvpn access server.

So, all we need is a fresh or old installation of linux (I recomment ubuntu).

In the terminal we need to create the file with extension ".sh".

sudo nano openvpn.sh

or

sudo vim openvpn.sh

We gonna write into the file the following lines for Ubuntu 18(x86_64), Ubuntu 20(x86_64),Ubuntu 20(arm64), Ubuntu 22(x86_64), Ubuntu 22(arm64).

#!/bin/bash
apt update
wait
apt upgrade -y
wait
echo The update was done
wait
echo We will start to install the openvpn acces repository
apt -y install ca-certificates wget net-tools gnupg
wait
wget https://as-repository.openvpn.net/as-repo-public.asc -qO /etc/apt/trusted.gpg.d/as-repository.asc
wait
echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/as-repository.asc] http://as-repository.openvpn.net/as/debian bionic main">/etc/apt/sources.list.d/openvpn-as-repo.list
wait
apt update && apt -y install openvpn-as
wait
echo The installation finished

 

#!/bin/bash
apt update
wait
apt upgrade -y
wait
echo The update was done
wait
echo We will start to install the openvpn acces repository
apt -y install ca-certificates wget net-tools gnupg
wait
wget https://as-repository.openvpn.net/as-repo-public.asc -qO /etc/apt/trusted.gpg.d/as-repository.asc
wait
echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/as-repository.asc] http://as-repository.openvpn.net/as/debian focal main">/etc/apt/sources.list.d/openvpn-as-repo.list
wait
apt update && apt -y install openvpn-as
wait
echo The installation finished

 

#!/bin/bash
apt update
wait
apt upgrade -y
wait
echo The update was done
wait
echo We will start to install the openvpn acces repository
apt -y install ca-certificates wget net-tools gnupg
wait
wget https://as-repository.openvpn.net/as-repo-public.asc -qO /etc/apt/trusted.gpg.d/as-repository.asc
wait
echo "deb [arch=arm64 signed-by=/etc/apt/trusted.gpg.d/as-repository.asc] http://as-repository.openvpn.net/as/debian focal main">/etc/apt/sources.list.d/openvpn-as-repo.list
wait
apt update && apt -y install openvpn-as
wait
echo The installation finished

 

#!/bin/bash
apt update
wait
apt upgrade -y
wait
echo The update was done
wait
echo We will start to install the openvpn acces repository
apt -y install ca-certificates wget net-tools gnupg
wait
wget https://as-repository.openvpn.net/as-repo-public.asc -qO /etc/apt/trusted.gpg.d/as-repository.asc
wait
echo "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/as-repository.asc] http://as-repository.openvpn.net/as/debian jammy main">/etc/apt/sources.list.d/openvpn-as-repo.list
wait
apt update && apt -y install openvpn-as
wait
echo The installation finished

 

#!/bin/bash
apt update
wait
apt upgrade -y
wait
echo The update was done
wait
echo We will start to install the openvpn acces repository
apt -y install ca-certificates wget net-tools gnupg
wait
wget https://as-repository.openvpn.net/as-repo-public.asc -qO /etc/apt/trusted.gpg.d/as-repository.asc
wait
echo "deb [arch=arm64 signed-by=/etc/apt/trusted.gpg.d/as-repository.asc] http://as-repository.openvpn.net/as/debian jammy main">/etc/apt/sources.list.d/openvpn-as-repo.list
wait
apt update && apt -y install openvpn-as
wait
echo The installation finished

 

After editing the file you need to save it. Using NANO as I did in the example you need to save it with ctrl+O and exit the file wih ctrl+X. As you prefer you can also create and save it with VIM (create pressing "INSERT" on the keyboard and write the lines and save it by pressing "Esc" on the keyboard and type ":wq") .

You can also download the files (I uploaded the files on the server and you can downlod it by pressing "download file" near the name of the distributon of ubuntu) and upload it through FTP on your ubuntu or arm device machine.

 

After doing this you just need to execute the files using sudo but first we need to make the file executable for you (chmod +x) or for all users (chmod a+x).

sudo chmod a+x openvpn.sh

And in the end you need to execute it.

sudo ./openvpn.sh

That's it, you just need to wait for the script to finish and you need to pay attention because after installing openvpn-as it will tell you what link you should access and the initial password for the user (openvpn by default). If you close accidentally the session you can get this info from initial file.

You need to access using NANO or VIM

sudo cat /usr/local/openvpn_as/init.log

or

sudo nano /usr/local/openvpn_as/init.log

or

sudo vim /usr/local/openvpn_as/init.log


leave a comment
Please post your comments here.