People have been finding the coolest ways to use a Raspberry Pi, the 35 dollar computer that’s been driving the geeks wild for a while now. I myself turned it into a media center and taped it to the back of my TV, making it easier to see TV shows and movies. I started writing this tutorial as a guide for myself, just so I could repeat the process easily, but I’m sure others can find it useful as well!
Wrote this blogpost a while ago, but last updated it on October 15th 2018. I run through most of the post again every once in a while to make sure it’s up to date.
Also, should you run into anything that’s not working out for you, I get e-mails on the comments you leave below. So if you get an error, leave a comment and I’ll be happy to look into it together with you. That way, we’re not only helping you, but also all future readers of this blogpost.
Eventually, you’ll have a small box with a Kodi/XBMC Media Center (OSMC, formerly known as Raspbmc, to be precise), with an attached HDD you can access through the network. You’ll have an installation of Transmission to download torrent files, and a WebUI to follow up on downloads from anywhere. To top things off, there’s Sickbeard and Couchpotato to keep track of the TV shows and movies you want to see, it’ll download new items automatically, rename them, place them in the right folder on your HDD and even search subtitles if you need them. Awesome? Hell yes!
What we’ll be needing
- A Raspberry Pi, obviously. I ordered a model B with 512MB of RAM, that might be necessary to make OSMC run smoothly. I ordered it from RS Components and was pretty happy about their service, but you’re free to get it anywhere you like.
- EDIT May 10th 2015: obviously I ordered a Raspberry Pi 2 Model B a few days after coming out, since it offers a far better processor, which is awesome to avoid a little lag you had with the first model.
- EDIT 2: The Raspberry Pi 3 also seduced me… Hmmm, Wi-Fi…
- An SD Card for the first model, a MicroSD card for the RPi 2. Pay attention when you still have to buy one, not all cards work on the RPi. Here’s a list.
- A TV with HDMI
- HDMI Cable
- Micro USB power cable
- USB Adapter, any smartphone charger will do I guess
- External HDD
- Internet connection (the RPi3 has Wi-Fi built in, so that’s the easiest option. But a wired connection is fine too!)
- An app to make SSH connections (Terminal on Mac, Putty on Windows)
OSMC (Raspbmc) installation
First of all, we’ll be installing the operating system. OSMC is the best choice for a media center, since it’s basically a Debian version of Linux with Kodi (XBMC) on top of it. Kodi itself is already an amazing OS to experience content, completely supported by a community. But Sam Nazarko adapted it to the Raspberry Pi, pretty impressive project for a (then) 19-year old student. It gets regular updates and keeps getting more impressive every month! So let’s get started:
- Plug your SD card in your computer, maybe format it if needed.
- Head over to https://osmc.tv/doxwnload/ and download the installer for Windows, Mac OSX or Linux, whatever you’re running. It contains a very easy installer that runs through the steps of getting a system image on the card and even setting up wireless internet. This makes it very easy to set up.
- Now insert the SD card in your Raspberry Pi, hook it up to your TV, your HDD, ethernet (I advise using a cable at first) and then a MicroUSB cable to get it powered.
- Now, with the latest model, you can just connect to Wi-Fi, so you can navigate to Programs, My OSMC and then set up a wireless network from there. So you can drop the ethernet cable if you do it that way!
- You’ll see a boatload of progress bars filling up, a lot of old-school blue screens, leave it alone for a while. Eventually you’ll come back to your TV and it has booted OSMC!
- Feel free to look around in the interface. You can control it with the mobile app for Kodi (XBMC), by keyboard/mouse or, if your TV is HDMI-CEC compatible (most HDTV’s are!), even with your TV remote.
- You’ll find your attached HDD under Video’s > Files, where you can add your folder for TV shows and Movies and let it be indexed.
Now you’re done with this, you should be looking at something similar to this (yes, I prefer the Confluence theme, the default theme looks very different for OSMC these days):
Static IP and SSH
OSMC is a great interface for your Raspberry Pi, but sometimes you’ll have to dive in the Linux behind it to install things, or simply to do things OSMC can’t. Since you connected your RPi to your network, it probably already has an IP which you can find by hitting System Information under System. We’ll need that IP address for the next few steps, however, I found it much easier if that IP address stayed the same every time I powered the device. You can do this by turning off DHCP in the OSMC settings (under Programs) or by setting it through your router (Google is your friend).
Now let’s SSH into the Raspberry Pi. To get in, simply type the following command in Terminal or the console on your computer: “ssh osmc@YOUR IP”. In my case, I typed “ssh [email protected]”. Basically, you’re requesting a SSH connection with that IP address, signing in as the user named ‘osmc’. It’ll ask you for a password, which is ‘osmc’ by default. Now congrats, you’re controlling your RPi without even touching it!
To install Transmission, the client that will be handling your (legal, or not, that’s entirely up to you) downloads, we’ll need that SSH connection. First of all, let’s update our list of apps that can be downloaded.
sudo apt-get update
And finally, we need to install transmission-daemon.
sudo apt-get install transmission-daemon
It’ll download Transmission and install it (might have to hit Y for yes somewhere). Next, we need to stop the service, so we can start editing the config. This shuts the service down:
sudo /etc/init.d/transmission-daemon stop
Next, we need to make the folders you’ll be using, you can do it by navigating there over SMB, but you can also do it with the CLI (Command Line Interface). Use ‘cd’ to get into folders, use ‘ls’ if you’re not sure what’s inside the folder. Eventually, when you’re in the right spot, use ‘mkdir’ together with the name for a folder to make it. I ran ‘cd /media/1TB-DISK/torrents’ and then ‘mkdir incomplete’ and ‘mkdir downloads’, your process may vary. Maybe you even have existing folders too. Then let’s set up Transmission.
First, edit the settings file:
sudo nano /etc/transmission-daemon/settings.json
And then edit a few things, but make sure to edit the paths you’ll be using:
- “download-dir”: “/YOURPATH/downloads”,
- “incomplete-dir”: “/YOURPATH/incomplete”,
- “incomplete-dir-enabled”: true,
- “rpc-password”: “PASSWORDGOESHERE”,
- “rpc-username”: “USERNAMEGOESHERE”,
- “rpc-whitelist-enabled”: “false”,
Don’t worry to paste your password there, it’ll be hashed automatically. Also, we changed the whitelist so we can access Transmission’s WebUI later on. Hit Ctrl + X to exit, hit Y to confirm you want to save it and hit Return to go back to typing commands. One more thing we need to change though, to avoid we run into permission problems later:
sudo usermod -a -G osmc debian-transmission
Finally, this command will start the service back up again, with the changes we just made:
sudo /etc/init.d/transmission-daemon start
And if everything is alright, you can point your browser to this address: http://LOCAL.IP.OF.YOURRPI:9091/
Sickbeard (Sickbeard pretty much died since first writing this post, but it’s been replaced by the much more awesome SickChill) is actually a pretty cool piece of software. You just point it to the folder with your TV Shows on your HDD, it’ll index what you have and then keep those shows updated at all times. An episode aired last night? It’ll be downloading a few hours after that! Also adding new TV Shows is a breeze, it’ll all run automatically, notifying you when a new piece of content is ready to be watched in OSMC.
We’ll have to install git, so we can download SickRage, and some extra juice for Python so it can run:
sudo apt-get install git
Now we’ll clone their repository:
sudo git clone https://github.com/SickChill/SickChill.git /opt/sickchill
Make osmc the owner:
sudo chown -R osmc:osmc /opt/sickchill
Now, before launching the platform, for it to boot together with your Raspberry, you’ll need the following:
sudo nano /etc/default/sickchill
You’ll be creating a new file, where you paste the following code:
Close with Ctrl + X and then Y to save. Copy the default init script:
sudo cp /opt/sickchill/contrib/runscripts/init.ubuntu /etc/init.d/sickchill
Make it executable:
sudo chmod +x /etc/init.d/sickchill
And update the init.D script defaults:
sudo update-rc.d sickchill defaults
Now you can start the service with the following command:
sudo service sickchill start
Now you can find SickChill running on http://YOUR.IP:8081/, Let’s dive in the settings!
- Click the 2 gears at the top right and then go to the tab Search Settings.
- Go to the tab for Torrent Search
- Torrent method should be switched to Transmission if you followed this guide, if you picked in at a later time, you might be using a different app.
- Your Host should be pointed to http://localhost:9091
- Fill in your username and password, the ones you chose earlier.
- You can hit the test button to make sure, then save it.
- Next, click Search Providers and activate a few torrent sites. I picked The Pirate Bay and Kick-ass Torrents. Don’t forget to save.
- Now to the part where the magic happens: Post Processing. Navigate to that tab and don’t forget to checkmark ‘Enable’.
- Point your TV Download DIR again to the folder where Transmission places downloaded files.
- Set Process Episode Method to Move, otherwise the files won’t be moved to the correct folders.
- In the tab ‘metadata’, activate everything for Kodi, since it’ll determine how pretty things look when browsing.
- Then hit Notification and Enable Kodi notifications.
- Point XBMC IP:Port to ‘localhost:8080’
- Enable Update library, it’ll add the downloaded TV shows to your Kodi view as soon as it’s processed.
- I also set up Pushbullet under the tab ‘Devices’, so I can get notified with every downloaded episode on my Android phone. There are a range of other options, so feel free!
- The final step is pretty much the most elaborate. Hover on Shows and then click the button ‘Add shows’. In the next screen, hit Add Existing Shows. Point the following wizard to the folder on your HDD with the shows in them (if you have them already) and let it scan for the separate folders, adding them one after the other. It’ll be a long process, it’ll scan even longer once you added them all, but hang in there. (Actually, since the RPi2, this is far from the slow process it once was. It took hours and hours on the first one!)
Once this is done, you’ll be getting notifications during the day when a new episode is waiting for you back home, it really is an awesome setup!
Now let’s install pretty much the same thing for movies: Couchpotato. The setup is basically the same process so I’ll be running through this a bit faster, first download and install the package:
sudo git clone http://github.com/RuudBurger/CouchPotatoServer.git /opt/couchpotato
I’m going to assume you want to run it on boot, so let’s copy the systemd config:
sudo cp /opt/couchpotato/init/couchpotato.service /etc/systemd/system/couchpotato.service
Then we’ll need to edit that file:
sudo nano /etc/systemd/system/couchpotato.service
And change both User and Group to ‘osmc’
Also, change the value behind ‘ExecStart=’ to ‘/opt/couchpotato/CouchPotato.py’
Then enable the service to start on boot:
sudo systemctl enable couchpotato
And then let’s make sure we start it:
sudo systemctl start couchpotato
Go to the Couchpotato admin at http://YOUR.IP:5050 once it’s done installing everything and go through the welcome-wizard. Fill in a username and password, you’ll need that when we give the internet access to this port. Then just run through the other items, it’ll be obvious what you need. You can set up the torrent sites to search, the limits for the quality you want to download (you can set it up to start downloading a movie when it shows up in a 720p version above a certain amount of megabytes), your connection with Transmission, set it up to move and rename files. Make sure to mark ‘Rename downloaded files’ though, and set the ‘To’ folder to the folder on your HDD you keep movies in. After the wizard, make sure to go through the settings again, since you’ll find useful features like ‘metadata’, which downloads Kodi/XBMC extra’s, or ‘notifications’ to let it automatically add new movies to your Kodi/XBMC database or send notifications to your phone. Under Automation you can also find plugins that allow you to add movies to your wanted-list from the IMDB website (and a bunch of other movie sites). Next you can start adding movies to your list from CouchPotato or from movie websites, you’ll be notified it started downloading once it shows up in a quality good enough for you to watch!
NoIP for external access
Now let’s set it up so we can access all this goodness from outside your network too. This makes it great to make changes from the office, school or even your smartphone. We’ll be using No-IP to give your Raspberry Pi dynamic DNS, so you don’t have to work around a changing IP-address, you can access it from a steady URL. First, the most important part: changing your SSH password, since ‘raspberry’ is pretty much an easy guess for hackers. Type the following command to change your password:
Remember that you have a user ‘root’ and a user ‘pi’, change the password on both. You can go from root back to pi with the command ‘exit’ and the other way around with ‘sudo -s’. Next, let’s get the No-IP app that’ll be sending our dynamic IP address to them, so they can link it up to our URL.
sudo wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
sudo tar vzxf noip-duc-linux.tar.gz
Next, we need to install the tools to install this app and then install it:
sudo apt-get install make
sudo apt-get install gcc
sudo apt-get install libc-dev g++ build-essential
Now I did run into an error here lately, something about unused variables. Seems like you can just ignore it and continue the next steps.
sudo make install
Now go to noip.com and make an account there. There’s a free plan that gives you a URL assigned by them (something like raspberry.no-ip.biz), you can also choose to pay and have your own domain linked to it. Once you’re done signing up, back to Terminal and you’ll see the installation is already asking you for login details to your NoIP account. It’ll also ask for an interval to refresh that IP, I chose 5 minutes. Fill those in and go on, next run the service with the following command:
And you’ll see your IP showing up in the NoIP website after signing in, under Hosts/Redirects. Finally, we also need to set this up to boot after booting your Raspberry:
sudo nano /etc/rc.local
Add “sudo /usr/local/bin/noip2” above exit 0 Again, hit Ctrl+X, Y and enter. Now the hard part, which I probably can’t help you with. You’ll need your modem/router to forward those ports to your Raspberry Pi, but the process is different for every device. This site might help you out though: http://portforward.com/english/routers/port_forwarding/. Find your device there and good luck with forwarding ports 22, 9091, 8081 and 5050 to your local RPi IP-address.
This should be enough to go to the URL you set up with NoIP and add a port behind it. Or SSH connect to [email protected]. Now throw both hands up in the air and go for an enthusiastic “WOOHOO!” because you made it all the way through this tutorial. Now start playing around with the different parts you installed, they’ll make your life easier once you set them up to your taste! I hope everything went smooth, but feel free to ask questions in the comments below if it hasn’t. I might not know much, but I did plenty of things wrong to able to fix some of your problems. Good luck!
Also, if you liked this tutorial, you’re always welcome to buy me a beer! Not that you owe me or anything, but I can only try, right? https://www.paypal.me/dennisjanssen