# Raspberry Pi

The Raspberry Pi is a credit-card-sized, single-board ARM nanocomputer.

# Change the Raspberry Pi Boot Order

*Looking to boot your Raspberry Pi from a hard drive? Great news: it’s possible! However, you’ll still need an SD card initially to configure the boot order.*

---

## Installing Raspberry Pi OS

First, you'll need to install Raspberry Pi OS on both your SD card and hard drive. To make this easier, the Raspberry Pi Foundation provides a handy tool called the **Raspberry Pi Imager** that can install Raspberry Pi OS on various devices.

### Raspberry Pi Imager

1. Download the latest version of the Raspberry Pi Imager from [raspberrypi.com](https://www.raspberrypi.com/software/).
2. Launch the Raspberry Pi Imager software. You should see this welcome screen:  
    ![Raspberry Pi Imager Welcome Screen](https://wiki.boreux.work/uploads/images/gallery/2024-08/pJbNma6OCkZeRamn-rpi-imager-welcome.png)
3. Click **Choose OS** and select your Raspberry Pi model. For example, Raspberry Pi 4:  
    ![Choose Raspberry Pi Model](https://wiki.boreux.work/uploads/images/gallery/2024-08/Rqp0pwBBbHZ0HS9x-rpi-imager-choose-model.png)
4. Next, click **Choose OS** and pick an operating system to install. Here, I selected **Raspberry Pi OS Lite (64-bit)**, found under **Raspberry Pi OS (other)**:  
    ![Select Raspberry Pi OS](https://wiki.boreux.work/uploads/images/gallery/2024-08/sHHn3CDwtaHpbbCE-rpi-imager-choose-os.png)
5. Click **Choose Storage** and select the storage device, either the SD card or the hard drive.
6. Repeat the process to install Raspberry Pi OS on your other device.
7. Plug in both the SD card and the hard drive into your Raspberry Pi, then power it on.
8. Follow the on-screen instructions to configure your Raspberry Pi.

## Installing the Latest Bootloader

Connect to your Raspberry Pi via SSH or directly. Open the **Terminal** and run these commands:

```bash
sudo apt update
sudo apt upgrade
sudo rpi-eeprom-update
sudo reboot
```

- The `update` command refreshes the package list from your distribution’s software repository.
- The `upgrade` command installs updates for all outdated packages and dependencies.
- The `rpi-eeprom-update` command updates the bootloader EEPROM images on your Raspberry Pi 4.
- Finally, `reboot` restarts your Raspberry Pi.

Once your Raspberry Pi is back online, connect to it again and run:

```bash
sudo raspi-config
```

You'll see this screen:  
![Raspi-config Welcome Screen](https://wiki.boreux.work/uploads/images/gallery/2024-08/Q710CnikC1lUKe5T-raspi-config-welcome.png)

Choose **6 Advanced Options** from the menu, which will show these options:  
![Advanced Options](https://wiki.boreux.work/uploads/images/gallery/2024-08/4L2qZdhxpB0m3umN-raspi-adv.png)

Select **A5 Bootloader Version** and opt for the latest bootloader version. Then, `reboot` your Raspberry Pi again.

## Changing the Boot Order

To switch the boot order from the SD card to a USB or NVMe device, run `sudo raspi-config` again, select **6 Advanced Options**, then **A6 Boot Order**, and finally choose **B2 USB Boot**.

Now, you can shut down your Raspberry Pi using the `shutdown` command, remove the SD card, and boot from the hard drive.

And voilà, happy me! 🌱

# Assign a Static IP Address

To configure your Raspberry Pi with a static IP address, follow these steps:

1. Open the network interfaces configuration file by running:

```bash
sudo nano /etc/network/interfaces
```

2. Replace the contents of the file with the following settings:

```
auto eth0
iface eth0 inet static
    address <YOUR_IP_ADDRESS>
    netmask 255.255.255.0
    gateway <YOUR_GATEWAY>
    dns-nameservers <YOUR_DNS_SEPARATED_BY_A_SPACE>
```

3. Save the file and exit.

4. Restart your Raspberry Pi using the command:

```bash
reboot
```

And just like that, you’re all set! 

Happy me! 🌱