Overall looks good. Here are more detailed instructions.
Launch the container.
$ lxc launch ubuntu:16.04 MyKodiContainer
Creating MyKodiContainer
Starting MyKodiContainer
Follow the instructions at https://kodi.wiki/view/HOW-TO:Install_Kodi_for_Linux#Installing_Kodi_on_Ubuntu-based_distributions (they say not to install the kodi
from the Ubuntu repositories because it is an old version). We add the Kodi PPA, then perform a package index update so that Ubuntu knows the additional packages from the new Kodi PPA. Finally, we install the new Kodi.
$ lxc exec MyKodiContainer -- add-apt-repository ppa:team-xbmc/ppa
$ lxc exec MyKodiContainer -- apt update
$ lxc exec MyKodiContainer -- apt install kodi
Now, Kodi is installed in an LXD container on the server.
Then, Kodi needs two ports, port 8080 TCP and port 9777 UDP. The iptables
commands are:
PORT=8080 PROTO=tcp SERVER_IP=your_server_ip CONTAINER_IP=your_container_ip INTERFACE=your_server_network_interface sudo -E bash -c 'iptables -t nat -I PREROUTING -i $INTERFACE -p $PROTO -d $SERVER_IP --dport $PORT -j DNAT --to-destination $CONTAINER_IP:$PORT -m comment --comment "forward to Kodi network port 8080 TCP"'
PORT=9777 PROTO=udp SERVER_IP=your_server_ip CONTAINER_IP=your_container_ip INTERFACE=your_server_network_interface sudo -E bash -c 'iptables -t nat -I PREROUTING -i $INTERFACE -p $PROTO -d $SERVER_IP --dport $PORT -j DNAT --to-destination $CONTAINER_IP:$PORT -m comment --comment "forward to Kodi network port 8080 TCP"'
Now, you can run Kodi in a way that does not start the GUI. I am not familiar with that process.
If you can provide me with some instructions (find a website that shows the commands), I can continue with the rest.
The command to run Kodi would look like this. Compare with the command you gave earlier.
$ lxc exec MyKodiContainer -- sudo --user ubuntu --login kodi --standalone
You would need to do some Kodi configuration first. I do not know whether kodi --standalone
is the proper way to run Kodi on a server. If you want to run any other Kodi command, just prepend the first part lxc exec MyKodiContainer -- sudo --user ubuntu --login
If you can find the rest of the steps to get Kodi working on a server, I am happy to write a complete guide.