When I prepare a new microSD card for use in a Pi, I install Raspbian and configure it for remote access. Here are the tasks that I perform:
- Install Raspbian
- Expand the file system, give the Pi a unique name and configure for my location
- Enable ‘Show Hidden’ in the File Manager
- Add ‘sudo Leafpad’ to the right click menu ( to make editing system files easier )
- Assign a static IP address ( so that VNC can find it )
- Install tightvnc ( to give me access to the Gui from my windows desktop )
- Install cut and paste ( to make it easy to copy commands to the Pi while using VNC )
These directions apply to Raspbian Jessie as of May 2016. (I hate it when a blog gives you directions that turn out to be months or years out of date and you have no way to tell.)
I just follow the directions given on the Raspberry Pi website:
Expand the file system, give the Pi a unique name and configure for location
Note: If you want to make a backup image of your initial setup, postpone the file expansion until the after backup is complete.
Insert the microSD card into the Pi, connect a monitor, mouse and keyboard and apply power.
You need to expand the operating system partition to use the full size of your micro-SD card.
Menu | Preferences | Raspberry Pi Configuration
on the System tab:
click on Expand Filesystem
change the Hostname (optional)
on the Localization tab:
Set Keyboard (if necessary)
Reboot when asked.
Enable ‘Show Hidden’ in the File Manager
Open the File Manager and menu to:
View | Show Hidden
Add ‘sudo Leafpad’ to the right-click menu
I prefer to do my editing with a Gui editor so I set up a menu option that make it easy to change system files without having to go into the terminal and sudo nano.
Open the file manager and navigate to
select one of the text files, user-dirs.dirs for example, and right-click on it.
Select Open With.. and then the ‘Custom Command Line’ tab
in ‘Command line to execute’ type
sudo leafpad %f
In the ‘Application name’ field type
Click OK and close the editor after it opens.
This will create the file
/home/pi/.local/share/applications/sudo Leafpad that contains the settings for this new menu item.
Now you can edit system files by right-clicking of the file and selecting
sudo Leafpad from the menu.
If you need to delete the menu item, delete its entry in
and the file in the
Assign a static IP address
A static IP makes it easier to connect to your Raspberry Pi from a remote terminal.
There are two methods of assigning a static IP. One method is to configure your router to assign a predetermined IP address when a specific MAC address is connected. A MAC address is an identifier preassigned to the network hardware on the Raspberry Pi side of the connection.
The second method is to program Raspbian to request a predefined IP address from the router.
Setting a static IP based on MAC address means the IP address is associated with the connecting hardware – the RJ45 plug on the Raspberry Pi will have one MAC address, each wireless dongle will have another.
Setting the static IP via Raspbian means the static address is associate with the operating system on the microSD card.
The choice is really up to you as to which method makes most sense based on your expected use of microSD cards, wireless and cabled connections.
Setting your router to recognize a MAC address and assign a static IP is router model specific, so you are on your own if you choose to do that.
If you want to assign the static IP through Raspbian, here are the steps:
Note: Many sites that tell you to edit the
/etc/network/interface file. Those instructions are for the Weezy release of Raspbian, not the Jessie version.
You need to gather some information about your network before you make changes to the Raspberry Pi configuration.
in a terminal type:
and look for an IP address following
inet addr: like is shown below. If you are connected via cable it will look like this
eth0 Link encap:Ethernet HWaddr b8:27:eb:64:68:67 inet addr:192.168.1.120 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::db66:9f48:656b:c0dc/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:49083 errors:0 dropped:17 overruns:0 frame:0 TX packets:80694 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3614960 (3.4 MiB) TX bytes:93134453 (88.8 MiB)
A wireless connection will look similar, but be labeled wlan0.
This gives us two important bits of information
- the name of the network interface (it will almost always be eth0 or wlan0 on a Raspberry Pi)
- the current IP address assigned to the Pi
in a terminal type
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 202 0 0 eth0 192.168.1.0 0.0.0.0 255.255.255.0 U 202 0 0 eth0
We’ll use the Gateway value in two locations below.
sudo Leafpad from your right-click menu and add the following to the end of that file:
interface eth0 static ip_address=192.168.1.120/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1 220.127.116.11
Replace the items in bold with the values that correspond to your network and save. The 18.104.22.168 is Google’s dhcp server.
Reboot and hover the cursor over your network connection icon in the upper right corner of the screen and verify that the correct IP address is in use.
Install tightvnc ( to give access from a faster pc )
The tightvnc server will allow you to access the Raspberry Pi’s graphical interface from a another computer (a desktop, laptop, tablet or even a phone.)
Install tightvncserver using a terminal
sudo apt-get install tightvncserver
Run tightvncserver to setup the security password
Open the file manager and navigate to
Right-click in the directory and select
Create New… | Folder
Name the new folder
Navigate into the
Right-click again and select
Create New.. | Empty File
Name the new file
Edit tightvnc.desktop and enter the following:
[Desktop Entry] Type=Application Name=TightVNC Exec=vncserver :1 -geometry 1920x1080 -depth 24 StartupNotify=false
Save the file and the next time you reboot the vncserver will start automatically.
From a VNC client, access the server at the fixed IP address you defined followed by :1 as in
You may see the message
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed at the start of a VNC session. It can be ignored.
Install cut and paste ( to make it easy to copy commands from the net)
Now that you can access the raspberry pi from a faster computer using VNC, it would be great to be able to copy code and paste it into the editor or the command line on the Raspberry Pi .
To install cut and paste, open a terminal and:
sudo apt-get install autocutsel
/home/pi/.vnc/xstartup using Leafpad
After the line that starts
xsetroot add the line
so that it looks something like this:
#!/bin/sh xrdb $HOME/.Xresources xsetroot -solid grey autocutsel -fork #x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #x-window-manager & # Fix to make GNOME work export XKL_XMODMAP_DISABLE=1 /etc/X11/Xsession
Save the file and reboot.
If all is working as expected, save a copy of the microSD card’s Raspbian image using Win32DiskImager so that you don’t have to go through setup the next time.
You now have a Raspberry Pi ready to be used for any of a thousand applications.