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.
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
- A Raspberry Pi 2(!)
- A case – optional, but these are cheap and keep your Pi nice and safe
- An SD card reader – remember that the Pi 2 uses a microSD card. Laptops often have an SD card reader built-in
- 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)
- 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
- 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
- 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
- An HDMI lead connected to a monitor or TV (not shown).
And here it is all in one piece!
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!)
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.
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
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
5. Enter your network password next to ‘PSK’, and hit ‘Add’
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.
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…
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
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.
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)
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.
So this is what our settings look like
- Close Nano, save and reboot your Pi as per steps 4 & 5 in Method 1 above.
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!