Monday, 31 December 2012

Everyday Linux User Guide To Setting Up The Raspberry PI

Posted by Gary Newell  |  at  00:54 7 comments

Introduction


If you are reading this article then it is highly likely that you have bought a Raspberry PI or you are thinking about buying a Raspberry PI.

This is essentially a setup guide for the Raspberry PI for the ordinary person. There are lots of other Raspberry PI guides on the internet but this guide really is for the layman setting up the Raspberry PI for the first time. 

What you will need


Depending on where you bought your Raspberry PI you may or may not already have some or all of the items you need but you will almost certainly have received the Raspberry PI unit and a power cable. (Mobile Phone Style Power Supply).

The Raspberry PI comes with 2 USB Ports but it is worth investing in a powered USB hub. The price of a powered USB hub is around £10 to £15. 

To display the output of from the Raspberry PI you will need a monitor or TV. It is better if the output device is a HDTV or monitor but you can also connect using an RCA cable. Obviously to connect the Raspberry PI to the output device you will either need a HDMI cable or RCA cable.

You will need input devices to communicate with the Raspberry PI. The old fashioned way of communicating with a computer is with a keyboard and a mouse therefore it is a good idea to obtain a USB keyboard and mouse.

If you plan to connect to the internet using a wired connection then you will need an ethernet cable, however, if you plan to connect wirelessly to the Raspberry PI then you will need a wireless USB dongle.

Finally but most importantly you will need an SDHC card as this will be used to store the operating system. A class 10 SDHC card works well. The size of the SDHC card obviously depends on your requirements but a 16 gigabyte card is a good size.

Installing the operating system

This installation guide assumes that you will be installing the Raspbian operating system as this is the preferred option for new users. There are a number of other really good operating systems for the PI but for newcomers it is worth trying out Raspbian first.

If when buying your Raspberry PI you also bought an SDHC card with an operating system pre-installed then you can move on to the next section.

To continue you will need an SDHC card and a computer with an SDHC card reader. You will also need an internet connection and either Windows or Linux.

Downloading Raspbian

Visit http://www.raspberrypi.org/downloads and download the Raspbian Wheezy image either as a torrent or via direct download. (If you do not know what a torrent is I recommend going for the direct download but a torrent is likely to be much quicker. It is worth reading up on the subject of torrents but this is really out of scope for this article).

Setting up the SDHC Card

Windows

If you are using Windows then when you insert the SDHC card into the reader it should be recognised straight away.

Open Windows Explorer (From Windows 7 press start, type explorer and click Windows Explorer. there may a folders icon in your quick launch bar next to the start button which will also open Windows Explorer). 


Look at the list of drives and right click on the SD Card and select format. The capacity of an SD card may not show the correct size especially if it has been used before and already contains an operating system. Do not worry about this.

Make sure the file system is set to FAT and select quick format. Press start. A warning message will appear asking whether you are sure. Click OK to continue. When the process is complete a message will appear saying so.

The Raspbian Wheezy image downloaded earlier will need to be extracted from the zip file. To do this open Windows Explorer again but this time go to the downloads folder. (It is listed under favourites). Find the file that you downloaded (Probably named something like 2012-10-28-wheezy-raspbian). Right click the file and select extract all. Choose a folder to save the files to and press extract.

The final step is to copy the image onto the SDHC card. In Windows you will need a piece of software to do this. Unless you have something better go to https://launchpad.net/win32-image-writer/+download and download the win32diskimager-binary.zip.

Go to the downloads folder in Windows Explorer again and extract all the files in the zip file just downloaded (right click and select extract all). Run the file Win32DiskImager,exe,

A warning message will appear asking whether you are sure you want to run this program. It is ok to select yes.


When the Win32 Disk Imager screen appears click the folder icon and find the Raspbian image file extracted earlier.

Change the device letter to the drive letter of the SDHC card (Make sure you get this bit right. If you are unsure open Windows explorer and double check). 

Click Write to write the image to the SDHC card. Click Exit when the process is complete.

You can now move onto the next section.

Linux

Open up the downloads folder and extract the zip file.

As this website is all about Linux for the everyday linux user the method I'm going to show here assumes you use graphical tools. If you prefer to use the terminal follow this guide to format an SD card and follow this guide to copy Raspbian to the SD card.


Run the Gnome Disk Utility and select the option to format the drive. Now select restore an image and find the file downloaded previously.


Click the image to restore and then select start restoring.

(NOTE: If the drive has mounted automatically there will be an error. Unmount the drive and try again).


An alternative to using the disk utility is to use the Ubuntu ImageWriter utility. Within the Ubuntu Software Center search for imagewriter.

Once the imagewriter software is installed run it and choose the image you wish to write and the drive you wish to write to. Click write to device.

Setting up the Raspberry PI



Before setting up the device it is worth knowing which bits go where. 

If you look at the image above the yellow socket is the RCA socket. The HDMI port is on the opposite side.

On the left hand side of the Raspberry PI are the 2 USB ports and an ethernet port. The power socket is at the opposite end to the ethernet port.

The SD Card goes into the space next to the power socket.

To set up the output device either insert an RCA cable into the yellow socket and the other end to the tv/monitor or insert an HDMI cable into the HDMI port and the other end into the HDMI port on the tv/monitor.

If you have a USB hub connect the hub to the USB port on the Raspberry PI using a USB cable. Now insert the USB keyboard and mouse into the USB ports on the USB hub. (If you are not using a hub insert the keyboard and mouse into the USB ports on the Raspberry PI).

To connect the PI to the internet you will need to connect via Ethernet or Wireless USB. If you are connecting via ethernet connect the ethernet cable to the ethernet port on the Raspberry PI and insert the other end into one of the ethernet ports on your router. If you are connecting wirelessly insert the Wireless USB dongle into the USB hub (You will need a hub for this otherwise you will have run out of ports).

Finally connect the power cable to the power socket on the Raspberry PI. Insert the plug for the Raspberry PI and the USB hub into the wall. Turn on the tv/monitor and press the power switches on the power sockets.

The Raspberry PI should begin to boot up.

First Boot

Upon the first boot you will be shown a blue screen with a menu in a white box which is essentially called the Raspi-config. 

Expand root partition


The first thing you will want to do is choose the second option which is to expand the root partition to fill the SD card. This will make the whole SD card available to Raspbian therefore utilising the entire disk space. To select the option press the down arrow until the expand_rootfs option is highlighted and press enter on the keyboard. Some text will scroll up the screen and then a message will appear stating that the system has been expanded.

Note that if you do not expand the root partition only 2 gigabytes will be assigned to the operating system and at some point in the not too distant future you will see an awful message about there being no space left on your root partition and the graphical desktop will fail to load.

Keyboard Layout

The configure_keyboard option enables you to set the keyboard layout. Choose the make and model of keyboard from the list. (If you cannot find your make and model choose a generic keyboard with the same number of keys as there are on your keyboard). Now select the keyboard language layout. (IE English - UK). 

The next screen asks which key should be used as the ALT GR key. It is up to you which key you map it to if any. A similar screen then appears for a compose key.

Finally you can set Raspbian to exit to the terminal (terminate X) when the key combination of CTRL, ALT and Backspace are pressed together.

Change Password

If you are going to connect to the internet it is a good idea to change the default password for the PI user.

Scroll down to change_pass and press enter. Enter the password twice to change it. 

Locales

To set the Raspberry PI to your particular locale select change_locale. Find the locale that is relevant and press OK.

Timezones

To choose your timezone select change_timezone and then choose your geographical area.

Now choose a city that is in your timezone.

Memory Split

The Raspberry PI comes with 512mb of ram. The memory split option determines how much memory is used for processing graphics.

If you are intending to use your PI for games such as retrogaming then you will need to supply at least 128mb ram. If you are going to use your PI as a web server or for other less graphic intensive functions you can set the number to a lower amount.

As the raspberry pi config can be set at any time you can change this option as required at a later date if you get it wrong the first time or your requirements change.

To change the memory split choose the memory_split option and press enter. Now enter in megabytes the amount of ram to use for graphics.

Overclock

When chips are tested in the factory they are tested under certain conditions and so a 700mhz machine is the maximum the chip was tested at by default. The chip itself might work perfectly at a higher rate and so overclocking enables you to use the Raspberry PI at a higher rate than it was tested against. 

You can therefore get more performance out of your Raspberry PI by overclocking it. There is of course a downside. The life of your Raspberry PI may be shortened by overclocking it.

To overclock choose the overclock option in the config and press enter.  You can now choose how much you want to overclock the PI to. There are 5 options: None, Modest, Medium, High and Turbo.

I would recommend leaving this option alone unless you really need more grunt and you are the type of person who throws caution to the wind. (Hey it is only £35 for a new one).

SSH

If you are going to use your Raspberry PI as a server of some kind then you might not want to leave it permanently connected to a monitor and input devices such as a keyboard and a mouse.

SSH enables you to connect to the Raspberry PI from other devices via the terminal.

It is definitely worth enabling SSH. Go down to the SSH option and press enter. Select enable if it isn't already set.

Boot Behaviour

By default Raspbian boots to a graphical interface which is great if you intend to use the PI for connecting to the internet and making games with Scratch but if you are going to use the PI as a server then you may not need the graphical desktop to load every time.

For new users I would recommend leaving the graphical desktop enabled but if you want to turn it off scroll down to boot_behaviour option and select no.

Update

Finally if you wish to you can update Raspbian to the latest version. It is probably worth waiting until you have an internet connection before doing this and so you should probably come back to this at a later stage.

Finish

When you have finished setting config options select finish. The system will reboot and the SD card will be resized to use the full disk. 

The system will then boot into a graphical desktop (if you chose to have the graphical desktop) and your Raspberry PI will be ready to use.

Remember you can run the raspi-config at any time by selecting it from the menu in the graphical desktop or by typing raspi-config in the terminal.

Summary

Your Raspberry PI is now ready to use. If you had any problems setting up your Raspberry PI feel free to ask questions in the comments or visit the Raspberry PI forums at http://www.raspberrypi.org/phpBB3/

The next article will show you how to connect to the internet and how to use SSH to connect remotely to your Raspberry PI.

I hope you found this guide useful.


7 comments:

  1. Great, comprehensive and comprehensible guide. one thing I would recommend for the pi is to use a wireless keyboard and mourse combo. This will use less power, and free up a USB slot. Some mice have caused my pi to freeze, and it was thought to be a power issue....wireless combo option sorts that.

    ReplyDelete
  2. Nice one! What kind of browsers are available for ARM at the moment? Do they have flash support?

    ReplyDelete
    Replies
    1. The flash answer is covered in this forum http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=19862. The answer is really no but you can watch youtube videos by using xbmc.

      On the browser front the default option is Midori but you can install chromium and others if you wish to use them.

      Delete
  3. Bravo!!
    Very well done and easy to understand for someone even without tech knowhow.

    The success of the Pi can only come if non-tech users can learn on their own.

    Its nice if you have a cool uncle who knows computers and can help kids along or maybe some school teacher but what about all those kids whose parents dont grok Linux or geekspeak?

    I expect a pedagogically sound program from the RPi foundation to deal with this. That way a child who receives the 120$ gift of learning (which is what the Lady Ada company is selling the kit for. All those little things you need add up quickly) can learn without an adult with tech knowhow.
    With easy instructions like this and then a series of online/offline videos and tutorials to cover the basics and then a teaching plan which offers series of experiments and exercices which will teach children on their own as they progress.
    THAT is why Im excited about RPi.
    The low price point is nice but its the chance to teach a new generation of kids that is the big prize that Upton talks about.

    You are doing a great job in making the Pi accessible to those that might not have the knowhow.

    Good stuff.

    kushi

    ReplyDelete
  4. Thanks for this post!

    ReplyDelete
  5. Great article. Thanks a bunch. I've been considering buying a Pi. Bookmarked your article for reference.

    ReplyDelete
  6. Hi great article but i am still confused as to why "pi@(none)" appears in my LXTerminal instead of "pi@(username)" , any help would be appreciated!

    ReplyDelete

Feel free to comment on any of the blog posts. Please try to be constructive.

Offensive messages will be removed as will blatant adverts for misleading products and sites.

Thanks for visiting my blog

    Popular Posts



back to top