Install Kodi on Fedora Linux

Kodi Fedora Linux logo

Kodi is an open-source and multi-platform media center application. It can be installed like any other Desktop app or alternatively if a desktop environment is not desired it can also run as a standalone application.

 

Enable RPMFusion repository.

sudo dnf install --nogpgcheck https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

 

Get current SELinux mode.

getenforce

Output can be Enforcing or Permissive. Enforcing means SELinux is active and will deny access based on the policy rules. Permissive mode means SELinux is not enforcing the rules but still logs denials as if it was in Enforcing mode.

 

Set SELinux mode to permissive.

setenforce 0

Permissive mode is set with 0 while Enforcing mode is set with 1.

 

Install Kodi

Install from RPMFusion repository.

sudo dnf install kodi

This is all that’s required for a Desktop installation. The next section is required for Standalone Kodi installation only.

 

Install X-Windows dependencies from official repository.

sudo dnf groupinstall "base-x"

 

Create a system account and group of the same name that Kodi will run under.

sudo useradd -r -s /usr/bin/nologin kodi

 

Add user to supplementary groups.

sudo usermod kodi -a -G video

Adding Kodi user to video system group allows video acceleration.

 

Create a home directory.

sudo mkdir -p /var/lib/kodi/.kodi

 

Set ownership of the installation and home directories.

sudo chown -R kodi:kodi /usr/share/kodi /var/lib/kodi

 

Change permissions of the installation and home directories.

sudo chmod -R 700 /usr/share/kodi /var/lib/kodi

 

Create systemd service.

sudo bash -c 'cat > /etc/systemd/system/kodi.service << EOF

[Unit]
Description=Starts instance of Kodi using xinit
After=systemd-user-sessions.service network-online.target sound.target mysqld.service
Requires=network-online.target
Conflicts=getty@tty1.service

[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -nolisten tcp vt1
Restart=on-abort
StandardInput=tty

[Install]
WantedBy=multi-user.target

EOF'

 

Configure FirewallD

Create firewalld rule.

sudo bash -c 'cat > /usr/lib/firewalld/services/kodi.xml << EOF
<?xml version="1.0" encoding="utf-8"?>
  <service>
  <short>Kodi</short>
  <description>Kodi Remote Control Service</description>
  <port protocol="tcp" port="8080"/>
</service>
EOF'

The rule will allow  Remote Control features to work over port 8080.

 

Reload the configuration for the new service to be detected immedietely.

sudo firewall-cmd --reload

 

Add the rule permanently.

sudo firewall-cmd --permanent --add-service=kodi

 

Reload the configuration for the changes to apply immedietely.

sudo firewall-cmd --reload

 

Configure Kodi

Audio with Kodi can work with just Alsa audio configured but there are some advanced configurations possible with PulseAudio in the mix.

 

Multi-room setups can benefit greatly from configuring a Shared Kodi Database instead of the default local database. Optionally optimize Kodi Cache Settings for streaming video.

 

Fix Kodi Union Filesystem library scan issue

By default Kodi library updates ignore directories with unchanged date modified attribute. This can greatly increase the scan speed but can cause issues with certain file systems. When using a union file system such as MHDDFS or Mergerfs the mdate can be inconsistent causing Kodi to ignore new media. This can be disabled from advanced settings configuration file.

 

Open the settings file of the standalone installation.

sudo nano /var/lib/kodi/.kodi/userdata/advancedsettings.xml

Standard Desktop instalation settings file is located in ~/.kodi/userdata/advancedsettings.xml.

 

Copy the settings and save the file.

<advancedsettings>
  <videolibrary>
    <usefasthash>false</usefasthash>
  </videolibrary>
</advancedsettings>

Disabling fast hash will force Kodi to scan all directories regardless of the date modified attribute.

 

Run Kodi

Start the service with systemd.

sudo systemctl start kodi

 

Enable the service to run on boot with systemd.

sudo systemctl enable kodi

 

Migrate Kodi Configuration & Settings

Copy user configuration directory to the new kodi-standalone-service location.

cp -r /home/kodi/.kodi /var/lib/kodi/.kodi

 

After the transfer completed successfully remove the old user configuration directory.

sudo rm -Rd /home/kodi

 

Set the ownership on the new user directory.

sudo chown -R kodi:kodi /var/lib/kodi