2016-07-19, 12:41
Update: New guide
I have written a new guide which uses Lutris for game managment. This setup gives a more seamless experience launching games from Kodi. It supports Steam, GOG, Itch.io, emulators and several more game sources.
You can find the new guide on GitHub.
-----
Introduction
This HOW TO will explain how I set up my HTPC running Kodi, Steam and EmulationStation on a minimal Ubuntu 16.04 install. The HOW TO will cover the specific topics of gluing Kodi, Steam and EmulationStation into a coherent media center solution. Therefore, this HOW TO will not cover configuration of Kodi, Steam nor EmulationStation. However, I will link to other guides that cover these topics where they are relevant.
The HOW TO assumes that you have a basic understanding of terminal commands and SSH. If these two words do not carry any meaning to you, read these two articles: Connecting via SSH to your server and Common SSH commands.
If anything seems unclear in this guide, if any commands are wrong, or if you have any advice on how any of the steps can be done better, please don’t hesitate to make a reply.
Updates
30.11.2016 – Fixed typoes. Thanks Rokys.
29.08.2016 – Removed adding USER to the ‘audio’ group in 3.1. See this post for more info.
18.08.2016 – Added sed command to to 7.5.
03.08.2016 – Added to 8.2 how to change splash screen.
1. MinimalCD install of Ubuntu 16.04
1.1 Create a bootable USB drive
Download the Ubuntu 16.04 MinimalCD ISO image for your architecture (most likely 64-bit). Create a bootable USB drive with the image. There are many programs available which could be used to create a bootable USB drive, but one that is cross-platform is UNetBootIn, you can also have a look at the Ubuntu documentation if you are unsure how to do it.
Boot your HTPC from the USB drive. Make sure that it is connected to the Internet with a cable, as the MinimalCD image downloads all its packages during installation.
1.2 Installation
Installation is straight forward, but it looks intimidating since it is not in a fancy GUI. However, if you are unsure consult this guide or follow Step 1.3 from this thread.
IMPORTANT: There are a few options, explained underneath, that are specific to this installation.
Finish the installation, remove the USB drive and reboot. You should be greeted by the login screen for your ADMIN user.
2. SSH
2.1. Connect to the HTPC using SSH
For Linux and OSX, connect to your HTPC using SSH from a terminal instance. Replace [ADMIN] with the username for ADMIN and [HOSTNAME] is the HTPC’s hostname selected during install.
If you are connecting through a computer running Windows, download PuTTY and follow this guide.
You should be prompted to trust the connection, then enter your ADMIN password when prompted.
3. Creating a user with limited priviledges
3.1. Creating a user
Kodi and its associated programs will be run by a user with limited privileges. The reason is security. The user which will be running programs will have no password and will login automatically. Therefore the user should be as restricted as possible. You can assign this user any username you like, but make a note of it. The user created in the following steps will be referred to as USER.
Create a user with password disabled. Replace [USER] with you preferred username.
Assign the necessary privileges to the user.
4. Installing programs
4.1. Adding program PPAs
Ubuntu 16.04 ships with Kodi, Steam, RetroArch and Dolphin available in its repositories. However, by adding third party PPAs, it is possible to get the latest stable version of the programs. All of the following commands are issued through SSH as the ADMIN user.
First, add the Kodi Stable PPA.
Then, add the RetroArch PPA.
Add the EmulationStation PPA.
And finally, the Dolphin PPA.
Now, get the latest package lists and install the programs.
Also, at this point, it is a good idea to check for any general updates to Ubuntu 16.04.
5. Install Openbox and a kodi-openbox Xsession
5.1. Install Openbox
To be able to run external programs (such as Steam), you need to run Kodi on top of a window manager in a Xsession.
Fist you need to install Openbox.
5.2. Install Kodi-Openbox Xsession
There are several guides on this forum and the web in general that explains how to set up an Xsession for Kodi to run in. These solutions usually involves a lot of scripting. The easiest solution I have found is to download kodi-openbox created by the GitHub user lufinkey. This is a collection of scripts that includes an Openbox Xsession that runs Kodi and a script that will launch external programs and manage their windows.
To install kodi-openbox Xsession, download the latest .zip file from the GitHub master branch. The file is named “openbox-kodi-master.zip” by the below code.
Extract the .zip file.
If you get a prompt telling you are missing the package unzip, install it.
Move into the extracted directory, create a .deb package from the extracted content and install the .deb.
6. Auto login and Xsession
6.1. Enable auto login in LightDM
When the HTPC is powered on it should automatically log in USER into the kodi-openbox Xsession. To accomplish this you need to configure LightDM, Xubuntu’s login manager.
Open up the LightDM configuration file. The file will be created automatically if it doesn’t exist.
Paste in the following configuration. Make sure that you replace [USER] with your USER’s username. Remember that you need to use CTRL+SHIFT+V to paste in a terminal instance.
Save the file by pressing CTRL+X and then press ENTER.
6.2 Log into the kodi-openbox Xsession
First, you need to reboot the HTPC to make all the changes you have made has an effect.
Congratulations, if everything went well, you should now have launched Kodi in the Openbox Xsession.
7. Add menu items for Steam and EmulationStation to Aeon Nox
7.1. Using SSH as USER
Connect to your HTPC again through SSH. You should be logged in as ADMIN, but for the next steps you need to change to USER. You need to change users since the files downloaded and configured by ADMIN are not accessible to USER, and because you will place and configure files in USER’s Home directory which is not accessible to ADMIN.
Change user in SSH. Replace [USER] with USER’s username.
7.2. Install the Aeon Nox skin
I am using the Aeon Nox skin in this HOW TO. The home menu of this skin is easy to customize, which is needed to add menu items for Steam and EmulationStation. How to install this skin is explained well on the Kodi Wiki.
7.3. Download and install Advanced Launcher
Download Advanced Launcher from Angelscry’s GitHub repo. To do so, issue the following command through SSH:
Angelscry has discontinued the add-on, but it is the best way I have found on launching external applications in Kodi. If you know of a different add-on or solution that acomplishes this task in a more graceful way, please let me know.
In Kodi, add the Advanced Launcher add-on. How to install an add-on from a .zip is explained on the Kodi Wiki. The .zip is located in the Home folder and is named advanced-launcher-master.zip.
7.4. Configure Advanced Launcher
Navigate to your program add-ons in the Aeon Nox skin. It is located on the Home Screen under the title Apps.
To add a launcher for Steam do the following:
Create a launcher for EmulationStation:
7.5. Edit favorites.xml
There is a bug in Advanced Launcher/Kodi that launches a favorite with Kodi’s PlayMedia function instead of the RunPlugin function. To fix this you need to edit the favourites.xml manually.
Open the favourites.xml (make sure you are USER):
Replace PlayMedia with RunPlugin for the favorites Steam and Emulation.
If your favourites.xml doesn’t contain any other favorites, it is possible to replace PlayMedia with RunPplugin automatically with the sed command.
7.6. Add Home Menu items to Aeon Nox
To add Steam to the Home screen items to Aeon Nox, follow these steps:
8. Miscellaneous
8.1 Remove grey Openbox background
To remove the default, grey Openbox background that appears when you launch external applications and replace it with a nice black one, do the following:
Install hsetroot (remember to be logged in as ADMIN)
Switch to USER
Copy the default Openbox configuration files to USER’s Home directory
Open autostart with nano
Paste in the following at the end of the file:
Restart and you are done.
8.2 Add Kodi splash screen
If you want to get rid of the Xubuntu splash screen, it is possible to change it to a Kodi one. teeedubb on this forum has made/adapted a Kodi splash screen for Ubuntu 16.04.
Download the .deb as ADMIN
Install the .deb
I have written a new guide which uses Lutris for game managment. This setup gives a more seamless experience launching games from Kodi. It supports Steam, GOG, Itch.io, emulators and several more game sources.
You can find the new guide on GitHub.
-----
Introduction
This HOW TO will explain how I set up my HTPC running Kodi, Steam and EmulationStation on a minimal Ubuntu 16.04 install. The HOW TO will cover the specific topics of gluing Kodi, Steam and EmulationStation into a coherent media center solution. Therefore, this HOW TO will not cover configuration of Kodi, Steam nor EmulationStation. However, I will link to other guides that cover these topics where they are relevant.
The HOW TO assumes that you have a basic understanding of terminal commands and SSH. If these two words do not carry any meaning to you, read these two articles: Connecting via SSH to your server and Common SSH commands.
If anything seems unclear in this guide, if any commands are wrong, or if you have any advice on how any of the steps can be done better, please don’t hesitate to make a reply.
Updates
30.11.2016 – Fixed typoes. Thanks Rokys.
29.08.2016 – Removed adding USER to the ‘audio’ group in 3.1. See this post for more info.
18.08.2016 – Added sed command to to 7.5.
03.08.2016 – Added to 8.2 how to change splash screen.
1. MinimalCD install of Ubuntu 16.04
1.1 Create a bootable USB drive
Download the Ubuntu 16.04 MinimalCD ISO image for your architecture (most likely 64-bit). Create a bootable USB drive with the image. There are many programs available which could be used to create a bootable USB drive, but one that is cross-platform is UNetBootIn, you can also have a look at the Ubuntu documentation if you are unsure how to do it.
Boot your HTPC from the USB drive. Make sure that it is connected to the Internet with a cable, as the MinimalCD image downloads all its packages during installation.
1.2 Installation
Installation is straight forward, but it looks intimidating since it is not in a fancy GUI. However, if you are unsure consult this guide or follow Step 1.3 from this thread.
IMPORTANT: There are a few options, explained underneath, that are specific to this installation.
- Make a note of the hostname you give your HTPC. Also make sure that there is no other computer on you LAN with this hostname.
- Choose a decent password for your user. The user you create during the installation will be the administrator user for this installation. This user will hereafter be referred to as ADMIN. However, Kodi and all programs associated with it will be run by a user with limited privileges.
- When creating the user, make sure you do not encrypt the user’s Home directory.
- Allow the system to install security updates automatically. This is not strictly necessary, but it improves security.
- When prompted to install software select the following: Minimal Xubuntu desktop, SSH server. Select software with SPACE, confirm with ENTER.
Finish the installation, remove the USB drive and reboot. You should be greeted by the login screen for your ADMIN user.
2. SSH
2.1. Connect to the HTPC using SSH
For Linux and OSX, connect to your HTPC using SSH from a terminal instance. Replace [ADMIN] with the username for ADMIN and [HOSTNAME] is the HTPC’s hostname selected during install.
Code:
ssh [ADMIN]@[HOSTNAME]
If you are connecting through a computer running Windows, download PuTTY and follow this guide.
You should be prompted to trust the connection, then enter your ADMIN password when prompted.
3. Creating a user with limited priviledges
3.1. Creating a user
Kodi and its associated programs will be run by a user with limited privileges. The reason is security. The user which will be running programs will have no password and will login automatically. Therefore the user should be as restricted as possible. You can assign this user any username you like, but make a note of it. The user created in the following steps will be referred to as USER.
Create a user with password disabled. Replace [USER] with you preferred username.
Code:
sudo adduser --disabled-password --gecos "" [USER]
Assign the necessary privileges to the user.
Code:
sudo usermod -a -G cdrom,video,plugdev,users,dialout,dip,input,netdev [USER]
4. Installing programs
4.1. Adding program PPAs
Ubuntu 16.04 ships with Kodi, Steam, RetroArch and Dolphin available in its repositories. However, by adding third party PPAs, it is possible to get the latest stable version of the programs. All of the following commands are issued through SSH as the ADMIN user.
First, add the Kodi Stable PPA.
Code:
sudo apt-add-repository ppa:team-xbmc/ppa
Then, add the RetroArch PPA.
Code:
sudo apt-add-repository ppa:libretro/stable
Add the EmulationStation PPA.
Code:
sudo apt-add-repository ppa:emulationstation/ppa
And finally, the Dolphin PPA.
Code:
sudo apt-add-repository ppa:dolphin-emu/ppa
Now, get the latest package lists and install the programs.
Code:
sudo apt-get update
sudo apt-get install kodi retroarch libretro-* emulationstation* dolphin-emu steam
Also, at this point, it is a good idea to check for any general updates to Ubuntu 16.04.
Code:
sudo apt-get upgrade && sudo apt-get dist-upgrade
5. Install Openbox and a kodi-openbox Xsession
5.1. Install Openbox
To be able to run external programs (such as Steam), you need to run Kodi on top of a window manager in a Xsession.
Fist you need to install Openbox.
Code:
sudo apt-get install openbox
5.2. Install Kodi-Openbox Xsession
There are several guides on this forum and the web in general that explains how to set up an Xsession for Kodi to run in. These solutions usually involves a lot of scripting. The easiest solution I have found is to download kodi-openbox created by the GitHub user lufinkey. This is a collection of scripts that includes an Openbox Xsession that runs Kodi and a script that will launch external programs and manage their windows.
To install kodi-openbox Xsession, download the latest .zip file from the GitHub master branch. The file is named “openbox-kodi-master.zip” by the below code.
Code:
wget -O openbox-kodi-master.zip https://github.com/lufinkey/kodi-openbox/archive/master.zip
Extract the .zip file.
Code:
unzip openbox-master.zip
If you get a prompt telling you are missing the package unzip, install it.
Code:
sudo apt-get install unzip
Move into the extracted directory, create a .deb package from the extracted content and install the .deb.
Code:
cd kodi-openbox-master
bash ./build.sh
sudo dpkg -i kodi-openbox.deb
6. Auto login and Xsession
6.1. Enable auto login in LightDM
When the HTPC is powered on it should automatically log in USER into the kodi-openbox Xsession. To accomplish this you need to configure LightDM, Xubuntu’s login manager.
Open up the LightDM configuration file. The file will be created automatically if it doesn’t exist.
Code:
sudo nano /etc/lightdm/lightdm.conf
Paste in the following configuration. Make sure that you replace [USER] with your USER’s username. Remember that you need to use CTRL+SHIFT+V to paste in a terminal instance.
Code:
[Seat:*]
autologin-user=[USER]
autologin-session=kodi-openbox
Save the file by pressing CTRL+X and then press ENTER.
6.2 Log into the kodi-openbox Xsession
First, you need to reboot the HTPC to make all the changes you have made has an effect.
Code:
sudo reboot
Congratulations, if everything went well, you should now have launched Kodi in the Openbox Xsession.
7. Add menu items for Steam and EmulationStation to Aeon Nox
7.1. Using SSH as USER
Connect to your HTPC again through SSH. You should be logged in as ADMIN, but for the next steps you need to change to USER. You need to change users since the files downloaded and configured by ADMIN are not accessible to USER, and because you will place and configure files in USER’s Home directory which is not accessible to ADMIN.
Change user in SSH. Replace [USER] with USER’s username.
Code:
sudo su - [USER]
7.2. Install the Aeon Nox skin
I am using the Aeon Nox skin in this HOW TO. The home menu of this skin is easy to customize, which is needed to add menu items for Steam and EmulationStation. How to install this skin is explained well on the Kodi Wiki.
7.3. Download and install Advanced Launcher
Download Advanced Launcher from Angelscry’s GitHub repo. To do so, issue the following command through SSH:
Code:
wget -O advanced-launcher-master.zip https://github.com/angelscry/plugin.program.advanced.launcher/archive/master.zip
Angelscry has discontinued the add-on, but it is the best way I have found on launching external applications in Kodi. If you know of a different add-on or solution that acomplishes this task in a more graceful way, please let me know.
In Kodi, add the Advanced Launcher add-on. How to install an add-on from a .zip is explained on the Kodi Wiki. The .zip is located in the Home folder and is named advanced-launcher-master.zip.
7.4. Configure Advanced Launcher
Navigate to your program add-ons in the Aeon Nox skin. It is located on the Home Screen under the title Apps.
To add a launcher for Steam do the following:
- Open the add-on
- Open the Default folder
- Bring up the Context Menu and select Standalone Launcher
- In the Path dialogue that appers select Root and navigate to: /usr/bin/kodi-openbox-runprogram. Press Done.
- In the Arguments dialogue enter the argument: steam -bigpicture
- In the Title dialogue enter the name Steam
- In the Platform dialogue select Linux
- Leave the next two dialogues blank.
Create a launcher for EmulationStation:
- Open the add-on
- Open the Default folder
- Bring up the Context Menu and select Standalone Launcher
- In the Path dialogue that appers select Root and navigate to: /usr/bin/kodi-openbox-runprogram. Press Done.
- In the Arguments dialogue enter the argument: emulationstation
- In the Title dialogue enter the name Emulation
- In the Platform dialogue select Linux
- Leave the next two dialogues blank.
7.5. Edit favorites.xml
There is a bug in Advanced Launcher/Kodi that launches a favorite with Kodi’s PlayMedia function instead of the RunPlugin function. To fix this you need to edit the favourites.xml manually.
Open the favourites.xml (make sure you are USER):
Code:
nano ~/.kodi/userdata/favorites.xml
Replace PlayMedia with RunPlugin for the favorites Steam and Emulation.
If your favourites.xml doesn’t contain any other favorites, it is possible to replace PlayMedia with RunPplugin automatically with the sed command.
Code:
sed -i -e 's/PlayMedia/RunPlugin/g' ~/.kodi/userdata/favorites.xml
7.6. Add Home Menu items to Aeon Nox
To add Steam to the Home screen items to Aeon Nox, follow these steps:
- Mark the System Home menu item. In the sub-menu that appears select Skin Settings
- In the dialogue that appears, select Setup the Aeon Nox main menu
- In the left hand list, scroll down to Custom 1
- Toggle the button next to enabled
- Edit the Label to STEAM
- Select Default Select Action, scroll down to Favorites, select it and select the Steam favorite
- In the left hand list, scroll down to Custom 2
- Toggle the button next to enabled
- Edit the Label to EMULATION
- Select Default Select Action, scroll down to Favorites, select it and select the Emulation favorite
8. Miscellaneous
8.1 Remove grey Openbox background
To remove the default, grey Openbox background that appears when you launch external applications and replace it with a nice black one, do the following:
Install hsetroot (remember to be logged in as ADMIN)
Code:
sudo apt-get install hsetroot
Switch to USER
Code:
sudo su - [USER]
Copy the default Openbox configuration files to USER’s Home directory
Code:
cp -R /etc/xdg/openbox ~/.config/
Open autostart with nano
Code:
nano ~/.config/openbox/autostart
Paste in the following at the end of the file:
Code:
# Set a background color
hsetroot -solid black
Restart and you are done.
8.2 Add Kodi splash screen
If you want to get rid of the Xubuntu splash screen, it is possible to change it to a Kodi one. teeedubb on this forum has made/adapted a Kodi splash screen for Ubuntu 16.04.
Download the .deb as ADMIN
Code:
wget https://dl.dropboxusercontent.com/u/22410524/xbmc/plymouth-theme/plymouth-theme-kodi-logo.deb
Install the .deb
Code:
sudo dpkg -i plymouth-theme-kodi-logo.deb