I recently got my new from Element 14 and knew immediately what I wanted to do with it. The added USB ports plus the higher current rating makes this Pi the perfect home server. No longer do you need an externally powered USB hub, you can simply hook a USB hard drive directly to your Pi! In addition, I will have the ability to hook up a BlueTooth USB and/or ZigBee USB explorer to create my very own internet of things (not covered in this blog).
This blog will teach you how to get your Pi up and running as a home server as fast as possible. In the process, we are going to have several other tools installed, primarily Webmin -- allowing you to control and configure your Raspi remotely.
First, let’s take a look at the new RasPi
The new Pi comes with two additional USB ports (4 total), the standard Ethernet port, HDMI port, a MicroSD slot (instead of standard) and a headphone jack. You can purchase and check out it’s other specs here. One of the major differences from the previous versions is that it no longer has a VGA port, so investing in either an HDMI monitor or adapter is essential to follow this blog.
Parts you will need:
- A MicroSD card
- USB Keyboard
- USB Mouse
- HDMI Monitor + HDMI Cable
- 2A USB Power supply with Micro USB Cable
- USB HardDrive (I recommend at least 1 Terrabyte), formatted as NTFS (standard windows formatting)
The first thing you need to do is install Win32DiskImager and insert your MicroSD card into your computer.
The Raspberry Pi foundation has terrific documentation for how to install their operating system. I used and recommend installing Raspbian, but NOOBS should work as well (and may be easier for new users).
Once the operating system has been flashed onto your SD card, plug it into your new Pi. Also plug in your monitor, power supply (micro USB), ethernet, keyboard and mouse.
You are going to want to “Expand the root system” and then set your password to something at least reasonably secure (remember that people will be able to access this through the internet). When it asks if you want to reboot, say yes.
After reboot it will ask you for your username and password. Your username is pi, and your password is what you just set.
Once it is done doing it’s thing, type startx to start the GUI. You will now be met by a friendly OS screen
Note: I highly recommend you follow the rest of this tutorial through your Pi webbrowser. This will let you cut and paste the commands. Your browser window can be opened from the bottom left (near the start menu).
The first thing we are going to do is configure our Pi to be able to deliver more power to USB devices that we connect -- this is the whole point of this blog! To do this, open up LXTerminal
When you have it open, type:
sudo leafpad /boot/config.txt
If it asks for a password, type it in. Now go to the bottom of the file and add
(Note: eventually you will be able to add “max_usb_current=1” instead, but today is not that day. For now, this is how you increase the max current allowed to your USB ports)
Now save the file.
To get the settings to take effect you have to reboot. It is a good idea to do so now, as you want to check that your power supply can handle the load of an extra Hard Drive. I had an issue where I bought a crappy USB power supply that “was rated for 2 Amps”. However, it couldn't support the Pi + Hard Drive (in other words, it was not rated for 2 Amps).
Reboot your Pi (you can type reboot into your terminal) and then plug in your external Hard Drive. Open up your file manager (to the right of your Start menu) and you should see your external hard drive on the left.
Great! You are now doing what the Model B could never do -- your Pi B+ is supplying power to it’s very own hard drive! (Yay!)
Note: To double check things, try to create a new folder or document in your hard drive. If it doesn’t work, then your hard drive might be corrupted and need to be fixed by windows. Before you freak out, double check by typing sudo touch /media/<your harddrive name>/testing.txt -- If this creates a new file then great, if not then plug your hard drive into a windows machine and have it check for errors.
(Note: this is the tutorial I am following)
After you have finished celebrating, open LXTerminal again and type
sudo apt-get update
sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
It might ask you if you want to take up more space, hit “Y” for yes. Now type
sudo dpkg --install webmin_1.690_all.deb
This whole process will take quite a bit of time, but when it is done it will display a message telling you to open
Open whatever link it tells you to in your browser (not on your computer, but on your Raspi). Use the user name “pi” and the password you have been using.
This section is not necessary, but some people will appreciate it.
What we want to do now is be able to communicate with your Pi from another computer. To do this, we need the ISP address of your RasPi. There are many ways to find an ISP, but the fastest that I found out is to simply do it through the webmin interface on the Pi itself.
To find your IP address, simply log into Webmin on your Pi and go to Webmin -> Webmin Servers index -> Scan for servers in the menu on the left. It should give you a message like “Found this server at https://192.168.0.11:10000/” -- simply type that address into the browser on another computer (connected to your network) and you will be in headless mode!
Note, when you type it in you may be greeted by a screen like the one below. Hit “proceed anyway”
Configuring your Home File Server
Now we are going to get our home file server set up. The first thing you want to do is go to “Un-used Modules” in the webmin interface on the left. Then click on “Samba Windows File Sharing”. It will say something like:
The Samba server executable /usr/sbin/smbd was not found. Either Samba is not installed on your system or your module configuration is incorrect.
The Samba package can be automatically installed by Webmin. Click here to have it downloaded and installed using APT.
Click on the “click here” link and it will be installed for you. (This will take several minutes so be patient)
While that is installing, take a look at your external hard drive and decide if you want to share the whole drive or just a specific folder. If you want to share a whole drive, then leave it the way it is. Otherwise, you should create a sub folder and put the files you want to share in it.
When the page says that Samba has finished installing, go to Servers -> Samba Windows File Sharing
Before we go forward, we are going to have to create users for Samba. In the Pi terminal
sudo useradd user
sudo passwd user
# type in a suitable password for other people to access the network
# create a main user in samba
pdbedit -a -u pi
# use the same password you use for logging in
# create a standard user
pdbedit -a -u user
# use the password for other people to access the drive
# now we have to give the user permissions to access the folder
sudo chmod 777 /media # gives broad permissions
sudo chown -R user /media # makes the user the owner
We only have a few more steps to go! From the web interface, click on “Create New File Share”
Your settings should look something like this (feel free to name your drive whatever you want)
Hit create, then immediately hit the name of your new server in the list (under ShareName). Go to “Access Control” on the bottom left and make sure to check the radio button to make “Writeable?” = Yes. Hit Save and then Save again.
Now, if you are running Windows you will need to “Map Network Drive.” In Windows 7 this is done by going to My Computer -> Map Network Drive (on the top bar). I believe on most windows versions you can also do it by going to Network Places and then right clicking on the folder you want to map. Name your drive an appropriate letter (I chose R: for Rasberry!)
It should pop up with a login screen asking you to log in with username pi, opt instead to log in with the user username we created, as well as the password. This is what your friends and family can all use to have access to your drive!
That does it! You now have a network drive running off of just your Rasberry Pi B+
Speed and Video Streaming Ability
I have tested that the Raspi can easily stream movies to your computer at 1080p. I tested this by downloading a 1080p file from here and opening it in VLC. It has no lag. Furthermore, the 25 second video transfers to my computer in about 10 seconds!
To transfer a 294 MB file took about one minute 50 seconds, an average transfer rate of about 2.7 MB/s. The file would transfer in chunks of about 30-50MB and then pause for several seconds -- I'm not sure why it has this beheavior.
That file (a 780p video file) opened quickly with VLC and works great (no pauses or any issues in the first couple of minutes of me watching it).
I would say this is a great home media platform, provided you don't have too many people watching movies at once. My family doesn't watch a ton of movies, so maybe someone can follow the blog and talk about their experiences in more depth.