Friday, June 14, 2024
HomeHow toHow to Install Emby Media Server on Ubuntu 22.04

How to Install Emby Media Server on Ubuntu 22.04

Emby is an open-source alternative to Plex Media Server. Emby supports multiple operating systems, such as Linux, FreeBSD, Windows, and MacOS. As for clients, it supports almost every device, from smartphones to Desktop. This means that you can access your media files almost everywhere.

This guide will show you how to install Emby Media Server on an Ubuntu 22.04 server. You will run Emby with Nginx as a reverse proxy and secure Emby via SSL/TLS certificates via Letsencrypt.

Prerequisites

Before installing Emby, make sure you have prepared with the following:

  • An Ubuntu 22.04 server
  • A non-root user with administrator privileges.
  • A domain name pointed to a server IP address.

Installing Emby via DEB file

Emby is a free media server that can be installed on most operating systems, from Unix-like operating systems to Windows. For the Ubuntu system, Emby provides a DEB file that is ready for installation, and you can easily download and install it via the dpkg command.

Before downloading Eby, update and upgrade your Ubuntu packages to the latest version.

sudo apt update && sudo apt upgrade

Once complete, download the DEB file for Emby using the wget command below. Check the Emby download page to get the latest download link.

wget https://github.com/MediaBrowser/Emby.Releases/releases/download/4.8.3.0/emby-server-deb_4.8.3.0_amd64.deb

Install the Emby media server via the DEB file, then install the missing dependencies via the apt command below.

sudo dpkg -i emby-server-deb_4.8.3.0_amd64.deb
sudo apt install -f

Type Y to confirm and install missing dependencies.

After installation, start and verify the emby-server service with the following command. By default, Emby provides a service file emby-server so you can easily manage Emby via the command line.

sudo systemctl start emby-server
sudo systemctl status my-server

If Emby is running, you will see an output like the following:

The default Emby service will run on port 8096, check the open ports in your system with the command below.

ss -tulpn

You will see port 8096 is used by the EmbyServer program like the following:

Installing Nginx as a reverse proxy

After Emby is installed, let’s install Nginx and configure it as a reverse proxy for your Emby installation. So emby that running on port 8096 will be run behind Nginx on default HTTP and HTTPS ports.

Install the Nginx web server to your Ubuntu system using the command below. Type Y to confirm and accept the installation.

sudo apt install nginx

After the installation, create a new server block configuration /etc/nginx/sites-available/emby that will be used as a reverse proxy for Emby.

sudo nano /etc/nginx/sites-available/emby

Insert the following configuration and make sure to change the server_name option with your Emby domain name. you can use local or public domain.

server {
listen 80;
server_name emby.hwdomain.io; #your subdomain.domainname.com here

proxy_hide_header X-Powered-By;
add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header 'Referrer-Policy' 'no-referrer';

add_header Content-Security-Policy "frame-ancestors mydomain.com emby.mydomain.com;"; #add your domainname and all subdomains listed on your cert

location / {
proxy_pass http://127.0.0.1:8096; # Local emby ip and non SSL port

proxy_hide_header X-Powered-By;
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

#Next three lines allow websockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

Save the file and exit.

Now run the command below to activate the Emby server block by creating a symlink to the /etc/nginx/sites-enabled/ directory.

sudo ln -s /etc/nginx/sites-available/emby /etc/nginx/sites-enabled/

Check your Nginx syntax for errors with the command below. Make sure you get an output syntax is ok.

sudo nginx -t

Lastly, restart the Nginx web server using the command below. Then, verify Nginx to ensure it is running.

sudo systemctl restart nginx
sudo systemctl status nginx

When running, you will see an output active (running) like the following:

Setting up UFW firewall

In this section, you will open both HTTP and HTTPS ports via UFW to allow access to your Emby installation. On the Ubuntu system, ufw is available by default, so make sure it’s running and enabled.

Add the `Nginx Full` profile to open HTTP and HTTPS ports and allow access to your Emby installation. If successful, you will get an output Rule added.

sudo ufw allow 'Nginx Full'

Now verify the list-enabled rules on UFW using the command below. You will see the ‘Nginx Full‘ rule is enabled.

sudo ufw status

Securing Emby with SSL/TLS certificates

In this guide, you will secure Emby with SSL/TLS certificates via Certbot and Letsencrypt. So now you will install Certbot and generate SSL/TLS certificates utilizing the certbot command.

First, run the command below to install the Certbot and Certbot Nginx plugin to your Ubuntu system. Input y to confirm the installation.

sudo apt install certbot python3-certbot-nginx

After installation is complete, run the certbot command below to generate an SSL/TLS certificate for your Emby installation. Make sure to change the details of the domain name and email address with your information.

sudo certbot certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d emby.hwdomain.io

Once finished, your SSL/TLS certificates should be available at the /etc/letsencrypt/live/domain.com directory and your Emby installation should be secured with HTTPS.

Emby installation

Open your web browser and visit the domain name of your Emby installation, such as https://emby.hwdomain.io/. If your installation is successful, you should get a message such as ‘Welcome to Emby‘.

Select your preferred language for Emby and click Next.

Now create a new user for your Emby installation and input the detailed user and password. Click Next to confirm.

Once the admin user is created, you will be asked to create a new Library for Emby. You can configure the Libray later, so click Next again to continue.

Select your language for Metadata and click Next.

Check the option ‘Enable automatic port mapping’ and click Next.

For the term of use, select the option ‘I accept the terms of use‘ and click Next Confirm.

Once the installation is finished, you will see the message `You’re Done!`. Click Finish to complete the installation.

Now, you will be redirected to the Emby login page, enter your admin user and password, and click Sign In.

After logging in, you will see Emby dashboard like the following:

Conclusion

Congratulations! You have installed the Emby media server on Ubuntu 22.04 server. Emby is now running with the Nginx as a reverse proxy and secured with SSL/TLS certificates from Letsencrypt. You can now start uploading your Media files to access from any device.


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here


Most Popular