Execute for each repo you wish to add by URL:
sudo zypper -n ar -f <URL or path of repo file>
This command will error (with code 4) if an identical repository has already been added to the system.
Execute for each repo you wish to add by URL:
sudo zypper -n ar -f <URL or path of repo file>
This command will error (with code 4) if an identical repository has already been added to the system.
sudo a2enmod <name of apache module>
dotnet --info | sed -n 's/^ RID: *//p'
Determine your OpenSUSE distro slug, and assign it to the 'DISTRO' variable. If you're using tumbleweed for example, you should set it to 'openSUSE_Tumbleweed'. Other possible values are 'openSUSE_Leap_15.2' or 'SLE_15_SP2', etc. I should make a small script to automatically detect this...
declare DISTRO='openSUSE_Tumbleweed'
Add the following RPM repo, where $DISTRO is the distro slug you determined above:
Install the following system packages:
Determine your OpenSUSE distro slug, and assign it to the 'DISTRO' variable. If you're using tumbleweed for example, you should set it to 'openSUSE_Tumbleweed'. Other possible values are 'openSUSE_Leap_15.2' or 'SLE_15_SP2', etc. I should make a small script to automatically detect this...
declare DISTRO='openSUSE_Tumbleweed'
Add the following RPM repo, where $DISTRO is the distro slug you determined above:
Install the following system packages:
Then, you'll probably want to start and enable apache
sudo systemctl enable --now apache2
With this method, Jellyfin will be served in any subdirectory you desire. For example, if you choose /jellyfin
then Jellyfin will be accessible at http://yourdomain.net/jellyfin
. You can even choose / if you wish. Change localhost:8096/
to the path to your Jellyfin if necessary (when it's on another server, for example).
JELLYFIN_PATH
variable.
declare JELLYFIN_PATH=/jellyfin
sudo tee "/etc/apache2/conf.d/jellyfin-web.conf" > /dev/null << EOF
ProxyPreserveHost On
RewriteEngine On
RewriteRule "^${JELLYFIN_PATH}/socket" "ws://localhost:8096/socket" [P,L]
RewriteEngine On
RewriteRule "^${JELLYFIN_PATH}$" "${JELLYFIN_PATH}/web/" [R]
RewriteRule "^${JELLYFIN_PATH}/web/$" "${JELLYFIN_PATH}/web/index.html"
RewriteRule "^${JELLYFIN_PATH}/(.*)$" "http://localhost:8096/$1" [P,L]
ProxyPassReverse "${JELLYFIN_PATH}/" "/"
EOF
systemctl reload-or-restart apache2
TODO
Have the appropiate .NET SDK installed. At the time of writing, Jellyfin requires .NET 3.1 or later.
Have the following system packages installed:
Choose the version of Jellyfin you wish to install. Either obtain the version number from the github repo, or run the following command to see a list of what's available:
curl -s https://api.github.com/repos/jellyfin/jellyfin/tags | jq -rc .[].name
Assign your choice to the "JELLYFIN_VER" variable. As of the time of writing, "v10.6.1" is a good version to choose.
declare JELLYFIN_VER=v10.6.1
Designate an account for use as the Jellyfin service account. This user may be root, but for numerous reasons that is not recommended. Let's assign the username to the "JELLYFIN_USER" variable.
declare JELLYFIN_USER=jellyfin
Make sure the account exists with the following command. TODO: convert to systemd-sysusers
sudo useradd -r "$JELLYFIN_USER" 2> /dev/null
Allocate several directories for different Jellyfin components to use. "JELLYFIN_INSTALL_DIR" is where the compiled Jellyfin binaries will be installed to. The other directories are explained more in depth on the Jellyfin docs, but the following paths should be pretty good for everything in a typical Linux installation. See the FHS Spec for the reasoning behind these if you're so inclined.
declare JELLYFIN_INSTALL_DIR=/opt/jellyfin
declare JELLYFIN_DATA_DIR=/usr/local/share/jellyfin
declare JELLYFIN_CONFIG_DIR=/etc/opt/jellyfin
declare JELLYFIN_CACHE_DIR=/var/cache/jellyfin
declare JELLYFIN_LOG_DIR=/var/log/jellyfin
declare JELLYFIN_WEB_DIR=/srv/www/jellyfin-web
Note: remembering these values is essential for modifying the build at a later time, such as when updating or installing plugins from source.
Make sure the data, config, cache, and web directories exist with the following command:
sudo install -d -m 0700 -o "$JELLYFIN_USER" \
"$JELLYFIN_DATA_DIR" "$JELLYFIN_CONFIG_DIR" \
"$JELLYFIN_CACHE_DIR" "$JELLYFIN_LOG_DIR" \
"$JELLYFIN_WEB_DIR"
Download, compile, and install Jellyfin using the following code:
time (
set -e
pushd "$(mktemp -d)" > /dev/null
trap "rm -rf \"$(pwd)\"" EXIT
git -c advice.detachedHead=false clone --depth 1 -b "$JELLYFIN_VER" \
https://github.com/jellyfin/jellyfin.git .
DOTNET_CLI_TELEMETRY_OPTOUT=1 DOTNET_NOLOGO=1 \
dotnet build Jellyfin.Server \
-p:Configuration=Release \
-p:DebugSymbols=false \
-p:DebugType=None \
-p:Deterministic=true \
-p:GenerateDocumentationFile=false \
-p:Optimize=true \
-p:OutDir="$JELLYFIN_INSTALL_DIR" \
-p:NoWarn=8767 \
-p:UseAppHost=false
cd "$JELLYFIN_INSTALL_DIR"
shopt -s extglob
sudo rm !(jellyfin.@(runtimeconfig|deps)).json
sudo chmod +x jellyfin.dll
)
Install the Jellyfin SystemD unit
sudo tee "/etc/systemd/system/jellyfin.service" > /dev/null << EOF
[Unit]
Description=Jellyfin Media Server
After=network.target
[Service]
Environment=JELLYFIN_CACHE_DIR=${JELLYFIN_CACHE_DIR}
Environment=JELLYFIN_CONFIG_DIR=${JELLYFIN_CONFIG_DIR}
Environment=JELLYFIN_DATA_DIR=${JELLYFIN_DATA_DIR}
Environment=JELLYFIN_LOG_DIR=${JELLYFIN_LOG_DIR}
Environment=JELLYFIN_WEB_DIR=${JELLYFIN_WEB_DIR}
ExecStart=${JELLYFIN_INSTALL_DIR}/jellyfin.dll --service
Group=nogroup
LockPersonality=yes
NoNewPrivileges=yes
PrivateTmp=yes
ProtectControlGroups=yes
ProtectClock=yes
#ProtectHome=no #required for key storage
ProtectKernelLogs=yes
ProtectKernelTunables=yes
Restart=on-failure
RestrictNamespaces=yes
RestrictSUIDSGID=yes
SuccessExitStatus=143
User=${JELLYFIN_USER}
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
Make Jellyfin logging more sensible. This will let SystemD take care of the logging for you.
sudo tee "$JELLYFIN_CONFIG_DIR/logging.json" > /dev/null << EOF
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo":[
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Level:u3}] {SourceContext}: {Message:lj}{NewLine}{Exception}"
}
}, {
"Name": "File"
}
],
"Enrich": ["FromLogContext"]
}
}
EOF
Download, compile, and install the Jellyfin web interface using the following code
time (
set -e
pushd "$(mktemp -d)" > /dev/null
trap "rm -rf \"$(pwd)\"" EXIT
git -c advice.detachedHead=false clone --depth 1 -b "$JELLYFIN_VER" \
https://github.com/jellyfin/jellyfin-web.git .
yarn install --pure-lockfile
sudo mv dist/* "$JELLYFIN_WEB_DIR"
sudo chown -R $JELLYFIN_USER:nogroup "$JELLYFIN_WEB_DIR"
)
Enable and start the new Jellyfin service
sudo systemctl enable --now jellyfin
Create the first administrator account. Before you can start using Jellyfin, an initial administrator account must be created. Additional user accounts may be created afterwards. Choose the desired username and password for this account, and assign them to the JELLYFIN_USERNAME
and JELLYFIN_PASSWORD
variables, respectively.
declare JELLYFIN_USERNAME='admin'
declare JELLYFIN_PASSWORD='<s00p3r s3cr1t pa55!>'
Then, run the following commands to create the account in Jellyfin and finish the installation.
curl 'http://127.1:8096/Startup/User'
curl 'http://127.1:8096/Startup/User' \
--form-string "Name=$JELLYFIN_USERNAME" \
--form-string "Password=$JELLYFIN_PASSWORD"
curl 'http://127.1:8096/Startup/Complete' -d ''
sudo tee /etc/binfmt.d/dotnet.conf <<< ':CLR:M::MZ::/usr/bin/dotnet:'
sudo systemctl reload-or-restart systemd-binfmt
sudo npm i npm
Always refresh all repos before installing new software.
sudo zypper -n in <list of package names>
Perform after adding new RPM repos and before installing new software.
sudo zypper --gpg-auto-import-keys ref