Nothing stays the same in the Raspberry Pi world for long; with all the support of a great community behind it things just keep on getting better. With that in mind I though it was time for a new getting started tutorial rather than keep patching up the old one. This is the updated guide to using the Raspberry Pi.
This guide is aimed at helping newcomers to the the Raspberry Pi (or Linux in general) get up and running with their fantastic new toy and move on to the fun stuff.
I’m going to assume you have the Model B (any of them) and some form of Windows. We’ll be using NOOBS (New Out Of the Box Software) to download and install the latest version of Raspbian (Debian Wheezy).
The Raspberry Pi in an incredible and powerful tiny computer. But do we really want to bulk such a nice unobtrusive PC with a monitor, keyboard and mouse? Perhaps; but I much prefer to have mine hidden away behind the router. With that in mind we’ll be giving your Pi a static IP address and using it over the network from your PC or Laptop.
What you need
You’ll need the following bits and pieces:
- A Raspberry Pi of course. Head over to Farnell/element14, RS Components, ModMyPi or Adafruit pick one up. I’d strongly recommend the Model B as this has an Ethernet port for easy access to your home network
- A compatible SD Card. Not as important as it once was, support has vastly improved. However be sure to checkout the list of compatible SD cards over at eLinux. Or buy a bundle with compatible card (some come with Linux pre-installed). Go for a 4GB card minimum
- Micro USB Power Cable. Any micro USB cable or phone charger will do, or pick one up when you purchase the Pi. You can power it from mains, computer/TV USB port or even one of those portable USB power supplies!
- TV/Monitor* with either HDMI or Composite in (HDMI highly recommended)
- USB Keyboard and Mouse*
* The TV/Monitor, Keyboard and Mouse are semi-optional. If you have the Model B Raspberry Pi we can remote desktop into the Pi from any Windows or Linux pc/laptop connected to the network. We’ll just need the TV keyboard etc to do the initial setup.
Installing NOOBS on your SD card
Top Tip!If you’re trying to reuse an SD card and it’s showing a different size than it really is. You can reset all the partitions and restore the original size by inserting the card into a digital camera and formatting it. Or check out our guide on recovering lost space from an SD card.
NOOBS (New Out Of the Box Software) is great bit of software that allows you to easily install and manage the latest versions of the many supported Raspberry Pi Operating Systems.
There’s 2 versions of NOOBS; an offline version and a network only version. We’re going to use the network only version as it will automatically download the latest release of of chosen Linux distribution. If you’re not going to have internet access when you setup the Pi later, then feel free to download the offline version.
Setting up your SD card
- Insert your SD card into your SD card reader (make sure you take note of the driver letter Windows assigns it). Note you will lose all the software on the card
- Head over to the SD Association website and download the SD Card Formatter 4.0. This will download a file called SDFormatterv4.zip. Unzip and run setup.exe; follow the prompts to install. Once installed find the SDFormatterentry in your start menu and run the program
- Make sure the correct drive letter is selected and hit Format
Installing NOOBS on your SD card
- Head over to the Raspberry PI Downloads page and download NOOBS (Network install only)
- Unzip to your SD Card (or unzip locally and copy the files across to your SD card – note you should copy all the files directly to the root directory of your SD card, don’t copy any NOOBS_lite_vX_X_X folders across, just the contents)
That’s it! Easy huh? Now insert the SD card back into the Raspberry Pi. Connect your keyboard/mouse to the Pi and the HDMI cable from the Pi to your TV/Monitor. Connect an Ethernet cable from the pi to your Router. Finally connect the power.
Installing a Linux Distribution (OS) with NOOBS
After connecting the power you should be greeted with the NOOBS main menu. We’re going to be installing Raspbian, a distribution based on Debian Wheezy. Select Raspbian [RECOMMENDED] and then click install (i).
Accept the warning about losing data, sit back and watch as your SD is setup and the OS installed. Nice and easy.
Once complete you’ll see the message OS(es) Installed Successfully. Click OK to restart and boot into your OS.
If you’re having issues check you gave the Pi internet access. Try plugging the Ethernet cable into a laptop or another PC and making sure you can access Google etc.
But NOOBS is too easy! How do I install an OS the hard way?
Head over to the Raspberry Pi Downloads section to grab the latest Raspbian image.
You’ll also need Win32 Disk Imager to write the downloaded image. Make sure you click on the right download and not one of the annoying ads made to look like the download (you should always stay on http://ift.tt/VSeG5p).
- Unzip the Linux image
- Run Win32DiskImager (if you have issues right click and run as Administrator)
- Select the *.img image file you unzipped
- Select SD card Drive (make sure its the SD Drive and not c: or any other drive you need)
- Click Write
- When done remove the SD card and insert into the Raspberry Pi
Note: if you need to reuse the SD Card in Windows again you may find it can’t be read or shows a very small capacity. If so you need to re-write the file system. Check out my Top Tip above.
Accessing NOOBS after First Boot – Recovery Mode
To access NOOBS after first boot simply hold down shift as you power on the Pi. This is called Recovery Mode.
Configuring your Raspberry Pi with Raspi Config – First Boot
The first time you boot up into your new Raspbian distro you’ll be greeted with the Raspberry Pi Config Tool (aka raspi-config). This tool allows you to easily change the most common configuration settings. Let’s start with the ones you’ll want to change right away.
- 1 Expand File System: This will expand the file system to the full size of your SD card; allowing you to use the full capacity for programs etc (note if you used NOOBS as I did, your file system will already be set to the full size of the SD card, NOOBS handles all that for you during install)
- 2 Change User Password: Change the default password!
- 3 Enable Boot to Desktop/Scratch: The default setting for Raspbian is to book to the Terminal (command prompt). Select Desktop Log in as user ‘pi’ at the graphical desktop to enable booting to desktop as the default
When you’ve finished select Finish. You’ll be asked to reboot now, select Yes. You will now be rebooted into the desktop. If you’re not asked to reboot, checkout the useful commands section below for rebooting from the command prompt.
Raspbian Default Username and Password
Username: pi Password: raspberry
Giving your Raspberry Pi a Static IP Address
Top Tip!To see TCP/IP information in Windows you use; ipconfig. In Linux use; ifconfig.
So we can always find your Pi on the network, we’re going to give it a Static IP address. If you’re not sure what your local network range is open a command prompt from a Windows PC.
Start > Run and enter:
cmd
Now type:
ipconfig
You should see something like:
IPv4 Address. . . . . . . . . . . : 192.168.1.137 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1
We give the Pi the same details excluding the last 3 digits of the IPv4 Address. Let’s make it easy to remember:
192.168.1.150
Back in the Raspberry Pi start a Terminal window (there’s a shortcut called LXTerminal on the desktop). Type:
sudo nano /etc/network/interfaces
This will bring up the network interface configuration file in the nano text editor. The word sudo simply runs this command with super user privileges (you may be asked to enter your password).
You should see something along the lines of:
auto lo
iface lo inet loopback iface eth0 inet dhcp
allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
Change the following line:
iface eth0 inet dhcp
To read (your IP information may be different depending on what you saw using ipconfig on your Windows machine):
iface eth0 inet static address 192.168.1.150 netmask 255.255.255.0 gateway 192.168.1.1
Use Ctrl X to exit. Hit Y when prompted to save.
Now restart the network interface to apply changes without a reboot:
sudo /etc/init.d/networking stop
Followed by (can you guess?):
sudo /etc/init.d/networking start
Now your Raspberry Pi will always have the same IP address. Try pinging it from the Windows command Prompt:
ping 192.168.1.150
Installing Tight VNC on the Pi
We’re going to use Tight VNC here (server on the Raspberry Pi and Viewer on Windows).
There’s an excellent tutorial over at elinux if you need more information.
First of all install the Tight VNC Server from the Linux Terminal:
sudo apt-get install tightvncserver
Let it finish installing (if you’re asked to confirm anything, just hit ‘y’ on the keyboard). When complete start the server:
tightvncserver
You’ll be asked to create a password, enter one and confirm. I used raspberry for ease of use, but probably not the most secure! You’ll only be asked to do this the first time you run vnc server.
When asked to create a view only password, say No.
Every time you start VNC you’ll see something like:
New 'X' desktop is raspberrypi:1
Note the :1. This is the desktop session created. You can add more by running tightvncserver again.
You can force the resolution and colour depth of your VNC connection:
tightvncserver -geometry 1024x768 -depth 24
Head over to TightVNC on your windows box and install the viewer.
To connect run the VNC Viewer and enter:
192.168.1.150:1
Where the IP address matches the one entered before and :1 matches desktop session.
When prompted enter the password used when installing VNC Server.
There’s no point in having VNC if you have goto to the Pi, login and start the server manually. So let’s start it on bootup before the login prompt.
Create a new file in the init.d directory:
sudo nano /etc/init.d/tightvncserver
Enter the following details:
### BEGIN INIT INFO # Provides: tightvncserver # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Tight VNC Server at boot time # Description: Start Tight VNC Server at boot time. ### END INIT INFO #! /bin/sh # /etc/init.d/tightvncserver USER=root HOME=/root export USER HOME case "$1" in start) echo "Starting Tight VNC Server" #Insert your favoured settings for a VNC session /usr/bin/tightvncserver :1 -geometry 1024x768 -depth 24 ;; stop) echo "Stopping Tight VNC Server" /usr/bin/tightvncserver -kill :1 ;; *) echo "Usage: /etc/init.d/tightvncserver {start|stop}" exit 1 ;; esac exit 0
Give the script executable permission:
sudo chmod 755 /etc/init.d/tightvncserver
We can now start or stop the service manually. Make sure you do this at least once and add the password as before if asked:
sudo /etc/init.d/tightvncserver start
sudo /etc/init.d/tightvncserver stop
But let’s make Tight VNC Server start every time the Raspberry Pi starts up:
sudo update-rc.d tightvncserver defaults
Now just power off the Raspberry Pi. Make sure it’s connected to the network and power back on. You can now connected across the network using the VNC Viewer!
Useful Terminal Commands
Top Tip!Use the Tab key to auto complete your Terminal commands.
Access the Raspberry Pi config tool:
sudo raspi-config
Start the desktop enviroment (LXDE) – will not work via SSH
startx
Shutdown your Pi in 1 minute:
sudo shutdown -h 1
Reboot your pi in 1 minute:
sudo shutdown -r 1
Get manual for any command:
man [command]
e.g.
man shutdown
Run any command with super user privileges:
sudo [command]
Enjoy!
View more at: http://yoursmart.mobi
Post a Comment