Headless is a term used to describe a machine that does not have a screen.
This article is how you setup your Pi to be used without a computer screen attached (as my HDMI to VGA cable didn’t work for me) and using my normal windows PC which is connected to the internet.
Firstly you need to log into your Pi.
If you can attach a screen temporarily to help you get setup I recommend that you do that as this will make life allot easier and skip Step 1.
I’m going to run through how to do this without a screen at all as I had to.
So you have already made the OS image on your SD card with the latest stable version from the Pi Download center.
You place that SD card on your Pi and connect an ethernet cable that is connected to your internets router.
You can now plugin the power cable to your Pi switching it on and booting up the OS.
Step 1 – SSH into your Pi
After waiting a few minutes for the Pi to boot up you can go into your router control panel (i.e. virgin media has 192.168.0.1, other providers may have different addresses) and see who is connected to this router.
You should see raspberry-pi connected to the network on this list and it will display and IP address.
My IP shown is 192.168.0.7 but yours will likely be different.
Take note of this IP address as we are now going to SSH into your Pi with IP.
Now on your Windows PC you need to download Putty which is an SSH client (ignore putty if your using MAC or Linux as you can SSH via the terminal)
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html putty.exe is the file you need.
Enter in the IP address of the Pi that was shown on the router Once you click open it should as your for your Login. If you get a blank screen or you could not connect it could be to:
- Pi not botted up yet, wait a minute or two.
- You entered in the wrong IP address (check the IP address on your router contol panel)
- Your PC is not on the same network as the Pi (make sure the PC is using the same router)
- Your version of the OS has disable SSH access (Either find a different OS version or google how to enable SSH on your SD card OS files)
So now you should get a response like this after entering in your login details (My OS defult is Login pi Password raspberry): Ignore the Notice displayed on my example. This is just asking me to run configuration to extend my partition on the SD card. If you get the same notice you can run it now but running it later once your setup is complete is fine too. Now you need to update your Pi to the latest version so type in the following commands to do that if not already done so (doing this now will reduce issues of old verisons of drivers etc)
sudo aptitude update
sudo aptitude dist-upgrade
sudo apt-get update
sudo apt-get dist-upgrade
You can now SSH into your Pi which technically means you are headless but you have to check your IP address hasn’t changed everytime that you want to login. You cant run startx via SSH but you can use other software as described in Step 3 A nicer method is to connect either a crossover cable or ethernet cable from your Pi directly to you PC. If you wish to try this, continue to Step 2
Step 2 – Ethernet from Pi to PC
WARNING: You are likely to want an internet connection to your Pi after doing this setup which can be done in 2 ways.
1. Share the internet connection on your PC with your Pi. Some routers do not let you do this either due to the setup in the control panel or they reserve the IP 192.168.0.1
By default windows shares the internet connection on 192.168.0.1 which will cause an IP conflict so to test if this will work or not, do the following
Now to setup a direct ethernet (or crossover) cable from your Pi to your PC we need to setup static IP addresses between each other.
It has to be part of 192.168.xxx.xxx and not be already used by another network.
So for this example I am using 192.168.250.x (but you can change 250 from anything from 1 to 254, not 0 or 255)
Still logged in via SSH through your router (or directly with a screen attached) you edit interfaces
sudo nano /etc/network/interfaces
then you need to add the following (without disabling your WiFi setup if you have one)
iface eth0 inet static
Save the updates by pressing Ctrl – x then enter
Now you need to setup your PC to work in a similar way
Go to Control Panel > Network connections > Right click the network cable you used > Properties Scroll down the list and click on ‘Internet Protocol (TCP/IP)’ and click properties
Check ‘Use the following IP address’ IP address as 192.168.250.1 Subnet Mask as 255.255.255.0
Click OK and OK again on the previous window
Now you can connect an ethernet cable from the Pi to the PC (might need to restart the Pi) and try and SSH into the Pi with the IP address 192.168.250.2
You should now recieve the login screen which means you are successful. #win
You can connect from the Pi to your PC with the IP address 192.168.250.1 too.
You can make the login process easier by adding named values to this IP address by editing your hosts file in C:\Windows\system 32\drivers\etc\hosts
and adding the line
which will allow you to just type in pi-wired when SSH to your Pi.
Step 3 – startx when headless
SSH will only allow you command line access, but if you want to use the GUI on the OS you can use one of the free packages available.
I use tightVNC viewer as it works well for me.
A good tutorial about setting this up is available here: http://www.penguintutor.com/linux/tightvnc
And there we have it.
A headless Pi.