Kodi setup on a Raspberry Pi 4


One more handy use for a little computer - a local home media server! Local movie night is relaxing. It’s also great for putting the favorite kid video of the day on repeat … again and again and again (until the dishwasher is loaded, laundry moved, etc.). 🦈 baby shark, doo doo doo 🦈 🔂

The end product is an “appliance-like” device that can play local media on a television.


You’ll need some parts and pieces to build this.

  • Raspberry Pi 4 or 5 (amount of RAM up to you)
  • Micro-SD card (capacity up to you)
  • Power supply for the board (15W USB-C)
  • Case (strongly recommend a passively cooled case like this one)
  • A big external hard drive w/ an independent power supply (do not draw power from the board) or a network share, for the media to share
  • A keyboard (only for initial setup, does not need to be permanently attached)
  • A television with HDMI input and a Micro-HDMI cord

Initial setup

Flash the micro SD card with the latest version of the Raspberry Pi OS - Debian 12 (bookworm), 64-bit lite image. Boot it up and then run raspi-config, the configuration tool, to set up at least the following.

  • Username and password
  • Localization settings
  • Console auto-login (what you want in order to automagically start Kodi on boot)
  • Network setup, if needed
  • Enable SSH (optional)
sudo raspi-config

Run updates to the OS manually, then reboot, before installing more software.

sudo apt update
sudo apt dist-upgrade
sudo reboot

There’s a decent chance that there’ll be new firmware, drivers, security fixes, etc. It’s now a plain server, ready to install any graphical apps.

Older guides have you configure more settings in the /boot/config.txt file. Most aren’t necessary on the Pi 4 B model (or later) with the default OS. In particular, the gpu_mem settings are deprecated in favor of letting the memory management unit (MMU) do what it was designed to. Legacy config.txt options is the official documentation on this if you’re looking for some light reading. I did no configuration changes apart from what’s in this guide and it works fabulously.

Kodi installation

Install Kodi and the desktop manager for it to use.

sudo apt install kodi lightdm

Now have it automatically launch at boot using systemd. Use sudo to create a file at /lib/systemd/system/kodi.service with the following contents:

Description = Kodi Media Center
After =
Wants =

User = pi
Group = pi
Type = simple
ExecStart = /usr/bin/kodi-standalone
Restart = on-abort
RestartSec = 5

WantedBy =

Note you will need to edit the user and group to match the username you created. Enable the service to start Kodi automatically at boot:

sudo systemctl enable kodi.service

Then reboot and configure Kodi as you’d like. Here’s the official quick start guide to get going. My post-install configuration includes

  • Adding the movie, TV, and music directories from an external hard drive to the library (wiki)
  • Setting up Kore, the official remote app for phones/tablets
  • Configuring a weather add-on to see the local weather


Under the hood, it’s a lightweight general-purpose Linux machine that’s likely connected to the internet. It needs regular security updates, outlined in the official docs with handy videos and tutorials.


The chance of me remembering to do this regularly is about zero, so I’ve automated it using the same method in last week’s post - Self-updating build servers, automatically. The machine is joined to a GitHub repository as a self-hosted runner (directions) and runs a workflow to update it automatically 🪄 (this one, to be exact). Now no one will need to remember to keep it securely up to date and it’ll yell (create an issue) if something doesn’t go exactly right.

🎞️ Enjoy home movie night … or simply keep small humans distracted for a few minutes while groceries are put away. 🧸


Yes, this really was written for me. I’d upgraded the hardware, then the software from Buster to Bookworm, and then random crashes started happening. Rather than troubleshoot and search forums for hours to figure out all the possible problematic changes after years of this Just Working, I rebuilt it and wrote it down for future me. Hope someone else searching finds it useful too.

This post is licensed under CC BY 4.0 by the author.