Archive:Install Kodi on Fedora 26 using RPMFusion packages

From Official Kodi Wiki
Revision as of 17:47, 9 January 2015 by Wirerydr (talk | contribs) (Replaced manual steps to enable rpmfusion-free-updates-testing repo with much simpler 1-liner)
Jump to navigation Jump to search
Home icon grey.png   ▶ Installing ▶ Linux ▶ Install Kodi on Fedora 26 using RPMFusion packages

This page presents an approach to turning a minimal installation of Fedora 21 into a standalone Kodi installation, with minimal additional software / overhead. The Kodi packages available from RPMFusion are used as the basis for this setup. At the end of this guide you will have a set-top box style of system that, when powered up, will quickly boot and then start Kodi automatically without intervention (e.g. no need to first log in).

Current State of This Guide

This guide is ready for general use, and has been tested on the following hardware/software:

OS Fedora 21 Server (x86_64)
Kodi Kodi v14.0 (testing) from the rpmfusion-free-updates-testing repository
Motherboard Gigabyte GA-F2A88XM-D3H (rev 3.0)
CPU AMD A6-5400K dual-core 3.8GHz 65W
Memory Corsair Vengeance 8GB (2x4GB) DDR3 1600MHz PC12800
Graphics Asus ENGT240 Silent GT240 fanless PCI-E 2.0 card
Disk Western Digital 1TB 7200RPM Black HDD
Case Antec Fusion Remote Black HTPC Case
Receiver Denon AVR-3808ci
TV Panasonic 50" VIERA TH-50PZ800U Plasma

At the time of writing, Kodi v14 is only available in the rpmfusion-free-updates-testing repository on RPMFusion. This guide currently installs that testing version of Kodi. When RPMFusion makes a non-testing version available, this guide will be updated accordingly.

Assumptions

  1. This guide assumes you have at least a slight familiarity with Linux in general. If you know what a Bash shell is, can cut-and-paste commands, and are comfortable editing files with VI or Emacs, then you should be fine.
  2. It is assumed that Kodi will be installed into a freshly-installed Fedora 21 Server (x86_64) environment that was set up with no additional software specified. If you already have such an environment then you can skip the steps showing how to do a fresh-install of Fedora.
  3. This guide was written with the use of an Nvidia-based graphics card in-mind, (tested tested with an Asus ENGT240 Silent GT240 fanless PCI-E 2.0 card). If you have an AMD, Intel or other graphics solution, then either skip the Nvidia-specific steps or substitute your own. Also, this guide covers replacing the stock Nouveau (open-source) video drivers with proprietary Nvidia drivers (as obtained from Negativo17's Nvidia repository) for improved performance. You can skip this if you'd prefer, although your performance mileage may vary.
  4. It is assumed that audio will be passed via the HDMI port on your video card / motherboard to your TV / sound-system. Kodi can certainly handle other methods of passing audio, however those are beyond the scope of this article.
  5. Everything is done with the goal of minimizing how many software packages / dependencies are required. For example, since Kodi will be run as a fullcreen application, there is no need for heavyweight desktop environments such as Gnome and KDE, and all the apps/clutter they introduce.
  6. In order to make things simpler, this guide disables both SELinux and the local firewalld daemon. Ensure that the system is adequately protected by things like your internet router's firewall, and encrypted/passworded WiFi (you DO have your WiFi protected, right?...)
  7. As of release 21, Fedora comes in three flavours: Workstation, Server, and Cloud. This guide installs the Server edition (with no additional software specified) in order to get the leanest, most minimal install possible. At the time of writing, when tested this installation consumed approximately 410MB of memory (excluding buffers / cache) when playing a 1080p 5.1-channel video. The full installation including Fedora, Kodi and a modest library of thumbnails/artwork consumed about 9GB of disk space. For the purposes of testing, a 20GB partition was used.


Installing Fedora 21

Obtaining the Fedora 21 Server (x86_64) Installation Image

Choose a Fedora mirror ( listed at https://mirrors.fedoraproject.org/publiclist/Fedora/21/x86_64/ ). Click the http link for that mirror (or FTP / rsync if preferred), and navigate through the folders as follows:

releases -> 21 -> Server -> x86_64 -> iso

Therein you should find a file named Fedora-Server-DVD-x86_64-21.iso. Note that not all mirrors have exactly the same folder structure. Just keep exploring until you find this iso image. When you do, download it and burn it to a DVD. It's also possible to create an installable USB flash drive with this ISO and install from it, or even to perform a network install without having any local DVD media, but these are outside the scope of this guide.

Configure How Fedora will be Installed

Boot from the DVD you just created. If necessary, bring up your BIOS's boot-menu by pressing <F12> (or whatever your BIOS uses) to select booting from your optical drive. When the DVD boots you will be shown a text-menu with several options. Select "Install", and proceed. The system will then boot up into Fedora's graphical installer (Anaconda). Choose your desired keyboard layout and language, and proceed. You will then be shown Anaconda's main installation screen, similar to this:

Fedora Installation Main Installation Screen


You can make whatever choices you like for everything in the LOCALIZATION and SYSTEM sections.

Ensure INSTALLATION SOURCE is set to Local Media. If not then click on it to change.

Click on SOFTWARE SELECTION and and ensure that NONE of the add-ons in the right-hand pane are selected. This screen should look as follows:

Fedora Installation Software Selection Screen


Starting the Installation and Creating a Kodi User

When finished setting up all desired installation options, Begin the install - installation should look as follows:

Fedora Installation In-Progress


During installation, set the password for user root by clicking ROOT PASSWORD). You should also create the non-privileged user that Kodi will run as - click USER CREATION. You can choose whatever full-name / username / password you'd like; this guide assumes a username of 'kodi'. When creating this account, check Make this user administrator. (Note: This user isn't granted superuser rights directly; rather it can run privileged commands via tools such as sudo.) The User Creation screen should looks as follows:

Fedora User-Creation Screen


Rebooting into Fedora

When the installation has completed, remove the installation DVD and click REBOOT to restart the system. The system should reboot and reach a textmode console login screen, as shown below. If you reach this point then you've successfully finished a minimal install of Fedora 21.

Fedora Console Login


Configuring Fedora / Installing Dependencies

Now that Fedora is installed, some configuration needs to be performed, and some dependencies need to be installed and configured.

IMPORTANT: Unless otherwise mentioned, all following commands should be run as user kodi. Elevated privileges will be obtained via sudo if required.


Installing several YUM helpers, Updating Packages To Latest Versions, and Rebooting

There are several helper apps that will make updating your system via YUM a little faster:

  • fastestmirror - Chooses the fastest repository from a mirror-list.
  • deltarpm - Speeds downloads by only downloading changes between old and new RPM versions.
  • priorities - Give priorities to packages from different repositories.

The following command will install them if not already installed:

sudo yum install yum-plugin-fastestmirror deltarpm yum-plugin-priorities

Then perform a full update of all installed packages (including the kernel if necessary).

sudo yum update

When you're ready, reboot the system after these steps have completed for changes to take effect (especially any Kernel updates that may have happened).

sudo systemctl reboot


Disabling SELinux and Firewalld

SELinux is a part of the kernel that enforces access control over many parts of the system, including filesystems, processes, sockets, etc. Although Kodi can be made to operate with SELinux active, this is beyond the scope of this guide.

Firewalld is the local firewall daemon that is included by-default with recent Fedora releases. Because it can interfere with things such as uPnP, file-sharing, remote-control apps, etc., firewalld is disabled in this guide.

WARNING: If your system is in any way exposed to the internet or other untrusted zones, then it is recommended to ensure those zones are adequately protected by their own firewalls before disabling the system's local firewalld.


Terminate firewalld if it is running, and then remove it from the system permanently. This will also trigger removal of some server-related packages such as fedora-release-server and rolekit, which are not necessary to the operation of Kodi.

sudo systemctl stop firewalld
sudo yum remove firewalld firewalld-config-server

Next, reconfigure SELinux to change its policy from enforcing to disabled.

sudo sed --in-place=.bak 's/^SELINUX\=enforcing/SELINUX\=disabled/g' /etc/selinux/config

You will need to reboot afterwards for this change to take effect.

sudo systemctl reboot


Enable Use Of the RPMFusion Repository

RPMFusion is a 3rd-party repository that provides legally redistributable software which, for one reason or another, is not included in Fedora distributions. This includes Kodi. The following commands will install both the free and non-free RPMFusion repos for release 21 of Fedora.

sudo yum localinstall --nogpgcheck \
  http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-21.noarch.rpm \
  http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-21.noarch.rpm


IMPORTANT: Since Kodi is currently only available from RPMFusion's free-updates-testing repo, that repo must be enabled.
sudo yum-config-manager --enable rpmfusion-free-updates-testing

Once RPMFusion has released a non-testing version of Kodi, the testing repo can be disabled by running the same command shown above but with --disable instead of --enable.

Install Basic X-Windows Support

Kodi requires a functioning X-Windows server to be present on the system it runs on. However, since it typically runs in fullscreen mode without any X-Windows decorations, it does not require any display managers or desktop environments such as Gnome or KDE. The following commands install a basic X-Windows setup. It also unavoidably installs (for dependency reasons) some basic display managers, however none of these will actually be used by Kodi.

NOTE: This will not cause your system to actually boot up into multi-user graphical mode (X-Windows) automatically. That will be done when the system starts up Kodi as a standalone application.
sudo yum groupinstall "Basic Desktop"

Strangely, this also re-installs Firewalld that was removed earlier in this guide, so it is once again removed here. (If you try to streamline things by skipping the earlier step of uninstalling Firewalld, then this attempt to install basic X-Windows will fail due to a conflict with the earlier removed fedora-release-server package. Strange, but true.)

sudo yum remove firewalld firewalld-config-server


Replace Open-Source Nouveau Video Drivers with Proprietary Nvidia Drivers

Although the open-source Nouveau video drivers that are included in Fedora distributions have come a long way recently, the binary drivers from Nvidia are still superior. There are a variety of places to obtain these drivers, including RPMFusion, however this guide shows how to install them from the Negativo17 Nvidia repository.

Note: Depending on what generation your Nvidia card/chipset is, you may need to use the 340 series of driver. After the 340 series Nvidia dropped support for many older cards/chipsets. Refer to information Nvidia has provided here to see if you need to stick with 340 series drivers, or if you can use the latest driver release. Negativo17 provides separate repositories for each, and this guide shows how to install either.


Enabling the 340 Series Nvidia Driver Repository

IMPORTANT: Only perform this step if you want the 340 series Nvidia driver (cannot mix with the latest series).
sudo wget http://negativo17.org/repos/fedora-nvidia-340.repo -O \
    /etc/yum.repos.d/fedora-nvidia-340.repo


Enabling the Latest Series Nvidia Driver Repository

IMPORTANT: Only perform this step if you want the latest series Nvidia driver (cannot mix with the 340 series).
sudo wget http://negativo17.org/repos/fedora-nvidia.repo -O \
    /etc/yum.repos.d/fedora-nvidia.repo


Installing the Selected Nvidia Driver

The following will install your selected Nvidia drivers along with VDPAU (hardware-accelerated video decoding and postprocessing) support.

sudo yum install               \
            kernel-devel       \
            libva-utils        \
            libva-vdpau-driver \
            nvidia-driver      \
            vdpauinfo


Removing the Nouveau Driver

Next, remove the open-source Nouveau driver.

sudo yum remove xorg-x11-drv-nouveau


Removing PulseAudio And Enabling Kodi Audio Within X-Windows

Removing PulseAudio

PulseAudiois a feature-filled sound-server for Posix-style operating systems such as Linux, Solaris, various BSDs, etc. More recently PulseAudio started supporting Microsoft Windows. However until very recently, PulseAudio was unsupported by XBMC (the former name of Kodi). While Kodi now has support for PulseAudio, it does not require it, especially in standalone systems such as this guide covers. See PulseAudio for details. As such this guide shows how to remove PulseAudio. The following will remove PulseAudio and several related packages:

sudo yum remove                             \
            alsa-plugins-pulseaudio         \
            pulseaudio                      \
            pulseaudio-module-x11           \
            pulseaudio-utils


Enabling Kodi Audio Within X-Windows

In order for the Kodi user-account to be able to produce audio within the X-Windows system now that PulseAudio has been removed, it must be added to the audio user-group.

sudo usermod kodi -a -G audio


Installing Kodi And Configuring It To Run Automatically

Installing Kodi from the RPMFusion repository

The following command actually installs Kodi from the RPMFusion repository. Any dependencies that Kodi requires but are not yet installed will also be included automatically.

sudo yum install kodi


Create Systemd Service File For X-Windows / Kodi

By default Fedora uses Systemd to manage services and daemons. The following creates a Systemd service file that, once enabled, will cause the system to autostart X-Windows as well as Kodi as a standalone, fullscreen application whenever the system is booted. Because it was manually created and not installed as part of any package, it gets placed in "/etc/systemd/system" instead of "/lib/systemd/systemd".

sudo cat <<"ENDcat" >/etc/systemd/system/kodi.service
[Unit]
Description = kodi-standalone using xinit
After = remote-fs.target systemd-user-sessions.service

[Service]
User = kodi
Group = kodi
PAMName = login
Type = simple
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch /usr/bin/kodi-standalone -- :0 -nolisten tcp
Restart = on-abort

[Install]
WantedBy = multi-user.target
ENDcat


Load and Enable New Systemd Service File

Now that the new Systemd service file has been created, Systemd needs to rescan its configuration to pick up the new file. Afterwards, the service is enabled for future reboots.

sudo systemctl daemon-reload
sudo systemctl enable kodi


Reconfigure PolicyKit To Enable Poweroff, Suspend and Similiar Functions

In order for Kodi to be able to poweroff the system, enter suspend-mode or initiate hibernation, a PolicyKit Local Authority configuration file needs to be created.

sudo cat <<"ENDcat" >/etc/polkit-1/localauthority/50-local.d/kodi_shutdown.pkla
[Actions for kodi user]
Identity=unix-user:kodi
Action=org.freedesktop.devicekit.power.*;org.freedesktop.upower.*;org.freedesktop.consolekit.system.*;org.freedesktop.login1.*
ResultAny=yes
ENDcat


Configure Xwrapper To Allow Non-Console Users To Start X-Server

In order for the X-Windows server to be started by a non-console user such as the Kodi account, a new Xwrapper configuration must be created. Also set the appropriate file permissions on the new configuration.

sudo cat <<"ENDcat" >/etc/X11/Xwrapper.config
allowed_users = anybody
ENDcat
sudo chmod 644 /etc/X11/Xwrapper.config


All Finished, and Last Tips

If all has gone well thus far, then the next time you restart the system it should boot all the way into Kodi (fullscreen standalone) without needing to log in first, or perform any other intervention. At this point you should be able to commence configuring your minimal Kodi install as desired. Enjoy!

  1. As previously mentioned, this method of installing Kodi avoids the need to log into the system for normal operation. However you may still reach the system remotely via SSH, whether or not Kodi is running at the time.
  2. If you have remotely accessed the system, then Kodi can be easily started / stopped with the following two commands (run as user kodi):
sudo systemctl start kodi
sudo systemctl stop kodi