How to Install a Plex Media Server on Alibaba Cloud

Prerequisites

  • You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get $300 — $1200 worth in Alibaba Cloud credits for your new account. If you don’t know about how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 2GB RAM and 2 Core processor (2.4 GHz or higher).
  • A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  • Domain name must be pointed to your Alibaba Cloud ECS’s IP address
  • Access to VNC console in your Alibaba Cloud or SSH client installed in your PC
  • Set up your server’s hostname and create user with root privileges.

Setting Up Your Server

Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To execute this command, remember to login from non-root user with sudo privileges.

# sudo apt update && sudo apt upgrade

Install Plex

You must create an account on https://www.plex.tv/features/ to get downloading link for installation of Plex.

# wget https://downloads.plex.tv/plex-media-server/1.13.5.5332-21ab172de/plexmediaserver_1.13.5.5332-21ab172de_amd64.deb
# sudo dpkg -i plexmediaserver_1.13.5.5332-21ab172de_amd64.deb
# sudo systemctl enable plexmediaserver.service
# sudo systemctl start plexmediaserver.service

Set Up Plex

Now you will need to create SSH tunnel to your Alibaba Cloud ECS. To do so, open terminal from your Linux installed laptop and execute the following command to connect to your server.

# ssh your_username@alibaba_cloud_ecs_ip_address -L 8888:localhost:32400

Set Up Firewalls and Ports

If you have activated firewalls, you will have to define a rule in Alibaba Cloud security group for your cloud server to add exception for port 80/tcp and 443/tcp. You can enable these ports while creating ECS instance, but in case if you have forgotten to unblock these ports, you can follow the procedure in this guide: https://www.alibabacloud.com/help/doc-detail/25471.htm

Install Nginx

To install Nginx server, execute the command below.

# sudo apt-get install -y nginx
# sudo systemctl start nginx
# sudo systemctl enable nginx

Install Node.js:

To install Node.js, execute the command below.

# sudo apt-get install nodejs

Set Up Reverse Proxy

In this step, you will setup reverse proxy to access Plex so that you can access it via domain name without using any port in the end of address. To do so, execute the following command to create an nginx configuration file using nano editor.

# sudo nano /etc/nginx/conf.d/Plex.conf
server {
listen 80;
listen [::]:80;
server_name softpedia.xyz; location / {
proxy_pass http://localhost:32400/;
}
}
# sudo systemctl restart nginx
# cd ~
# mkdir -p plex-media/movies && mkdir plex-media/television

Install software-properties-common

Software-properties-common package is required to get the supported files for installation of SSL. In order to install software-properties-common package, follow the steps below.

# sudo apt-get install software-properties-common -y

Install SSL Certificate

To install SSL certificate using Let’s Encrypt, you will use Certbot. To do so, execute the following steps.

# sudo apt-get update
# sudo apt-get install software-properties-common
# sudo add-apt-repository ppa:certbot/certbot
# sudo apt-get update
# sudo apt-get install python-certbot-nginx
# sudo certbot --nginx -d softpedia.xyz
# sudo systemctl restart nginx

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com