Open Source Media Center (OSMC) on a Raspberry Pi with VPN

This howto describes how to set up the Open Source Media Center (OSMC) on a Raspberry Pi and tunneling all connections through a VPN server. This should work on all Raspberry Pi models with network support. For best results we recommend using a Raspberry Pi 1 Model B+ or Raspberry Pi 2 Model B. For performance reasons we are using a PPTP-VPN connection. This provides only weak encryption, but that should not be an issue for streaming media. However, if you want you can use OpenVPN instead of PPTP but note that this may cause issues with certain FullHD streams.

Installing OSMC

Before you get started, you will need a FAT32-formatted MicroSD card. We recommend using at least a 16 Gigabyte card. If you need to format the card, you can use the SD Formatter for Windows and for MacOS. Under Linux you can use gparted or parted.

Insert the MicroSD card and download the OSMC Installer (available for Windows, MacOS and Linux). Start the installer and select your language and the Raspberry Pi version you are using.

Go through the steps of the installer. Choose the latest available OSMC version and click on “SD Card” as destination for the install. Set the networking to “wired” and choose the drive representing the SD Card in your system. After you accepted the license agreement, the install image will be written on the SD card. This will take some minutes.

After the write process to the SD card has finished, you can unmount the card. Connect your Raspberry Pi to a screen and keyboard, insert the SD Card and connect the power supply to boot the device.

Now the base system will be installed, this will take a few minutes. Once finished you should see the OSMC main menu as displayed on the left.

The configuration is not quite finished yet. Wait a few seconds and you will enter the final configuration screens. Choose your language, timezone and a hostname for your Raspberry Pi (default is “osmc”). In the next screen keep the SSH service enabled (you will need this to configure the VPN in the next steps) and accept the license agreement. Next choose a theme (“OSMC” or “Classic”, for this documentation we used OSMC) and the final configuration is completed.

To find out the local IP address of the Raspberry Pi, go to System -> System Info -> Network.

Now you can log into your Raspberry Pi via SSH on port 22 using the IP shown in the system info. The default user/password is osmc/osmc.

On Windows, we recommend using PuTTY.

Configuring PPTP VPN

After the first ssh login, the APT cache will automatically update. Once done, type in the following command to install the pptp client:

sudo apt-get install pptp-linux
pty "pptp chicago.perfect-privacy.com --nolaunchpppd --debug"
name $USERNAME
password $PASSWORD
remotename PPTP
require-mppe-128
require-mschap-v2
refuse-eap
refuse-pap
refuse-chap
refuse-mschap
noauth
debug
persist
maxfail 0
defaultroute
replacedefaultroute
usepeerdns

When the installation is done, create a PPTP configuration for the server location you want to use. In this example we are creating a configuration for chicago.perfect-privacy.com by editing the following file:

sudo vi /etc/ppp/peers/chicago

Copy the content from the left side into the editor. You will need to change $USERNAME and $PASSWORD for your Perfect Privacy username and password.

Now verify that the connection works by typing

sudo pon chicago

You can traceroute google.com (or any other host) to make sure that your traffic is actually routed over Chicago.

#! /bin/sh

case "$1" in
  start)
    pon chicago
    echo "PPTP Started"
    ;;
  stop)
    poff chicago
    echo "PPTP Stopped."
    ;;
  *)
    echo "Usage: /etc/init.d/blah {start|stop}"
    exit 1
    ;;
esac

exit 0

To automatically connect to the PPTP VPN after startup, create an init.d script as shown on the left. You can give it any name, in this case we call it pptpvpn.

sudo vi /etc/init.d/pptpvpn

To start the VPN client on boot, issue the following commands:

sudo chmod +x /etc/init.d/pptpvpn
sudo update-rc.d pptpvpn defaults

Reboot your device, the configuration is now finished. Now you can add video streams.

In the main menu, go to Videos -> Video add-ons -> Get more…

There are hundreds of pre-configured streams available, you can also add more later. Simply select the stream you want to install by pressing enter.

Some general information about the stream will be displayed. Add it by selecting “install”. It will then be available under “Videos” from the main menu.

When you now select the newly activated video add-on, you will see different options depending on the kind of stream. In the case of TED Talks, you can for instance choose among the most popular streams or just play the newest one.

You can add as many video add-ons as you want.

If you have any questions, comments or other feedback regarding this howto, please use the corresponding thread in our community forums.