# Connecting to Raspberry Pi for first time (headless)

OK, I wanted to post on Devops related stuff.
Instead I am starting with raspberry pi. 
Well, I have decided to learn Pi related stuff and thought I could use it for Devops related testing. 

### Which model to buy - Purpose ? 
There are different models such as raspberryPi pico, Raspberry Pi Zero & Raspberry Pi Model 4B

Purpose - I want to setup my Linux environment on Pi and experiment out few things.
Hence I bought Pi Model 4B which fits my porpoise. 

We can select Memory as per our needs. 4 GB should be sufficient. 

I bought 8 GB RAM Pi for myself for devops related purpose.

For standard model, we need to purchase Memory card separetely. I got 32 GB card which should be decent enough.

Power connector would be C-type. Usually combo bundles are available for purchase.

Additional HDMI cable can be purchased, incase we are connecting Pi to Monitor.

Take a look at my setup below 

![sasi.jpg](https://cdn.hashnode.com/res/hashnode/image/upload/v1665780420784/t1NWPW4Vk.jpg align="left")


### Where to buy ?
I recommend to buy it from raspberryPi approved resellers. Usually Pis are out of stock due to chip shortage. So email can be provided here to notify when a new stock is added.

[https://www.raspberrypi.com/products/](https://www.raspberrypi.com/products/)

### What we need to connect

### Headless Mode

We can connect to Pi to HDMI monitor. Instead we are configuring Pi in headless mode with pre-setup.

### Setup boot disk for Pi

Insert SD Memory card into Card reader/Adapter and connect to your computer.

Download Rasberry Pi imaging tool from [https://www.raspberrypi.com/software/](https://www.raspberrypi.com/software/)

### Select preferred OS

Recommended option would be Rpi 32 bit OS. Feel free to select 64 bit or any other. 


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1653573157576/DX3zUEvvu.png align="left")


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1653573252494/NvNoqfNL-.png align="center")

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1653573226811/9a_MM-tGE.png align="left")


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1653573319934/BGoaAKemJ.png align="left")

Click on Advanced settings option ( available in latest versions)

![Screenshot 2022-10-13 at 5.38.17 PM.jpeg](https://cdn.hashnode.com/res/hashnode/image/upload/v1665663578426/n_8UG3nQg.jpeg align="left")

Can provision ssh enable option, wifi options, login credentials here.
Once done , click on WRITE option.

![Screenshot 2022-10-13 at 5.07.22 PM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665663504209/nq7E9WttT.png align="left")

Writing in Progress

![Screenshot 2022-10-13 at 5.52.25 PM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665668482419/Ji-Lv37ih.png align="left")

Once, process completed , we get this popup.

![Screenshot 2022-10-13 at 6.35.50 PM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665668490755/AJlfLv5eF.png align="left")

### Connecting to Pi via SSH

Pi can be connected to a LAN or can be connected to Wifi as per pre-configuration.

To connect to the Pi, first we need to figure out IP assigned to Pi.
we can utilise nmap to check for Pi address, which would show up as raspberry pi device.
Otherwise we can check via bruteforce via telnet. 

![Screenshot 2022-10-15 at 12.15.07 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665773323308/XABcY6P76.png align="left")

Linux or Mac terminal, connect as below

```ssh pi@192.168.0.104
``` 


![Screenshot 2022-10-15 at 12.35.49 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665776487722/e5iv8OL11.png align="left")

If it's windows, Open up Putty and enter Pi IP and port number as 22 and provide login creds as configured. Default cred's would be username: pi/password: raspberry.



If Pi is connected to Wifi, follow Router instructions online for ***wifi dhcp reservation***.

Incase Pi is connected via LAN, Please follow below guide to assign static IP
[https://www.makeuseof.com/raspberry-pi-set-static-ip](https://www.makeuseof.com/raspberry-pi-set-static-ip)



Please feel to to comment if any queries/feedback
You can write email to *sasidatta@protonmail.com*

TwitterID: https://twitter.com/sasidatta






