How to Install MediaHut on Ubuntu Server

In this tutorial, we will guide you through the process of installing MediaHut on the latest version of Ubuntu Server. MediaHut is an open-source self-hosted media server that allows you to stream and manage your media files with ease.

Before we begin, make sure you have administrative privileges on your Ubuntu Server, and your server is up-to-date.

Step 1: Install Prerequisites

First, we need to install the prerequisites required for MediaHut to work correctly.

$ sudo apt update 
$ sudo apt install -y git curl zip unzip nginx ffmpeg redis-server 

In the above commands, we are updating the package list and installing the necessary packages like Git, CURL, NGINX, FFmpeg and Redis.

Step 2: Download MediaHut

Now that we have installed the prerequisites let's proceed with downloading MediaHut.

$ git clone https://github.com/Fortyseven/MediaHut.git

Once the download is complete, navigate into the MediaHut directory:

$ cd MediaHut 

Step 3: Install MediaHut Dependencies

Inside the MediaHut directory, you will find another directory named setup.

$ cd setup 

To install the dependencies required for MediaHut, run the following command:

$ sudo ./install_dependencies.sh

Step 4: Configure MediaHut

Now, we need to configure MediaHut by copying the config.example.yml file to config.yml.

$ cd ../ 
$ cp config.example.yml config.yml

Now, open the config.yml file in your favorite text editor and edit the variables according to your requirements.

For Example:

# General settings
host: 0.0.0.0                # Host IP address
port: 3000                   # Port number
base_path: /mediahut          # Base URL path

# Security settings
jwt_secret: my-secret-key    # JWT secret key

# Database settings
database:
  dialect: sqlite
  storage: ./db/mediahut.db  # Database file path

# Video transcoding settings
transcoding:
  enabled: true              # Enable or disable video transcoding
  cache_dir: ./cache         # Transcoding cache directory
  quality: medium            # Transcoding quality - low, medium, high

Once you have made the necessary changes, save the file and exit the text editor.

Step 5: Start MediaHut

After completing the configuration, we need to start the MediaHut service.

$ npm start

Step 6: Configure NGINX

By default, MediaHut will be accessible through http://your-server-ip-address:3000. However, we can configure NGINX to proxy requests to MediaHut and make it accessible through http://your-domain.com/mediahut.

To do this, create a new NGINX configuration file.

$ sudo nano /etc/nginx/conf.d/mediahut.conf

Add the following configurations to the file:

server {
    listen 80;
    server_name your-domain.com;

    location /mediahut {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Save the file and exit.

Reload NGINX for changes to take effect.

$ sudo systemctl reload nginx

Conclusion

You have successfully installed MediaHut on your Ubuntu server and configured it to work with NGINX. You can now access MediaHut by visiting http://your-domain.com/mediahut in your web browser.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!