Saturday, 2 November 2013

Setting up a Raspberry Pi as a home server

A lot of people have spoken about the potential uses for a Raspberry Pi, however a lot of these are often very specific to be of use to anybody other than the project creator (using it as part of a home made weather balloon system for example).  When I purchased my Raspberry Pi it was for a specific purpose; the old PC that I used as a home server had given up the ghost and I needed a replacement.  The Raspberry Pi seemed like the ideal answer as it was small and used a lot less electricity (a big plus for a piece of equipment that is going to be on 24/7).

Before we start there are a few things you will need:

  • A Raspberry Pi
  • A computer with internet access 
  • Raspian linux distro
  • An SD Card (4GB minimum)
  • An SD Card reader/slot on your computer
  • External USB hard drive (this will need to be large if you plan to have video and music files on it, I recommend about 2TB minimum)
  • Micro USB charger (my old one from a previous Android phone did the job)
  • A wired USB keyboard
  • An ethernet cable
  • An HDMI cable
  • A monitor/TV with an HDMI connection

1. Firstly we are going to need to install Raspian onto the SD card, for full instructions on how to do this I recommend reading this how to guide. However I kept it simple and used the command line on my Linux system.

Firstly we need to extract the file out of the Zip archive.  Navigate to the place where the downloaded file is and enter the command:
unzip {thefilename}

As these change every time a new version is released the command will alter depending on the image that has been downloaded.

2. Now to get the image onto the SD card.  I needed to use the bs=1M option in the command as the install failed twice with bs=4M, it stated that it would take 'considerably' longer, but the whole process was still fairly quick:
dd bs=1M if={location of raspian.img file} of={location of SD card}

If your not sure what the location of the SD card is then make sure it is removed from the computer and in the command line type:
df -h

Then insert (and mount) the SD card and retype the command:
df -h

There will be an additional item on the list:

In the example above the location of the card is /dev/sdc, we ignore the number as this refers to the partition.

3. Once the process has been complete, unmount the SD card and insert it into the Raspberry Pi.  Connect your keyboard and external hard drive via the USB ports and then connect the Pi to your router and TV before finally giving it power.

4. When you first power up the Raspberry Pi you are asked for some initial settings:

Firstly we'll want to expand_rootfs, this means that we'll be able to use the entire SD card if we ever need to.

We need to know the password, so the next thing we'll do is change the password, to do this simply select change_pass and enter in your new password.

configure_keyboard, change_local and change_timezone allow the user to set the keyboard layout, the location and the local time zone (these are all UK by default).

As this is a server we won't have it connected to a monitor for the majority of
it's life so make sure that we do not start the graphical desktop on boot, boot_behaviour changes this setting.   Although this may look nicer, the Raspberry Pi has limited power and we want this to focus on sharing our files over a server, not looking pretty.

5. To allow us to share our files over a network we will install Samba:  
sudo apt-get install samba

6. To find UUID and the file system of the drive, enter:
sudo blkid

This will give an output similar to the one below:

We can ignore the line that has the TYPE="fat32" as this is the SD Card, take a note of the other line, you need the UUID and the Type, the labels aren't important at this point (depending on the formatting some drives may not have a label)

7.  We need to mount this drive automatically whenever the Raspberry Pi is switched on. Firstly, we'll need to create a location to mount the external hard drive, we can do this by using the command:
sudo mkdir /media/external

Now we need to edit the fstab to tell the Raspberry Pi to automount the external drive every time it is switched on
sudo nano /etc/fstab

Insert the following line at the bottom of the page:
UUID="{the UUID you noted down in step 6}"     /media/external    
{type noted in step 6}     auto,user,rw      0     0

The above should all be on one line, pressing the key to create a gap between each piece of information.

8. Now we need to set up which folders are going to be shared.  I'll assume that we are going to make the whole of the external drive available over the network
nano /etc/samba/smb.conf

at the bottom of the page add the following, note that you can call this anything you wish, just exchange the word external but you must include []
path = /media/external
available= yes
browsable = yes
public = yes
writable = yes

It's worth noting before we continue that I've set the option writable - yes, this means that you can add to or remove the contents of the external drive over the network.  If you are not comfortable having this option then simply change it to writable = no. Now save and exit (ctrl + X), make sure that you answer 'yes' to save your changes. 

9. We will now set the Raspberry Pi to log in automatically on startup, if the user Pi isn't logged in then all of things we've just set up will not work. Type:
sudo nano /etc/inittab

navigate down to the line:
1:2345:respawn:/sbin/getty --noclear 38400 tty1 

and add --autologin pi after getty to make the line:
1:2345:respawn:/sbin/getty --autologin pi --noclear 38400 tty1

save and exit (ctrl + X) make sure that you answer 'yes' to save it.

10. We're going to need one more piece of information before we finish.  I've had trouble in the past browsing Samba share folders using assigned names rather than IP addresses.  So to find the IP address of the Raspberry Pi type
ifconfig eth0

You'll be given a an output similar to what is shown below:

The part that is circled in orange (inet addr) in the above image is what you need to note down.  We'll need this to test the share drive later on.

11. We can try it out our system and auto-login by using the command
sudo reboot

Assuming that everything goes well, your system should be up and running.

Lets try this out on a different computer or device.

Load up your chosen file manager, most have location bar at the top (similar to the address bar on a browser).  Enter the following in the location bar: smb://{your Raspberry Pi's IP address from step 10}

You should now be able to access the files on the external hard drive connected to your Raspberry Pi.

Congratulations you've now set up your home server.

Monday, 28 October 2013

Installing Linux on Acer XC600

I was recently given an Acer XC600 machine with the instructions "Install a Linux system on this machine, I hate windows 8 and have already deleted it."

Whenever I'm given a challenge like that I am always quite happy to introduce somebody to Linux, but I didn't quite realise what a challenge it would be.

The main problem is that a lot of new computers are being sold with secure boot and it is enabled by default.  The official line from microsoft is that it is to stop any malware loading up at the time of boot and make your system more secure.  However after wrestling with this system for more than a week, I am not convinced.

There is a specific order which you must switch secure boot off otherwise it will not work, the annoying part is that it will let you boot up the liveCD and install the system, but upon restart the system will never load, giving a device error message.

Here are the steps, I seriously hope that this helps and avoids the huge amount of time I wasted on this relatively simple task.

1. Upon switching the computer on hit the delete key, this will take you into the bios

2. Go to security and change secure boot to "Disabled"

3. On the boot option, make sure CSM is "Enabled"

4. In advanced, go to "integrated peripherals" and change the SATA option to IDE (regardless of the actual hardware in the machine)

5. Save and exit bios

You will now be able to install a Linux distro from a CD, DVD or pen drive as before on the Acer XC600.

image realeased under creative commons and taken from
Free your PC to install Linux

Tuesday, 2 July 2013

Updated: MP3 files in Debian

A lot of new users move from Ubuntu to another Debian based distro to limit the ammount of change they experience. But often can be a bit daunted by the challenges that Ubuntu made easy for them. One such is music files in MP3 format.

Whilst I personally use Ogg Vorbis and would encourage all others to, I am realistic that a lot of people still want to use their MP3 files and even build up their collection.

*If you are unsure what the term "as root" means then simply add sudo before each command that requires root privileges, you will be required to enter your password as sudo is a powerful tool*

Playing MP3 files

For playing MP3 files, the quickest method is to download VLC player. This is available from the software repositories from the majority of distros. This can be installed very easily:

1. Open the terminal

2. As root type: apt-get install vlc

This now gives you a player.

Ripping CDs to MP3 format

Should you want to rip your CDs to MP3 format then we still have another few steps to take.

1. Open the terminal

2. As root type: apt-get install sound-juicer

This gives a program that will rip the music from a CD and save it onto the computer. We can load it up from the main menu (usually listed under the multimedia or sound and video), called Audio CD Extractor.

If we open this up and click on edit and preferences we should be greeted by a window as shown below:

Down near the bottom of the window we should see Output Format, this by default is set to CD Qua;ity, Lossy (.ogg type). At this point if we click on this it will not give us the option of MP3. We still have a few more things to do.

The package we need is not available in the Debian repos due to Debian's commitment to free software. But we can add this. We need to go back to our terminal.

3. As root type: nano /etc/apt/sources.list (if you are met with the message unknown command nano, then you can retype the command replacing nano with gedit)

4. Decide what repos you would like to add:

Stable: deb stable main non-free
Testing: deb testing main non-free
Unstable: deb sid main non-free

Add only one of the above choices, just type the part in bold to the end of document.

5. Exit the file by pressing Ctrl + X, it will then ask you if you wish to save press y and then hit return twice.

This will add the repos to our system, but we also need to have the keyring before the repos will work.

6. Download the Debian Multimedia keyring, as of Debian Wheezy (the current stable version) it is in the repos.  As root, type: apt-get update

7. Navigate to the directory and, as root, type: apt-get install debian-multimedia-keyring

8. as root, type: apt-get update

9. as root, type: apt-get install gstreamer0.10-lame gstreamer0.10-plugins-ugly

That's it.

To check it has worked open up Audio CD Extractor again, click on edit and preferences. This time when we click on Output Format, MP3 should be an option.

Enjoy your music.

Saturday, 29 June 2013

Cassette Tapes: given a new life

In recent times vinyls (or records as I referred to them in my younger age) have shown signs of resurgence, CDs are still readily available and the digital format is quickly becoming the standard choice for many people's music. However there appears that there is a forgotten player in the music world: the cassette tape.

For the decade of the 80s, the cassette was the main format that the majority of consumers used to listen to their favourite bands, but with the 90s came the CD and by 1995 cassettes were scarcely seen on the majority of supermarket shelves, although they could still be found in dedicated music shops until 2000, but by then they were clearly old news.

Although I Luke music in general, mainstream artists that are constantly played on the radio, TV and appear regularly in the charts do not appeal to me. Rather I like to discover unknown artists through browsing sites such as Jamendo and Bandcamp. I was extremely happy to see recently that indie artists are starting to sell their music in cassette form, albeit in very limited numbers (usually 100 copies). But instead of simply flogging a dead horse, these indie artists are offering the tracks in digital format along with the physical cassette. If the purchase is made through Bandcamp then buyer is offered an immediate download, however with some of the other music sites the cassette includes a download code printed on a card that comes in the tape cover.

Whilst many people may see this as pointless and simply a way of hanging onto the past, the sale of cassettes does offer some advantages for the indie artist. Firstly the limited number means that the artist/band isn't investing a huge sum of money. Secondly an artist selling the cassette stands out from the crowd, it offers the consumer a trip down memory lane as well as also giving them the digital form to sync to their media players. Thirdly tapes aren't likely going to be copied. I'm not saying its impossible, all you need is a USB cassette deck, but the process is slow and the quality is considerably poorer than the files produced by a CD rip or the audio files offered by the majority of music sites. Most people don't have twin deck cassette players any more and blank cassette tapes aren't as readily available as they once were.

So when you look at this from this aspect it, then cassettes may be around, in limited numbers, for a while yet. They're not going to be flooding the market, but there's still some life in them yet.

Monday, 15 April 2013

CCJam - Community podcast

It is with a sense of eager anticipation that I announce the news of a new community podcast: CCJam.

CCJam has been released as part of the Unseenstudio Podcast Network, but it is quite different to the other podcasts on the network in that it is non-techy, this is a music podcast.

The aim of CCJam is to promote independent artists/bands, but the major difference with this project is that it is to be community run, this is not simply another podcast featuring Kevie.  Each episode is made up of two music tracks with the talk being submitted by individual show hosts.  The talk doesn't have to be too lengthy, just introduce yourself and the band, then where the listeners can go to listen to more tracks or to find out some further information.  Your welcome to talk about anything else in the show, it's up to you.

In order to make this as easy as possible for everybody, I have broken it down into three steps:

1.  Find a band that you wish to promote.*

2. Record your talk about the artist (no need for anything fancy, this may even be on your smartphone)

3. Email me (ccjam at unseenstudio dot co dot uk) the file along with the links for the tracks

That's it!!! I'll do the rest. The show will be released on the Unseenstudio website and it will be added to the subscribers feed automatically.  In order to make the show accessible to as wide a range as possible it is available in both Ogg and MP3 format.

*If the band releases their music under a copyright license then please have a band member email me with permission that CCJam is allowed to play their music.

Friday, 22 March 2013

IRC: problems authenticating your nickname

I have been using IRC now for a number of years and encountered a problem recently that I had not come across before. If your on IRC channels (eg Freenode) frequently then it is a good idea to register your nickname, this ensures that nobody else uses it or tries to claim to be you. This can be done in 4 simple steps:
  1. /msg nickserv register {your password} {your email} 
  2. /msg nickserv set hidemail on 
  3. Check your email and follow instructions 
  4. /msg nickserv identify {your password} 
For step 4 you will probably find a way to set this up automatically if you use an IRC client.

Recently I noticed that I was unable to log on using my registered nickname and found myself being logged in with an alternative.  I was continually greeted with the message "nickname temporarily unavailable

Should you be given the same message then there is an easy workaround:

  1. Log onto IRC using your preferred client
  2. /msg nickserv register {your nickname} {your password}
  3. /quote nickserv set enforce OFF 
  4. /quote nickserv release {your nickname} {your password}

After completing these 4 steps, quit your IRC client and then re-start and you should have your old IRC nickname back.  Happy chatting.

The Humble Weekly Sale

The Humble Bundle has been on the go for a while now, offering a selection of games on a "pay what you want" basis, which is available for a limited period only.  Not only are these games cross platform, DRM free but also part of every donation goes to help a charity.

They have now just launched the first of the Humble Weekly Sales, and what a title to begin with: Bastion an RPG-action game.  If you would like to find out more about the game then watch the promotional video below or go to the Humble Weekly Sale website.

The plan is that a new game will be launched every Tuesday with added incentives for those who are willing to donate more of their hard earned cash.

This shows that the market for indie gaming is alive and well in a very difficult economic time.