Desktop Virtualization

Running Pritunl Cloud in a desktop environment

Pritunl Cloud can run on a desktop environment to run virtual machines with full GPU acceleration. This will work on either Fedora or Ubuntu.

sudo yum -y install qemu qemu-kvm qemu-img qemu-system-x86 edk2-ovmf genisoimage

sudo tee /etc/yum.repos.d/pritunl.repo << EOF
name=Pritunl Repository

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

sudo yum -y install pritunl-cloud

For Ubuntu install the packages below.

sudo apt install ovmf qemu qemu-efi qemu-kvm qemu-system-x86 qemu-utils genisoimage

sudo tee /etc/apt/sources.list.d/pritunl.list << EOF
deb jammy main

sudo apt-key adv --keyserver hkp:// --recv 7568D9BB55FF9E5287D586017AE645C0CF8E292A
sudo apt update
sudo apt install pritunl-cloud

On Fedora SELinux will need to be disabled.

sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux
sudo setenforce 0

For a local only desktop configuration the external networks can be disabled and a host only network can be used. First create a host network block from the Blocks tab then enable host network NAT. If a firewall is configured the firewall will need to either configure the NAT or allow the NAT configured by Pritunl Cloud.

The internal interface will need to be set but it will not be utilized for a single node configuration.


MongoDB Configuration

When running MongoDB on a desktop the cache can be limited to reduce the memory usage by the database. The MongoDB server should also be bound to a UNIX socket to prevent any network access. The configuration file below will run a lightweight MongoDB server that will only consume around 150MB of memory.

First create the /var/run/mongodb directory if it doesn't already exist.

sudo mkdir -p /var/run/mongodb
sudo chown mongod:mongod /var/run/mongodb

Next edit the /etc/mongod.conf configuration file and replace the storage and net sections with the ones below. Remove any existing options for these sections but leave other sections unmodified.

  dbPath: /var/lib/mongo
    enabled: true
      cacheSizeGB: 0.25

  bindIp: /var/run/mongodb/mongod.sock
  ipv6: false
  maxIncomingConnections: 50
    enabled: false

Update the mongo_uri in /etc/pritunl-cloud.json to connect to the database using the UNIX socket. Then run sudo systemctl start pritunl-cloud.


MongoDB Fedora Fix

Currently MongoDB will not install on Fedora due to the missing file /usr/libexec/platform-python. If this error occurs it can be fixed by creating an RPM with the file linked to /usr/bin/python3. First create the rpmbuild directory then add the spec file below and build then install the rpm.

sudo yum -y install rpm-build rpm-sign createrepo wget nano git

mkdir -p ~/rpmbuild/SPECS/

nano ~/rpmbuild/SPECS/python-fix.spec

cd ~/rpmbuild/SPECS/
rpmbuild -ba python-fix.spec

sudo yum install ~/rpmbuild/RPMS/noarch/python-fix-1.0.0-1.el8.x86_64.rpm
Name: python-fix
Summary: Python Fix
Version: 1.0.0
Release: 1%{?dist}
License: MIT

Python platform fix


mkdir -p $RPM_BUILD_ROOT/usr/libexec
ln -s /usr/bin/python3 $RPM_BUILD_ROOT/usr/libexec/platform-python