Set up VNC server on Raspberry Pi

How to set up a VNC server

The tutorial today will show you how to run a VNC (Virtual Network Computing) server on your Raspberry Pi. This will allow you to view your Pi’s desktop and control your Pi like your computer was a monitor for it. This can be useful  if you would like to install a program via GUI. The program we are going to install is tightVNC server.

sudo apt-get install tightvncserver

Once you have installed tightVNC then you have done all of the necessary installation requirements to get the VNC server started. Next you need to start the VNC server to get it up and running you run the command;

vncserver

After you run this command you will be asked to enter a password for your VNC server. Now you server has been set up and fully configured. The next stage is making sure that you have set up port forwarding on your router. To be able to use the VNC server, you need to port forward port 5900 to the ip address of your Pi. Port forwarding is different on each router so it is impossible for me to show you how to do that, please refer to your routers brand website.

After you have forwarded the port 5900 to your Pi, you can now go ahead and connect to your Raspberry Pi. The program that I use is VNC viewer. It is a free program that is available on all major platforms. Go to https://www.realvnc.com/download/ to download this program.

Once it has installed, open the VNC viewer. Once the program has opened you should then get the connection box;

Screen Shot 2014-03-23 at 16.42.46

Replace the 192.168.0.15 with the ip of your Raspberry Pi. Then select connect and enter the password that you entered earlier.

Screen Shot 2014-03-23 at 16.58.18

Thank you for reading, if you spot any mistakes or have any questions please comment below.

How to set up a wireless adapter

How to set up a wireless adapter

For this tutorial i will be using a RT5370 Wireless Adapter to connect to my network. Firstly, power down your Pi and then insert your USB adapter. Secondly, power your Pi and ssh into it. If you want to check your USB is being read correctly or you want to know the model of your adapter, simply type in lsusb. You should get an output with something like this;

Screen Shot 2014-03-22 at 17.49.13

Now you know that your adapter is being recognised you can now go on to getting your network adapter set up. There are many ways of doing this, like using the wpa_suppicant file. This method is easier, works for most networks and requires only editing one file. To enter your network information you need to edit the interface file, so run;

sudo nano /etc/network/interfaces

you should then get a file that looks like this;

Screen Shot 2014-03-22 at 17.57.03

You need to then edit the file so it looks something like this;

Tip: The ” ” for your networks name and password is essential.

To save the file you need to press CTRL + o, then to exit the editor CTRL + x. Then to test that you have correctly set up wifi run the code sudo ifup --force wlan0 up. This will force the network adapter to get an ip from your networks DHCP server. If this runs without any errors, type in the command ifconfig. You should then see an ip address assigned to eth0 which is the ip address that you connected to the pi, and also an ip assigned to the wlan0;

Screen Shot 2014-03-22 at 19.59.52

Thank you for reading if you have any comments, see any mistakes or if you have any specific tutorial you would like me to cover please comment below.

Getting started with SSH + Initial Setup

SSH  and the initial setup of your Raspberry Pi

Now that you have the SD card set up, we can now try and connect to your Pi. I am assuming that the pi is plugged in via ethernet to your router, and you have forwarded the ssh port 22 to your Raspberry Pi’s ip. During this tutorial I am going to use the pre installed ssh client in the terminal on the mac. If for what ever reason you want to use another client, the tutorials will still work fine with that client.

To ssh to your raspberry pi just type in the following command but replace 192.168.0.15 with your Pi’s ip address.

ssh pi@192.168.0.15

You should then get asked if you want to connect to the device with the key displayed, just type yes and then enter the password. The default password for the raspbian image is ‘raspberry’.

Tip: If you get any errors at this point please check that you have port forwarded to the Pi correctly.

The first set of commands to run are the update and upgrade commands. These commands are pretty self explanatory.

sudo apt-get update
sudo apt-get upgrade

These commands might take a while so be patient.

After these have been configured it is highly recommended that you  change the password for the default pi account. Simply type passwd into the prompt. Enter your current password (raspberry) and then your new password.

Now your Pi is fully updated and secure, now you can customise it further by using the sudo raspi-config command.

sudo raspi-config

Here you can change lots of features of your Pi. You can over-clock your Pi, change your password and even change the keyboard layout.

Thanks for reading, if you have any questions or requests please comment below.

Setting up your SD card.

Setting up your SD card

Firstly, you need to download an image to install on your SD card to get your Raspberry Pi up and running. When I first got my Raspberry Pi it had NOOBS OFFLINE pre installed . NOOBS (New Out Of the Box Software) is a small image that comes installed on most SD cards that are advertised for the Raspberry Pi. It is preloaded with software that would download and install the distro of your choice.

If you want to go straight to a headless (no monitor or keyboard) Raspberry Pi, what I recommend is that you format the SD card and start from scratch.

These steps will guide you on how to install the Raspbian official distro on a Mac via terminal.

Firstly, we need to download the distro so we can flash it to the SD card. Go to the Raspberry Pi website and download the Raspbian file. Whilst the file is downloading you need to prepare your SD card. Open up Disk Utilities and format the card into MS-DOS format,  giving it a name in CAPITALS, I called mine SDCARD. Next open up the terminal and type in;

df -h

You should then see a list like the one below.

Screen Shot 2014-03-21 at 12.25.10

Then look in the last column, and find the mount point of your SD card. Follow the row to the first column, make a note of this. In the picture above my mount point is “/Volumes/SDCARD” and my filesystem is “/dev/disk1s1”. Once you have this information you can then proceed to flash the SD card. Before we do that, we need to unmount the SD card from the system. To do this run this command (instead of /Volumes/SDCARD use your mount point);

diskutil unmount /Volumes/SDCARD

Once unmounted, the SD card is ready to be flashed. To flash the SD card, we need to use the filesystem of your card that we got earlier. “/dev/disk1s1” was my filesystem but to flash it we edit that to “/dev/rdisk1”, we have taken away the s1 from the end and added an r. We flash the card using the following command;

     sudo dd bs=1m if=~/path/to/img of=/dev/rdisk1

The command line should then look like it isn’t doing anything, but if you press ctrl + T you will see the status of the flash. Once the process is complete and the terminal goes back to the normal prompt, you have finished ! Simply disconnect your SD card from your Mac and plug it into the Raspberry Pi. Even though above I stated that this is a headless set up, you can still connect your tv, keyboard and mouse to your Raspberry Pi and have it running from desktop. All of my tutorials will be suited for the headless setup, I will not go through the desktop setup of any programs (unless requested).

If you have any problems or questions comment below and i will try and answer them as well as I possibly can. Also if you have any more specific tutorials that you would like please comment and I will try my best.

Thanks