Skip to content

Instantly share code, notes, and snippets.

@alexseward
Last active April 5, 2024 11:04
Show Gist options
  • Save alexseward/dfe9f71ce3d4896dd245734f6c0c1c6b to your computer and use it in GitHub Desktop.
Save alexseward/dfe9f71ce3d4896dd245734f6c0c1c6b to your computer and use it in GitHub Desktop.
Running a Plex media server on Azure

For years I was dedicated to my craft of buying records of vinyl, ripping the songs to WAV and Djing alongside my digital collection of music compiled over years from various sources. More recently, I've found myself almost entirely converted to the use of Spotify! However, some of my more obscure soundcloud downloads and vinyl rips are missing from Spotify and so an Azure based Plex server, and the Plex app on my laptop and phone are the perfect solution.

I followed the steps from this video https://youtu.be/ylklaOXz8Fc with a few tweaks along the way.

Virtual Machine

  1. Download Plex Media Server from https://www.plex.tv/media-server-downloads/. In this tutorial, I will use a Linux VM and so downloaded the Linux version of Plex.
  2. Create a resource group. Mine is called 'Plex'.
  3. Inside 'Plex' RG, create a storage account. Mine is called 'alexplex'.
  4. Once created, inside your storage account e.g. 'alexplex', click File shares (under File Service) and add a File share. Mine is called 'plex' and I set the Quota as 1024.
  5. Inside 'Plex' RG, create a virtual network. Mine is called 'plex-vnet'.
  6. Inside 'Plex' RG, create a Linux virtual machine. I used the most recent Ubuntu Server OS image available on the Azure Marketplace. I used a B1s VM and mine is called 'plex-LVM1'.
  7. Link the previously created storage to the VM.
  8. Click on Network Security Group, and add an inbound rule for 1001 port.
  9. Validate and Deploy VM. Once deployed, copy the public IP address for the VM.

PuTTy

  1. As I'm using a Linux VM, I am going to use PuTTy. Download PuTTy from https://www.ssh.com/ssh/putty/linux/
  2. Open PuTTy and paste your VM's IP address into the Host Name field.
  3. Click the plus next to SSH on the left panel, then click Tunnels.
  4. Enter 8888 into the Source port field and localhost:32400 in Destination field.
  5. Click Session on the left panel, save this PuTTy configuration, and then click Open.
  6. Enter your password to log in to the VM.
  7. Enter the following commands:
sudo mkdir /downloads
cd /downloads/
sudo wget https://downloads.plex.tv/plex-media-server-new/1.20.0.3181-0800642ec/debian/plexmediaserver_1.20.0.3181-0800642ec_amd64.deb
sudo dpkg -i plexmediaserver_1.20.0.3181-0800642ec_amd64.deb

Plex

  1. Open a browser window and type http://localhost:8888/web into the address bar.
  2. Log in with your Plex account and go through the steps to setup the Plex Server.
  3. When at the main Plex homescreen and ready to add media, return to the Azure Portal.
  4. Find your File share e.g. 'plex' and click Connect.
  5. Copy the command for Linux.
  6. Open PuTTy and run this command to mount your file share to a directory on the VM.
  7. Return to Plex, and click to Add Library. Browse for Media Folder and select the folder on your file share.

Azure Storage Explorer

  1. Open Azure Storage Explorer. You may need to install this if it is not installed on your local machine.
  2. Add your Azure account and sign in
  3. Find your File share e.g. 'plex' and start to add your media from your local machine to the File share
  4. Open Plex and see your files begin to show :)
@chriskilinc
Copy link

Great guide! How much do you pay for this per month roughly?

@alexseward
Copy link
Author

£35.99 last invoice, made up of:
£27.19 for storage
£6.58 for virtual machines
£2.10 for virtual network
£0.12 for bandwidth

Note: I have access to some Azure credits, and haven't made much attempt at optimising so there may be some reductions that can be made here

@jpenns
Copy link

jpenns commented Nov 30, 2023

Great instructions overall, I am a bit of a linux and Azure noob but was able to make my way through this.

Is there any way to have this update automatically? As soon as I installed it I realized it's out of date. Manually updating is fairly straightforward, get the download link from Plex for Ubuntu. But ideally I could just install this and leave it.

@clemone210
Copy link

which instance type did you use?

@wencesbc
Copy link

wencesbc commented Apr 5, 2024

Can you give an update on costs and ussage metrics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment