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.

<img alt="install emby" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/10-install.png6659f1fb68150.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="296" loading="lazy" src="data:image/svg xml,” width=”750″>

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:

<img alt="verify service" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/11-verify-emby.png6659f1fb985d4.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="169" loading="lazy" src="data:image/svg xml,” width=”750″>

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:

<img alt="check port" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/12-emby-port.png6659f1fbc8ad8.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="170" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="install nginx" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/13-install-nginx.png6659f1fc0e8f3.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="358" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="setup nginx" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/14-setup-nginx.png6659f1fc428a5.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="161" loading="lazy" src="data:image/svg xml,” width=”750″>

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:

<img alt="verify nginx" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/15-verify-nginx.png6659f1fc75a96.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="210" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="setup ufw" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/16-ufw.png6659f1fca83bb.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="275" loading="lazy" src="data:image/svg xml,” width=”561″>

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.

<img alt="select language" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/1-language.png6659f1fceb29a.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="294" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="setup user" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/2-user.png6659f1fd3f6f6.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="438" loading="lazy" src="data:image/svg xml,” width=”750″>

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.

<img alt="library" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/3-library.png6659f1fd7b689.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="241" loading="lazy" src="data:image/svg xml,” width=”750″>

Select your language for Metadata and click Next.

<img alt="metada language" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/4-metadata.png6659f1fdbe1d2.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="338" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="enable remote access" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/5-enable-remote-access.png6659f1fe09b75.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="254" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="accept term of use" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/6-term.png6659f1fe4cc0a.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="304" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="installation complete" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/7-finished.png6659f1fe88ab8.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="290" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="login emby" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/8-login.png6659f1feb35d2.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="405" loading="lazy" src="data:image/svg xml,” width=”750″>

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

<img alt="dashboard" data-ezsrc="https://kirelos.com/wp-content/uploads/2024/05/echo/7-finished.png6659f1fe88ab8.jpg" ezimgfmt="rs rscb10 src ng ngcb9" height="290" loading="lazy" src="data:image/svg xml,” width=”750″>

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.