GUIDE

Setting up a Raspberry Pi

The recent release of Raspberry Pi 2, the latest iteration of the massively popular low cost credit-card sized computer originally designed to teach kids to code, has seen a surge of interest in the funky $35 board.

Although education was the original goal, technology enthusiasts have taken the pint-sized computer to their hearts, and used it for making everything from low cost media stations or arcade machines, to taking photos from space.

Loath to miss out on the fun, we have obtained a shiny new Pi 2, and seeing as we are BestVPN, will show you how to use it in various funky was to improve your internet security, for example by as using it as a VPN router, a Tor node, an ad blocker, and more!

Although the new quad core 1GB RAM Pi 2 can run the Snappy Ubuntu Core OS, will be able to run a special version of Windows 10 when it comes out, the Pi 2 is 100 percent backwards compatible, and most of our tutorials should work just fine for older models.

Beginnings

There is no shortage of beginners guides to setting up a Raspberry Pi on the internet (not least on the official website itself), but as we plan to run a number of article on the subject, and as the entire start to finish process is also new to us too, we thought it appropriate to start at the beginning with a brief introduction to the basics.

What you will need

Required bits

  1. A Raspberry Pi 2(!)
  2. A case – optional, but these are cheap and keep your Pi nice and safe
  3. An SD card reader – remember that the Pi 2 uses a microSD card. Laptops often have an SD card reader built-in
  4. A keyboard and mouse – these can be cabled USB accessories, but it is much more elegant to use a wireless Bluetooth dongle (a Logitech combi keyboard/mouse dongle is shown)
  5. An SD card – the Pi 2 accepts a microSD, but earlier models accept regular SD cards. An 8GB card is officially recommended, but given the small price difference between this and a 16GB card, we opted to purchase the larger size
  6. 2x USB WiFi dongle(s) – for using the Pi as a wireless router (one dongle connects to the WiFi network and the other creates a personal aces point, with a bridge between them.) An Ethernet cable can be used instead of one dongle if desired
  7. A microUSB power supply – the Pi 2 requires more power than previous models, so a 5v power supply is recommended. Most (non-Apple) modern phone chargers should do
  8. An HDMI lead connected to a monitor or TV (not shown).

 Pi put together

And here it is all in one piece!

Installing Raspbian

Raspbian is a lightweight free operating system based on Debian optimized for the Raspberry Pi hardware, and is the OS we will be using for most of our various projects.

Although Raspbian can be installed using an image file of the OS, by far the easiest way is via the NOOBS (New Out Of the Box Software) operating install manager, and we can’t really improve on the official NOOBS setup guide, so check it out here. Be sure to select Raspbian as the OS you want to install (although it is fun playing ith the others!)

raspbi-config

Once on the ‘raspi-config’ setup page for Rasbian, it very good idea to change your default password, especially as we plan on using the Pi as VPN router which will bypass your router’s firewall. If you live outside the UK then you should also change language and regional settings to your location (and keyboard).

For all our tutorials we prefer to use the graphic user interface (GUI), because that’s just the way we roll. We have set ours up using the configuration menu (option 3) to load the GUI automatically, but it can be started from the command line by typing ‘startx’ .

If you need to return to the configuration page enter ‘sudo raspi-config‘ at the command prompt or Terminal.

 Finishing touches

 Connect to the internet

Probably the most important thing to do once you have Raspbian up and running is to connect to the internet. To do this:

1. Ensure that at least one WiFi Dongle is plugged into a USB port

2.. Go to Menu -> Preferences -> WiFi Configuration

WiFi 1

3. Ensure the correct WiFi adaptor is selected, then click scan

4. Once the scan of local networks is complete, find your WiFi network on the list and double-click on it

WiFi 2

5. Enter your network password next to ‘PSK’, and hit ‘Add’

WiFi 3

6. Back on the main network screen, just hit connect, wait for the status to change (hopefully!) to ‘Completed’, and exit by clicking the ‘x’ to the top right.

WiFi 4

 Set correct screen resolution

When we first started using Raspbian we were frustrated by the fact that it would not auto-detect the correct screen resolution of our 1080p TV (this is a problem that apparently particularly affects TV sets). Although not critical to any of our tutorials, this is an issue that bugged us, so we will share how we fixed it…

There are two main solutions to this problem, both of which require editing the config.txt file (and a complete fix may require using both methods). Before trying these, however, go to Menu -> Preferences -> Monitor Settings, and try selecting the correct resolution for your screen from the drop-down menu.

If this fails then it is time to start using the Linux Terminal…

Screen 1

Method 1

1. Open LX Terminal

2. Type ‘sudo nano /boot/config.txt’ <enter> to open the config.txt file in the Nano command line text editor (‘sudo’ gives you superuser privileges)

3. Scroll down until with your mouse wheel or the keyboard arrow keys until see ‘#disable_overscan_1’, and delete the ‘#’ to ‘uncomment’ the command

screen 2

4. Press Ctrl+ x to quit, and save by pressing ‘y’

5. Reboot either through the GUI by going to Menu -> Shutdown -> Reboot, or by typing ‘sudo shutdown -r now’ at the command prompt.

Method 2

Hopefully Raspbian will now correctly detect your screen’s resolution, but if not, then this method should fix the problem. Note that you should perform Method 1 before trying this, as when we tried this method it did not work until we had completed the steps outlined above.

1. At the command prompt in Terminal type: ‘tvservice -d edid’<enter>, followed by ‘edidparser edid’ <edid>

2. Scroll through the list of resolutions supported by your screen, and select the one you want. We want 1080p at the highest refresh rate supported by our TV, so we want CEA mode (31) 1920x1080p @ 50 Hz. Make a note of the mode group and number (CEA and 31 in our case)

screen 3

 3. Type ‘sudo nano /boot/config.txt’, scroll down to the first HDMI section, and uncomment (delete the #) hdmi_group and hdmi_mode settings.

4. You then need to set the correct values for these settings – hdmi_group=1 if your screen uses CEA mode, and 2 if DMT mode – hdmi_mode= your screen’s mode number.

screen 5

So this is what our settings look like

  1. Close Nano, save and reboot your Pi as per steps 4 & 5 in Method 1 above.

Conclusion

You should hopefully now have a Raspberry Pi that is up and running, connected to the internet, and showing the correct screen resolution – in other words, all ready to go! Check out our next guide to find out how to configure your Pi to work as a wireless VPN router!


Douglas Crawford I am a freelance writer, technology enthusiast, and lover of life who enjoys spinning words and sharing knowledge for a living. Find me on Google+

Related Coverage


9 responses to “Setting up a Raspberry Pi

    1. Hi Gordon,

      Thanks for thew link. I know how setting up A Rasspberry Pi as a VPN router should work.. its just that it didn’t. I will revisit this subject soon.

  1. You said “the Pi 2 requires more power than previous models, so the power supply should be at least 5v”. No, it should be a 5v supply. What you are thinking of is that since the Pi 2 requires more power, the supply should be able to provide more. The “official” supply can provide 2A, but I see others selling a 1A to use with the Pi 2.

    Also you repeated this twice: “Be sure to select Raspbian as the OS you want to install (although it is fun playing ith the others!)”

    1. Hi stephenhill,

      I have slightly modified the text to clarify the 5v supply point. Thank you for pointing out both errors.

    1. Hi jan,

      Part 2 is seriously delayed because after spending many hours attempting to setup the Pi in Raspian as a VPN router, we still could not get it to work (it should have, and a big up for the tech support team at BlackVPN for the effort they put in to helping us (unsuccessfully) to resolve the problem.) Now that we have had a break, we might try again soon, as well as running a tutorial on how to do this using Windows 10 and Pi.

      1. Hello Douglas, it seems like a joke that after half-year there is no next part. I can´t really believe that it is not feasible after so long time. But in any case, I wish you a good luck to be successful with this next part concerning VPN router.

        1. Hi Enigmatique,

          I’m sorry, but after struggling with the problem for while, I needed a break. Look out, however, for more Raspberry Pi goodness coming soon. The new Win 10 for Pi is now out, and I have tutorials on a number of exciting projects lined up. I will also have another bash at using the Pi as a VPN router in Raspbian…

Leave a Reply

Your email address will not be published. Required fields are marked *