My choice of Hypervisor is Proxmox, this is mostly for me to follow instructions for when I inevitably have to do it again. I am currently using a tiny PC as a server, this will be used as a media server and a DNS server.
Installing Proxmox and Resizing Volume
- Download ISO from https://www.proxmox.com/en/downloads
- Burn to USB using Rufus
- Plug USB in, spam whatever key to get to your Bios (Delete, F12)
- Install onto PC, do this through the bios and boot from USB
- Go through the setup, recommend having a network cable plugged in and setting your router to give it a static IP
- We’re done with the box, we can do everything else through a web panel (Default port :8006)
- Increase Storage
- Delete LVM Volume
- Expand Storage in shell
lvremove /dev/pve/data
lvresize -l +100%FREE /dev/pve/root
resize2fs /dev/mapper/pve-root
- Edit Storage to allow Content (Disk Image etc.)
- Download desired Operating System (Ubuntu Server in my case)
- Upload ISO to Proxmox Server
- Create VM (Name, storage etc.)
- Launch VM -> Console and Go through setup process
- Create SSH keypair if you want to use another terminal
Setting up UFW
Installing a firewall is a good idea. I’m using Ubuntu server which already has it installed but not enabled.
sudo apt install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
Installing VPN
I like to install a VPN that auto launches at setup, the configuration file will change based on your VPN provider, I followed a guide located here:
sudo apt-get update
sudo apt-get install openvpn unzip -y
cd /etc/openvpn
sudo wget --no-check-certificate https://www.privateinternetaccess.com/openvpn/openvpn.zip
sudo unzip openvpn.zip
sudo nano /etc/openvpn/login.txt
Ctrl + X and save
sudo chmod 700 /etc/openvpn/login.txt
cd /etc/openvpn
sudo openvpn --config /etc/openvpn/uk_london.ovpn --auth-user-pass /etc/openvpn/login.txt
Open new SSH and see if working, check with curl ipinfo.io/ip. Now we create the service to autostart on boot:
sudo nano /etc/init.d/openvpnauto
Paste script from above link
sudo chmod +x /etc/init.d/openvpnauto
sudo update-rc.d openvpnauto defaults 98
sudo service openvpnauto start
Installing Plex
Firstly we’ll have to add the plex repo to our package manager.
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
sudo apt update
sudo apt install plexmediaserver
Access web panel at http://<IP_ADDRESS>:32400/web and continue through the setup
Update permissions on desired directories sudo chown -R plex:plex /path/to/media/directory
Add USB Passthrough
I use a USB Hard Drive for my media so I need my server to be able to see it. First start by getting the UUID of Hard Drive. It’s important to note that my Hard Drive had already been setup.
lsblk
mkdir -p /mnt/media
nano /etc/fstab
Add /dev/sdb1 /mnt/media ext4 defaults 0 0 Save CTRL+X
mount -a
- Navigate to datacenter
- Storage > Add directory, Name: Media Directory: /mnt/media
- qm rescan
- Go to Hardware under your vm and you should see Unused Disk
Setting up Samba Share
sudo apt install samba
sudo nano /etc/samba/smb.conf
[sambashare]
comment = Samba on Ubuntu
path = /home/username/sambashare
read only = no
browsable = yes
sudo service smbd restart
sudo ufw allow samba
sudo smbpasswd -a username
\\ip-address\sambashare
Installing Torrent Client with Web Panel
We need somewhere to seed our Linux distributions 🙂
sudo apt install deluged deluge-web
sudo adduser --system --group deluge
sudo nano /etc/systemd/system/deluged.service
[Unit]
Description=Deluge Bittorrent Client Daemon
After=network-online.target
[Service]
Type=simple
User=deluge
Group=deluge
UMask=027
ExecStartPre=/bin/sleep 30
ExecStart=/usr/bin/deluged -d
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl enable deluged
sudo systemctl start deluged
sudo nano /etc/systemd/system/deluge-web.service
[Unit]
Description=Deluge Bittorrent Client Web Interface
After=network-online.target
[Service]
Type=simple
User=deluge
Group=deluge
UMask=027
ExecStartPre=/bin/sleep 30
ExecStart=/usr/bin/deluge-web
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl enable deluge-web
sudo systemctl start deluge-web
sudo ufw allow 8112
http://your-server-ip:8112
Microcode
My specific CPU has a microcode bug which needs updating otherwise the VMs will hang. This is to be done on the host NOT the vms
nano /etc/apt/sources.list
add non-free-firm to sources
apt update
apt install intel-microcode
reboot
#Check if microcode has updates
cat /proc/cpuinfo | grep microcode