Copyright infringement

How to install the Pritunl VPN server on AlmaLinux

If you are looking for a VPN server to host internally, look for the AlmaLinux/Pritunl combination. Find out how easy it is to operate this service.

funtapistock-1137608374.jpg

Getty Images / istockphoto

Pritunl is an open source VPN server that you can easily install on Linux servers to virtualize your private networks. This private VPN solution offers a well-designed web user interface for ease of administration and management. All traffic between clients and the server is encrypted and the service uses MongoDB, which means it includes support for replication.

I have walked you through the process of installing Pritunl on Ubuntu Server 20.04 and now I want to do the same with AlmaLinux 8.5. You should be able to get this VPN solution up and running within minutes.

See: Password Breach: Why Pop Culture and Passwords Don’t Mix (Free PDF) (TechRepublic)

What will you need

To successfully install Pritunl on AlmaLinux, you will need a running/updated version of the operating system and a user with sudo privileges. You will also need a domain name pointing to your hosting server (so users can access the VPN from outside your network).

How to configure the firewall

The first thing we will do is configure the AlmaLinux firewall. Let’s start by allowing both HTTP and HTTPS traffic using commands:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https

Next, we will reload the firewall with:

sudo firewall-cmd --reload

How to install MongoDB

Next, we will install the MongoDB database. Create a new repo file with:

sudo nano /etc/yum.repos.d/mongodb-org-4.4.repo

Paste the following into the new file:

[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

Note: There is a newer version of MongoDB (version 5), but I have yet to successfully get it to install on AlmaLinux. For this reason, I will be using version 4.4.

Save and close the file.

Install MongoDB using:

sudo dnf install mongodb-org -y

Start and enable MongoDB by:

sudo systemctl enable --now mongod

We see: VPN and Mobile VPN: How to Choose the Best Security Solution for Your Business (TechRepublic Premium)

How to install Pritunl Server

Next, we will install Pritunl. Create the repo file with:

sudo nano /etc/yum.repos.d/pritunl.repo

In this file, paste the following:

[pritunl]
name=Pritunl Repository
baseurl=https://repo.pritunl.com/stable/yum/centos/8/
gpgcheck=1
enabled=1

Save and close the file.

Install the EPEL repository with:

sudo dnf install epel-release -y

Import Pritunl GPG keys with:

gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 7568D9BB55FF9E5287D586017AE645C0CF8E292A
gpg --armor --export 7568D9BB55FF9E5287D586017AE645C0CF8E292A > key.tmp; sudo rpm --import key.tmp; rm -f key.tmp

Install Pritunl using the command:

sudo dnf install pritunl -y

When the installation is complete, start the service and enable it with:

sudo systemctl enable pritunl --now

How to increase the file opening limit

To prevent problems connecting to the Pritunl server when it is under higher load, we need to increase the limit for open files. To do this, issue the following commands:

sudo sh -c 'echo "* hard nofile 64000" >> /etc/security/limits.conf'
sudo sh -c 'echo "* soft nofile 64000" >> /etc/security/limits.conf'
sudo sh -c 'echo "root hard nofile 64000" >> /etc/security/limits.conf'
sudo sh -c 'echo "root soft nofile 64000" >> /etc/security/limits.conf'

How to access the Pritunl web user interface

Give the service a moment to start up and then point the web browser to https://SERVER (where SERVER is either the IP address or domain of the hosting server). You should be greeted with the Pritunl database setup window (Figure A).

Figure A

pritunlalmaaa.jpg

The Pritunl database setup window is ready to proceed.

To continue, you have to create a setup key with the command (Run on hosting server):

sudo pritunl setup-key

This will generate a random string of characters that you copy and paste into the setup key text area of ​​the Pritunl Database Setup window. After pasting the key, click Save and wait for the database to be upgraded. You will then see the Pritunl login window. Before logging in, you must retrieve the default login credentials with the command:

sudo pritunl default-password

The above command will print both your username and password for you to use to log into the Pritunl web user interface. Make sure to save these credentials. Once you have successfully logged in, you will be prompted to change the password for the admin user and complete the initial setup (Figure B).

Figure B

pritunlamlab.jpg

Complete the initial setup Pritunl

And here you are. You now have a Pritunl VPN server running on AlmaLinux 8.5. At this point, you can configure the server to meet the needs of your business and users.

see also

Subscribe to TechRepublic’s How To Make Tech Work on YouTube to get the latest tech advice for business professionals from Jack Wallen.