Sunday, May 22, 2016

Headless install of Raspbian (Jessie)

I needed to perform an install of Raspbian (Jessie) on a Raspberry PI, but I didn’t have a spare keyboard, mouse, or monitor / tv to connect it to. 
Download Raspbian from (current Jessie):
https://www.raspberrypi.org/downloads/
At the time of writing it was 4.1 (I used the lite version)
Download and install the SDCard Formatter from SDCard.org:
https://www.sdcard.org/downloads/formatter_4/eula_windows/
Download and install Win32 Disk Imager from sourceforge:
https://sourceforge.net/projects/win32diskimager/
 
Connect the SDCard, and run the SDFormatter application as an administrator.
This procedure will delete anything on the SDCard
clip_image002
Ensure the drive letter specified in the SDFormatter is the same as the drive letter of the SDCard connected (Open ‘Computer’ and check if need be)
clip_image004
Click the Option button and set FORMAT SIZE ADJUSTMENT to ON
Click OK.
clip_image006
click Format and Click OK
clip_image008
Click OK
clip_image010
Wait!
clip_image012
Once the format is finished, click OK and then click Exit.
clip_image014
  Run Win32 Disk Imager as Administrator
image
Select the correct Device, browse and select the Raspbian Jessie image downloaded, and click Write
image
Double check the drive letter, and click Yes to proceed
image
This will copy the Raspbian Jessie image to the SDCard, and may take some time.
Once the write is Successful, click OK, and Exit the Win32 Disk Imager

image

edit 22/03/17
Open the USB drive in file explorer and create a new blank file called ssh in the root.  (Make sure you don't have an extension on the file).  See note #3  https://www.raspberrypi.org/documentation/remote-access/ssh/

Connect the SDCard back into the Raspberry Pi, connect an eternet cable, and boot the device.
After some time, check your DHCP server or logs to identify the IP address of the device, alternatively query dns for raspberrypi.
Using putty, connect to the device using SSH.
image
Click Yes to the key warning
image
Login credentials are:
username: pi
password: raspberry
image
Run the initial Raspberry Pi Configuration by using the command:
sudo raspi-config
image
Modify the configuration as required.  Once completed, select Finish
If prompted to reboot, select No
image
Update the package source by running the commands
sudo sed -i 's/wheezy/jessie/g' /etc/apt/sources.list
sudo sed -i 's/wheezy/jessie/g' /etc/apt/sources.list.d/*
Update the package list using the command
sudo apt-get update
Update the distribution
sudo apt-get dist-upgrade
Select ‘Y’ to continue if prompted.
This may take some time.
Once completed, uninstall group-bin and configuration files
sudo apt-get purge cgroup-bin
It may / may not have anything to uninstall.  This can prevent the unit from booting.
Change the name of the device
sudo nano /etc/hostname
CTRL-X, Y and <Enter> to save the name
sudo nano /etc/hosts
Change the line
127.0.1.1     raspberrypi
to
127.0.1.1     <new name of the device>
CTRL-X, Y and <Enter> to save the name
 
Reboot the unit with
sudo reboot
 
Reference:
http://tech.tiefpunkt.com/2015/06/headless-raspberrypi-installation-with-raspbian-jessie/
https://www.raspberrypi.org/documentation/installation/installing-images/README.md
http://askubuntu.com/questions/231562/what-is-the-difference-between-apt-get-purge-and-apt-get-remove
http://packages.ubuntu.com/trusty/admin/cgroup-bin
http://www.raspians.com/Knowledgebase/how-to-change-hostname-on-raspberrypi/
https://www.raspberrypi.org/documentation/remote-access/ssh/




















































1 comment:

  1. Edited to include setting up SSH, as it is now disabled by default.

    ReplyDelete