I cut my cable service quite a while ago. I have no regrets for sure. There are a few shows that I dig so I just download those, throw them on a flash drive and walk that drive over to plug it into my WDTV media streamer. It works but it’s annoying. I could stream it from my computer but even though the WDTV is connected via ethernet, my laptop isn’t and the resulting video is not smooth at all. I decided it was time to create a stand alone media server that would be responsible for both the downloading and storage of the TV shows and movies, keeping my main computer free to do other stuff. The WDTV would then stream content directly off the media server and Bob’s your uncle. The plan was also to have the media server tucked out of the way and I’d remote desktop in to do any maintenance or what evs.
This project started off with a desktop PC (and with the help of Chris B) got a fresh dose of Ubuntu Server and some SSH and VNC software. Everything worked great at NESIT. When I got home it quickly because clear the setup wasn’t going to fly (read: I’m Linux illiterate). Without my own personal live-in Linux expert, I was going to be up a creek without a paddle. And the PC was way louder at my house than at NESIT, go figure.
So I was thinking, my current computer is a Dell laptop and it is dead silent. The light bulb went off and I decided to change the course of my project, ditching Ubuntu Server and roar of the PC and replacing it with an lower-power-consumption Dell laptop. This puppy already had a 500gb drive. After reading how to build the perfect media server, I decided Ubuntu Desktop would be the way to go on the older laptop I was using.
So what’s the point of this article? Not to blab but to share the hurdles I faced with the project.
Sharing files between Windows(or Media Streamer) and Linux isn’t super straight forward.
My main personal computer is running Windows 7. You may expect that with both a Windows and Ubuntu computer plugged into the same network that each computer could see the other. Wrong assumption.
With a fresh install of Ubuntu, you need to go to the folder that will be shared. Right click on its icon and select ‘Local Network Share’. A dialog box will appear where you can check off ‘Share this folder’. Do that and press ‘Create Share’. Since this was a fresh Ubuntu install, a message pops up and asks if you want to install a program (samba) that will allow the Windows and Ubuntu computers to talk to each other. Ubuntu walks you through the install process.
Next, still on the Ubuntu machine, you need to modify a file. In the terminal, type:
sudo gedit /etc/samba/smb.conf Right in the beginning of the file you’ll see this: workgroup = WORKGROUP The uppercase ‘workgroup’ name needs to match the workgroup of your Windows machine. You can find this by going to the Windows 7 start menu, in the search area type ‘workgroup‘, then select ‘show which workgroup this computer is on‘. For example, if the workgroup on the Windows 7 machine is NESIT, you would change smb.conf to workgroup = NESIT .
Ubuntu has a firewall installed by default, I had to disable it to in order to get the file sharing to work, to do this type:
sudo ufw disable
After this, the Ubuntu machine could see the Windows machine, but not vice versa. A restart of the Windows machine fixed it. Now, from the Windows machine, I could see the folder I shared on the Ubuntu machine. By ‘see’, I mean in Windows Explorer, clicking on Network, then the Ubuntu computer’s name. After moving a video file in the shared Ubuntu folder, I did a test stream of that file to my Windows computer. It worked well.
Remote Desktopping into Ubuntu from Windows
I can say I learned a bunch with this project. It wasn’t fun. Keep in mind I’ve never done any remote desktop or VNC stuff before. After trying a bunch of software, I found a combo that worked well. I won’t bore you with what didn’t work with my pea-sized brain.
On the Ubuntu computer, I installed X11VNC Server using the Ubuntu Software Center. In Windows, TightVNC seems to be the winner for VNC clients. Now begin hours of research to set these up. In X11VNC, you’ll need to create a config file: /etc/init/x11vnc.conf This file does a bunch of good stuff: 1. Auto-starts X11VNC when Ubuntu starts up, 2. Allows multiple login’s and logoffs (otherwise you can log in and off once and X11VNC shuts down), and 3. saves the X11VNC password. The file’s contents should be as follows:
start on login-session-start
x11vnc -shared -display :0 -auth /var/run/lightdm/root/:0 -forever -bg -o /var/log/x11vnc.log -rfbauth /etc/x11vnc.pass -rfbport 5900
Save that file. There are about a billion different customizable commands for X11VNC. Check them out here: X11VNC Command Line Options. The above script worked for me.
Next we need to create the referenced password file. In the terminal, type:
x11vnc -storepasswd YOUR_PASSWARD ~/etc/x11vnc.pass Make sure to change “YOUR_PASSWORD” to what you actually want your password to be. Remember this password because you’ll need it when VNCing into the Ubuntu computer from Windows 7. If that command string doesn’t work, try just x11vnc -storepasswd per these instructions.
Find out the Ubuntu IP Address by typing ifconfig in terminal. The IP Address will be up near the top in the ‘eth1’ block right after ‘inet addr:’. It would look something like inet addr:192.168.1.1
Now, back on the Windows 7 computer, open up TightVNC Viewer and in the ‘Remote Host’ area, type the IP Address of the Ubuntu computer and the port number. For example, it could look something like this 192.168.1.1::5900 Notice the IP Address and port number are separated by to colons “::”. Press “Connect” to remote desktop into the Ubuntu computer, you’ll be prompted for that X11VNC password you just created. The 5900 port came from the x11vnc.conf file we created. See, it’s listed after “-rfbport”.
Laptop Lid Shenanigans
The plan was to have this laptop tucked away out of site, and that means having the lid closed. Unlike Windows, Ubuntu doesn’t have a good GUI-based option for telling Ubuntu what to do when the lid is closed. Ubuntu defaults to ‘hibernate’. To change this setting, logind.conf needs to be edited by typing:
Open the /etc/systemd/logind.conf file in a text editor as root by typing:
sudo -H gedit /etc/systemd/logind.conf
Then add the line HandleLidSwitch=ignore . Then restart the systemd daemon with this command:
sudo restart systemd-logind
SickBeard, CouchPotato and SABNZBD
SickBeard is a program that searches for and facilitates downloading of your favorite TV shows. When a new episode is available, SickBeard will download it. CouchPotato is a similar program but for movies. Another program called SABNZBD does the actual downloading. Over at www.howtoforge.com there is a great tutorial on how to set these programs up. The process is not easy or intuitive but the tutorial makes setup a manageable task. Although the post was written towards Ubuntu 11.10, it was totally fine with Ubuntu 14.04. SickBeard and CouchPotato were set up to save the video files in the /home/user/video folder, the same folder that was made ‘network shared’ at the beginning of this post. That way, my media streamer will be able to see the newly downloaded content.
So now I’m considering my media server done… for the time being. The re-purposed old laptop has found a new life as my media server. It is tucked away out of site and consumes much less energy than desktop tower. I can remote-in if some sort of maintenance is required. And the best part is that my WDTV can play files located on the laptop and stream them to my TV.
An update before even posting this…
I was having a 50% success rate with my WDTV media streamer connecting to the Ubuntu laptop shared folders. This Linux noob doesn’t know why. In my search for a solution, I tried media server software Serviio, and installed it using these instructions. Those instructions left out an important part, Serviio needs Java 8 installed to run on Ubuntu. To install the needed packages, I did the following:
Install Java 8:
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
Serviio is a great software. The WDTV connects every time. Serviio has a bunch of ways to browse your media. You can go browse by file name, show/movie name and(but not limited to) my favorite: new unwatched additions.