Getting Started with Raspberry PI (RPi) board

Reviewed by Editor: Jack Allison

Step-By-Step Start (for RPi Model B, B+)

  1. Clone (make a backup copy) of your pre-installed NUBS SD-card (or create OS SD card from your downloaded image)
  2. Using HDMI cable, connect the board to your TV/monitor.
  3. Connect USB keyboard and mouse to your Raspberry Pi board (starting with B-model you have 2 and more USB ports).
  4. Plug micro-usb power supply into the board.
  5. Long Shift-button at first boot -> Install Raspbian (recommended option)
  6. Boot for the first time with Raspbian and enter configuration.
    – Enable Advanced\SSH
    – Enable Pi Camera
    – Enable boot to desired startup screen: Boot with Pi user to graphical screen; to command line etc.
    – Reboot
  7. Connect to your home LAN with Ethernet cable and check your RPi’s IP address: ‘ifconfig‘ in command line

Access to RPi configuration (after first boot)

Access to the configuration screen is possible at any time after you booted with RPi. This is useful in case something went wrong or was forgotten at first boot (ex. to set SSH enabled to be able to connect with Putty) or whenever you want to enable/disable additional advanced options.

At the Terminal’s command prompt, type:

sudo raspi-config

Connect from your home PC

This may be necessary if you plan to use a single monitor+keyboard+mouse set for working with both your Raspberry Pi and for your PC while both are connected to the same LAN router which has DHCP Server (all modern routers), which assigns IP addresses automatically.

Depending on your RPi usage model, you may need to switch between the following work-modes in as fast and comfortable ways as possible:
– working on your PI/PC directly with the same monitor+keyboard+mouse
– working on RPi from your PC through some Remote Control Utility (ex.to see all on one screen for simultaneous observation and capturing of results)

To allow this fast switch, I would recommend connecting both your RPi and your PC to KVM switch. This will also allow you to manage with a single monitor only.

Once we connected all our HW and we know the IP address of our Raspberry PI (from the above step: ifconfig command) we can use at least 4 ways to connect and work remotely described below.

However, there is one problem with some remote access methods described further. Remote Desktop and TightVnc Server don’t work with main desktop, but only with the secondary desktop (Raspbian has 2 desktops by default) and I was unable to figure out how to make it working with main desktop.

Although working with a secondary desktop may be enough for many use-cases, there are cases where you would like to see what is displayed on the main desktop. In this case x11vnc server is recommended.

  • SSH:

  1. Download Putty SSH and FTP utilities on your Win/Unix PC machine
  2. Open a terminal session to your RPi with Putty (using SSH protocol). Login name: pi password: raspberry
  3. Update your RPi (through Pytt’s SSH command line)

– Check your /etc/apt/sources.list contains the following lines (as described here):

deb http://archive.raspbian.org/raspbian wheezy main contrib non-free
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free

– sudo apt-get update
– sudo apt-get dist-upgrade
– Raspberry Pi firmware updater: sudo rpi-update

  • Remote Desktop (Secondary RPi Desktop):

    1. To install the remote desktop execute the following commands at the Terminal commend line (at your Raspberry Pi if you are using TV/monitor or at Putty’s SSH terminal)

sudo apt-get install -y xrdp

sudo service xrdp stop
sudo service xrdp start

2. Start Remote Desktop application (mstsc.exe in Windows) to access your RPI

  • TightVnc Server (Secondary RPi Desktop):

sudo apt-get install -y tightvncserver

Access to main desktop with TightVnc Server is possible with TightVNC Viewer or  Android VNC Client

  • VNC (Main RPi Desktop):

After installing and configuring VNC server (x11vnc) you will have access to RP’s main desktop from Windows/Linux with standard VNCClient or TightVNC Viewer

– install

sudo apt-get install -y x11vnc

– create the VNC start-up configuration file, stored in home directory

sudo nano ~/.xsessionrc

– in nano editor edit the text as follows:

x11vnc -bg -shared -forever -tightfilexfer -nopw -display :0

– press CTRL+O then ENTER to write (save) the file then CTRL+X to exit

– make the file executable

sudo chmod 775 ~/.xsessionrc

– to configure HDMI resolution open /boot/config.txt

sudo nano /boot/config.txt

– in nano editor

hdmi_force_hotplug=1
;SVGA 1024×768@60Hz:
hdmi_group=2
hdmi_mode=16
;Full HD 1920×1080@60Hz:
hdmi_group=2
hdmi_mode=82

– Press CTRL+O then ENTER to write (save) the file then CTRL+X to exit

– restart your RPi

Security

If you plan expose your RPi to the Internet (using NAT virtual server feature for example) you may want to protect your RPi from being accessed by strangers. The following actions may be taken for this purpose.

  • Change your RPi password

For this, use ‘sudo raspi-config’ command’s menu ‘Change User Password’

  • Protect VNC service with password

For information on how to do this you may use this link or x11vnc help command which is quoted below.

“… You can create an x11vnc password file by running:
‘x11vnc -storepasswd password /path/to/passfile’
or ‘x11vnc -storepasswd /path/to/passfile’
or ‘x11vnc -storepasswd
the last one will use ‘~/.vnc/passwd’

x11vnc

x11vnc -rfbauth /path/to/passfile
an existing ‘~/.vnc/passwd’ file from another VNC application will work fine too. @#

You can also use the -passwdfile or -passwd options. Note -passwd is unsafe if local users are not trusted. Make sure any -rfbauth and -passwdfile password files cannot be read by untrusted users.

Use x11vnc -usepw to automatically use your ‘~/.vnc/passwd’ or ‘~/.vnc/passwdfile’ password files.
and prompt you to create ~/.vnc/passwd if neither file exists. Under -usepw, x11vnc will exit if it cannot find a password to use… ”

Recommended References:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s