Linuxpad

Got Linux?

Private Internet Access: Gentoo Linux Setup

Private Internet Access: Gentoo Linux Setup

A VPN, or virtual private network, is an app that can greatly increase your online security, privacy, and freedom. For quite some time now, I have been using Private Internet Access as my go to vpn on all my devices. For this, I was having a field day on my Gentoo Linux; which is by far my all time distribution. I did a bit of tinkering and research to be able to finally use the PIA application on my openrc init system.

If you're on a systemd init system, chances are the PIA application will install without any hassle. For openrc users, follow this simple guide to set it up.

First navigate to the downloads page and get this version which is tested and working as at the writing of this post. Once downloaded, execute this command as:

bash pia-linux-<version>-<revision>.run -- --skip-service

Create the OpenRC Init Script:

sudo vim /etc/init.d/pia-daemon   

Paste the following content:


#!/sbin/openrc-run

name="pia-daemon"
description="Private Internet Access Daemon"

command="/opt/piavpn/bin/pia-daemon"
command_background=true
pidfile="/run/${name}.pid"
directory="/opt/piavpn"
user="pia"
group="pia"

want net
depend() {
    after firewall
    after dns
    after logger
    need localmount
    need sysfs
    need devfs
}

start_pre() {
    if [ ! -d "/run/pia-daemon" ]; then
        mkdir -p /run/pia-daemon
        chown pia:pia /run/pia-daemon
    fi
    return 0
}   

Make it executable:

sudo chmod +x /etc/init.d/pia-daemon   

Enable the Service at Boot:

sudo rc-update add pia-daemon default   

Start the Daemon:

sudo rc-service pia-daemon start   

sudo rc-service pia-daemon status   

That's it! Private Internet Access should now work natively on your Gentoo Openrc System.