Kodi transforms any Linux machine into a full-featured media center, organizing movies, TV shows, music, and photos with metadata and artwork while supporting live TV, streaming add-ons, and remote control apps. If you prefer a server-based solution, consider Jellyfin or Plex for centralized streaming. For a lightweight alternative, VLC media player provides basic playback without the full media center experience. This guide walks through compiling Kodi 21.3 Omega from source on Ubuntu, which provides the latest stable release with all available features.
Kodi Overview
Before installing, here’s what makes Kodi useful for media management:
- Media library organization: Kodi scans your local folders and automatically downloads poster art, plot summaries, and metadata from online databases like TheMovieDB and TheTVDB.
- Multi-device streaming: Run Kodi on your desktop while using smartphone apps like Kore or Yatse as remote controls, or sync watched status across multiple Kodi installations.
- Add-on ecosystem: Extend functionality with official and community add-ons for streaming services, subtitle downloads, weather displays, and audio visualizations.
- Live TV integration: Connect to TV tuners or IPTV services through PVR (Personal Video Recorder) add-ons, with full EPG (Electronic Program Guide) support and recording capabilities.
The Team Kodi PPA has been discontinued, so this guide covers compiling from source, which is the recommended method for Ubuntu users who want the latest Kodi release. If you previously used the PPA, see the migration section to switch to source compilation. These steps work on Ubuntu 22.04 LTS, 24.04 LTS, and 26.04 LTS.
Compile Kodi from Source on Ubuntu
Compiling from source gives you the latest Kodi release with full feature support. This approach requires installing development libraries, downloading the source code, and running the build. Depending on your hardware, allow 15-60 minutes for the compilation process.
Install Build Dependencies
First, update your package lists to ensure you get the latest versions of all dependencies:
sudo apt update
Next, install the required build tools and development libraries. This command installs over 70 packages that Kodi needs for compilation:
sudo apt install -y autoconf automake autopoint autotools-dev cmake curl \
default-jre gawk gcc g++ gdc gettext git gperf \
libasound2-dev libass-dev libavahi-client-dev libavahi-common-dev \
libbluetooth-dev libbluray-dev libbz2-dev libcdio-dev libcdio++-dev \
libcec-dev libcrossguid-dev libcurl4-openssl-dev libdbus-1-dev \
libdrm-dev libegl1-mesa-dev libenca-dev libexiv2-dev libflac-dev \
libflatbuffers-dev libfmt-dev libfontconfig-dev libfreetype-dev \
libfribidi-dev libfstrcmp-dev libgcrypt-dev libgif-dev \
libgl1-mesa-dev libgles2-mesa-dev libglew-dev libglu1-mesa-dev \
libgnutls28-dev libgpg-error-dev libgtest-dev libiso9660-dev \
libjpeg-dev liblcms2-dev liblirc-dev libltdl-dev liblzo2-dev \
libmicrohttpd-dev libmysqlclient-dev libnfs-dev libogg-dev \
libp8-platform-dev libpcre2-dev libpcre3-dev libplist-dev libpng-dev \
libpulse-dev libshairplay-dev libsmbclient-dev libspdlog-dev \
libsqlite3-dev libssl-dev libtag1-dev libtiff-dev libtinyxml-dev \
libtinyxml2-dev libtool libudev-dev libunistring-dev libva-dev \
libvdpau-dev libvorbis-dev libxkbcommon-dev libxmu-dev libxrandr-dev \
libxslt1-dev libxt-dev lsb-release meson nasm ninja-build \
nlohmann-json3-dev python3-dev python3-pil rapidjson-dev swig unzip \
uuid-dev zip zlib1g-dev
Download Kodi Source Code
With dependencies installed, create a build directory and download the latest stable Kodi source. The following command automatically fetches the newest release from GitHub:
mkdir -p $HOME/kodi-build
cd $HOME/kodi-build
curl -s https://api.github.com/repos/xbmc/xbmc/releases/latest | grep -oP '"tag_name": "\K[^"]+' | xargs -I{} wget -q "https://github.com/xbmc/xbmc/archive/refs/tags/{}.tar.gz" -O kodi.tar.gz
This automated approach saves you from manually checking version numbers. Here is how it works:
curl -s: Silently fetches release data from the GitHub APIgrep -oP: Extracts the tag name (e.g., 21.3-Omega) using regexxargs -I{}: Passes the version to wget, constructing the download URL
If the piped command syntax seems confusing or the GitHub API is rate-limited, download manually instead: visit the Kodi releases page, find the latest stable version tag, and download the source tarball directly.
Extract the source archive and remove the tarball:
tar -xzf kodi.tar.gz
rm kodi.tar.gz
Configure and Build Kodi
Create a separate build directory and run CMake to configure the compilation. This configuration targets X11 with OpenGL rendering:
mkdir $HOME/kodi-build/kodi-build
cd $HOME/kodi-build/kodi-build
cmake ../xbmc-*/ \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCORE_PLATFORM_NAME="x11" \
-DAPP_RENDER_SYSTEM=gl \
-DENABLE_INTERNAL_CROSSGUID=ON \
-DENABLE_INTERNAL_FLATBUFFERS=ON
CMake will check for all required dependencies and configure the build. When configuration completes successfully, you should see output similar to:
-- AVAHI enabled: Yes -- BLUETOOTH enabled: Yes -- BLURAY enabled: Yes -- CEC enabled: Yes -- PULSEAUDIO enabled: Yes -- VAAPI enabled: Yes -- GLX enabled: Yes -- VDPAU enabled: Yes -- Configuring done (21.3s) -- Generating done (0.7s) -- Build files have been written to: $HOME/kodi-build/kodi-build
Once configuration completes, start the compilation using all available CPU cores:
cmake --build . -- -j$(nproc)
Compilation typically takes 30-60 minutes depending on your CPU. The
-j$(nproc)flag uses all available processor cores to speed up the build.
Install Kodi
After compilation completes successfully, install Kodi to your system:
sudo make install
sudo ldconfig
The ldconfig command updates the system’s library cache so Kodi can find its shared libraries.
Verify Kodi Installation
Confirm the installation succeeded by checking the version:
kodi --version
Kodi Media Center 21.3 (21.3.0) Git:20251031-xxxxx
Configure Firewall for Kodi Remote Control
If you plan to use smartphone remote apps or access Kodi from other devices on your network, you need to allow incoming connections through your firewall. Kodi’s web server and remote interfaces use specific ports.
Enable UFW Firewall
Ubuntu includes UFW (Uncomplicated Firewall) by default. For a complete walkthrough of firewall management, see our UFW firewall guide. First, verify it’s installed and enable it if not already active:
sudo apt install ufw
sudo ufw enable
Allow Kodi Web Interface Port
Kodi’s web interface typically uses port 8080 by default. Allow this port if you want to control Kodi from a browser or remote app:
sudo ufw allow 8080/tcp
For additional security, restrict access to your local network only:
sudo ufw allow from 192.168.1.0/24 to any port 8080 proto tcp
Replace 192.168.1.0/24 with your actual network range.
Verify Firewall Rules
Check that your rules are active:
sudo ufw status numbered
Status: active
To Action From
-- ------ ----
[ 1] 8080/tcp ALLOW IN Anywhere
Launch Kodi
You can start Kodi from the terminal:
kodi
Alternatively, find Kodi in your application menu under Sound & Video or Multimedia.

First-Time Setup Tips
When you launch Kodi for the first time, consider these configuration steps:
- Add media sources: Go to Videos → Files → Add videos to point Kodi at your media folders. During setup, select the content type (Movies, TV Shows) so Kodi can download the correct metadata.
- Enable the web interface: Navigate to Settings → Services → Control and enable “Allow remote control via HTTP” to use smartphone remote apps.
- Install add-ons: Browse the official Kodi add-on repository through Add-ons → Download for streaming services, subtitle downloaders, and interface customizations.
- Configure audio output: Under Settings → System → Audio, select your preferred audio device and enable passthrough for surround sound if your receiver supports it.


Update Kodi
Since Kodi was compiled from source, updates require rebuilding. The following script automates this process by checking for new releases and rebuilding only when an update is available.
First, check your current version:
kodi --version
Save the following script as $HOME/kodi-build/update-kodi.sh:
#!/bin/bash
set -e
INSTALL_PREFIX="/usr/local"
BUILD_DIR="$HOME/kodi-build"
for cmd in curl wget cmake make gcc; do
if ! command -v $cmd &> /dev/null; then
echo "Error: $cmd is required but not installed."
exit 1
fi
done
CURRENT_VERSION=$($INSTALL_PREFIX/bin/kodi --version 2>/dev/null | grep -oP '[0-9]+\.[0-9]+' | head -1 || echo "none")
LATEST_VERSION=$(curl -s https://api.github.com/repos/xbmc/xbmc/releases/latest | grep -oP '"tag_name": "\K[^"]+')
if [ -z "$LATEST_VERSION" ]; then
echo "Error: Could not fetch the latest Kodi version."
exit 1
fi
LATEST_SHORT=$(echo "$LATEST_VERSION" | grep -oP '^[0-9]+\.[0-9]+')
if [ "$CURRENT_VERSION" = "$LATEST_SHORT" ]; then
echo "Kodi is already up to date: $CURRENT_VERSION"
exit 0
fi
echo "Updating Kodi from $CURRENT_VERSION to $LATEST_VERSION"
cd "$BUILD_DIR"
rm -rf xbmc-* kodi-build kodi.tar.gz
curl -s https://api.github.com/repos/xbmc/xbmc/releases/latest | grep -oP '"tag_name": "\K[^"]+' | xargs -I{} wget -q "https://github.com/xbmc/xbmc/archive/refs/tags/{}.tar.gz" -O kodi.tar.gz
tar -xzf kodi.tar.gz
rm kodi.tar.gz
mkdir kodi-build
cd kodi-build
cmake ../xbmc-*/ \
-DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX \
-DCORE_PLATFORM_NAME="x11" \
-DAPP_RENDER_SYSTEM=gl \
-DENABLE_INTERNAL_CROSSGUID=ON \
-DENABLE_INTERNAL_FLATBUFFERS=ON
cmake --build . -- -j$(nproc)
sudo make install
sudo ldconfig
echo "Kodi updated to $LATEST_VERSION"
Make the script executable and run it:
chmod +x $HOME/kodi-build/update-kodi.sh
$HOME/kodi-build/update-kodi.sh
Run this script manually rather than automating it with cron. Kodi compilation can fail when new dependencies or build system changes are introduced between versions, so reviewing the output lets you catch and fix problems before they affect your installation.
Verify the updated version:
kodi --version
Remove Kodi
If you need to remove Kodi, first uninstall the application:
cd $HOME/kodi-build/kodi-build
sudo make uninstall
Then clean up the build directory:
rm -rf $HOME/kodi-build
Warning: The following command removes your Kodi configuration, including library databases, add-on settings, and cached metadata. Back up this folder first if you want to preserve your setup.
rm -rf ~/.kodi
Troubleshooting
CMake Configuration Fails
If CMake reports “Could NOT find” errors, you’re missing a required library. For example, a missing RapidJSON dependency produces this error:
CMake Error at /usr/share/cmake-3.31/Modules/FindPackageHandleStandardArgs.cmake:233 (message): Could NOT find RapidJSON (missing: RAPIDJSON_INCLUDE_DIRS RapidJSON_VERSION)
To resolve this, search for the development package and install it:
apt search rapidjson-dev
sudo apt install rapidjson-dev
After installing the missing package, remove the build directory and rerun CMake:
cd $HOME/kodi-build
rm -rf kodi-build
mkdir kodi-build && cd kodi-build
cmake ../xbmc-*/ -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME="x11" -DAPP_RENDER_SYSTEM=gl -DENABLE_INTERNAL_CROSSGUID=ON -DENABLE_INTERNAL_FLATBUFFERS=ON
Build Runs Out of Memory
If compilation fails with memory errors or your system becomes unresponsive during the build, reduce the parallel job count. Systems with less than 8GB of RAM may struggle with the default settings. Instead of using all cores, specify a lower number:
cmake --build . -- -j2
This limits compilation to 2 concurrent jobs, reducing memory usage at the cost of longer build time.
Kodi Won’t Launch
If Kodi doesn’t start after installation, run it from a terminal to see error messages:
kodi 2>&1 | head -50
A common issue is missing shared libraries. If you see errors like “kodi: error while loading shared libraries”, first update the library cache:
sudo ldconfig
For graphics-related errors, verify your display drivers are properly installed. Check if OpenGL is working with:
glxinfo | grep "OpenGL version"
If glxinfo is not found, install the mesa-utils package: sudo apt install mesa-utils
Migrate from the Team Kodi PPA
If you previously installed Kodi from the Team Kodi PPA (now discontinued), those packages have not been updated since 2023 and will not receive new releases. To migrate to the source-compiled installation without losing your library data, first remove the PPA package (your ~/.kodi configuration folder is preserved):
sudo apt remove kodi
sudo apt autoremove
Remove the PPA to prevent package conflicts:
sudo add-apt-repository --remove ppa:team-xbmc/ppa
sudo apt update
Your Kodi library database, add-on settings, and watched status remain in ~/.kodi. After compiling from source following this guide, launch Kodi and your existing library will load automatically.
Conclusion
You now have Kodi installed from source with X11 support, ready to organize and stream your media library. The source-compiled installation gives you access to the latest features while the build directory at $HOME/kodi-build and the update script enable straightforward updates when new releases become available. Kodi automatically installs its desktop entry during make install, so you can launch it from your application menu in the Multimedia or Sound & Video category.