How to Install Kodi on Raspbian
Are you interested in turning your Raspberry Pi into a media centre, but you also require it for a variety of other tasks? Perhaps you’re using your Raspberry Pi to write or to play Minecraft on your computer. It may serve as a general project machine, which would need constant access to Raspbian.
One solution to this could be to keep numerous microSD cards at hand, each with various operating systems loaded. You may have one with Raspbian ready to go, another with a vintage gaming distribution, and a third with OSMC, openELEC, or LibreELEC. These are the three Kodi-based Raspberry Pi distributions and the most prevalent solutions. It’s straightforward to write one of these to a microSD card to set up your Raspberry Pi-based Kodi system.
But if you only have a single microSD card, wouldn’t it be far simpler to just install Kodi on Raspbian? Here’s how!
Make Sure You’re Using Raspbian Stretch
Before proceeding, you’ll need to make sure your Raspberry Pi is running the latest version of Raspbian, Stretch. You can check if you’re using Raspbian Stretch by opening a terminal window and entering:
The resulting text (see the screenshot) will show you which Linux operating system and version you’re using.
If you’re on an older version, you can download Raspbian Stretch from the Raspberry Pi website and flash it to your microSD card. This is the recommended option, although it is possible to upgrade manually from within Raspbian Jessie. However, you may run into problems doing it this way, and it’s always good to start with a fresh install.
If flashing doesn’t suit you, try installing Raspbian using the NOOBS installer tool.
If you have data on your Raspberry Pi that you’ll need in Raspbian later on, make sure you back it up first.
Also, make sure you’re using a Raspberry Pi 2 or later. The Raspberry Pi 3 and the Pi Zero, are both suitable; sadly, the original Raspberry Pi Model B is too slow to reliably run Kodi.
Configuring Your Raspberry Pi for Kodi
Before you install Kodi, you’ll need to ensure your Pi is set up correctly. Three things need to be changed:
- Expanding file system (this should happen automatically when booting Stretch for the first time)
- Altering memory split
- Enabling video codecs
Additionally, you’ll need to ensure Broadcom desktop drivers are set.
All three of these things can be done using raspi-config. You can access this on the desktop via Preferences > Raspberry Pi Configuration, or in the command line:
Expanding the Filesystem
If you haven’t already expanded the filesystem, and it didn’t happen automatically when you booted (which gives your Pi more space to run the software), you should do so now.
This will improve the overall performance of your Kodi box, as there will be more space on the MicroSD card for installing add-ons and caching data.
To take full advantage of your microSD card’s capacity, open raspi-config and select the first option, Expand Filesystem. Select OK to confirm your choice, and follow the instructions to restart your Raspberry Pi.
Altering Memory Split
Next, you’ll need to change the memory split. Kodi on the Raspberry Pi 2 or Raspberry Pi 3 requires 256MB dedicated to the GPU to run correctly.
Again, run raspi-config, then go to Advanced Options > Memory Split and set the split to 256MB.
Enabling Video Codecs
Finally, you need to enable certain video codecs that don’t run as standard. These include VP6, VP8, MJPEG, and Theora, among others. To do this, you need to enable the camera. While no camera needs to be connected, enabling this feature will ensure the codecs can be used.
Do this via Interfacing Options > Camera > Yes. Confirm with OK. Note that you can also affect this change via the config.txt file. Found in the /boot/ directory on your Raspberry Pi’s microSD card, this is the only directory that can be read in Windows.
To do it this way, open config.txt on your desktop computer and add:
Save the file, exit, and safely eject your microSD card before replacing in the Raspberry Pi and rebooting.
Setting the Right Desktop Driver
The last pre-install change you need to make is to the desktop driver. Kodi will not function if you’re not using the Broadcom drivers for your Raspberry Pi’s display. As such, you’ll need to ensure the default driver is set.
In raspi-config, select Advanced Options > GL Driver and set Original non-GL desktop driver. Select OK to confirm, and reboot again if prompted.
Installing Kodi on Raspbian Stretch
To get Kodi running on Raspbian, you’ll need to begin with the basics. First, update packages, then check for updates:
sudo apt update sudo apt upgrade
Once these updates are complete, you’re ready to install Kodi:
sudo apt install kodi
However, there’s a bit more to it than that. Installing Kodi is only part of the challenge, as you’ll also need to configure it slightly. This is likely to work best on Raspbian, although this is by no means the only OS you can use.
Once Kodi has been downloaded and installed, you’ll probably want to make some modifications. This guarantees you receive the greatest performance out of the media centre.
Tweaking the Kodi Install
Kodi should already work, but perhaps not to your liking. Further tweaks can be made, such as choosing some additional components, or configuring Kodi to auto-start when your Pi boots.
To find out what binary add-on packages are available, run:
apt-cache search kodi
Scroll through the list to see what is available. For instance, if you want to add joystick support and the DVBLink PVR, use
sudo apt install kodi-peripheral-joystick kodi-pvr-dvblink
You should now be able to control your Raspberry Pi Kodi box with a joystick and record live TV streams to an attached storage device.
Meanwhile, to instruct Kodi to launch when you switch on your Raspberry Pi, you’ll need to edit the autostart file via SSH or the command line on your Pi:
sudo nano ~/.config/lxsession/LXDE-pi/autostart
Here, add a line to the end:
Then, save the file and exit with Ctrl + X. When you next reboot your Raspberry Pi, it should boot straight into Kodi. Exiting Kodi, meanwhile, will let you back into the Raspbian desktop!
It Doesn’t Have to Be Raspbian
We have concentrated on using Raspbian as the foundation for your Kodi setup, but it doesn’t have to be. You could be running one of the many alternative Raspberry Pi-compatible operating systems. There’s no reason why Kodi shouldn’t operate on Ubuntu, for example, or Arch Linux.