This article provides a practical and technical explanation of the topic, including real-world use cases and insights.
How to Create or Install an Operating System for Raspberry Pi 4 Using Raspberry Pi Imager and a Memory Card
A complete beginner-friendly tutorial to install Raspberry Pi OS on a microSD card, configure hostname, username, password, Wi-Fi, SSH, timezone, and first boot settings for Raspberry Pi 4.
“`Introduction
“`Before using a Raspberry Pi 4, you need to install an operating system on a bootable storage device, usually a microSD card. The easiest and safest method is to use Raspberry Pi Imager, the official tool provided by Raspberry Pi.
Raspberry Pi Imager allows you to select the Raspberry Pi model, choose the operating system, select the memory card, and configure important settings before the first boot. These settings include the username, password, Wi-Fi network, country, timezone, keyboard layout, and SSH access.
Download Raspberry Pi ImagerTable of Contents
- Required hardware and software
- Download Raspberry Pi Imager
- Insert and prepare the microSD card
- Select Raspberry Pi 4 as the device
- Select Raspberry Pi OS
- Select the memory card
- Configure advanced OS settings
- Write the OS image to the card
- Boot Raspberry Pi 4 for the first time
- Connect using SSH
- Update the system after installation
- Troubleshooting common problems
1. Required Hardware and Software
“`Before starting, prepare the following components:
| Component | Recommended Choice |
|---|---|
| Raspberry Pi Board | Raspberry Pi 4 Model B |
| Memory Card | microSD card, preferably 32 GB or more |
| Card Reader | USB microSD card reader or built-in laptop SD reader |
| Power Supply | Official Raspberry Pi USB-C power supply recommended |
| Internet | Wi-Fi or Ethernet connection |
| Software | Raspberry Pi Imager |
2. Download Raspberry Pi Imager
“`Go to the official Raspberry Pi software page and download Raspberry Pi Imager for your computer operating system. It is available for Windows, macOS, and Linux.
Official Raspberry Pi Imager Download PageInstall Raspberry Pi Imager on Windows
- Download the Windows installer from the official page.
- Open the downloaded file.
- Follow the installation steps.
- Launch Raspberry Pi Imager from the Start Menu.
Install Raspberry Pi Imager on Linux
On Debian-based systems, you can install it from the terminal if it is available in your repository:
sudo apt update
```
sudo apt install rpi-imager -y
“`
Install Raspberry Pi Imager on macOS
- Download the macOS version from the official page.
- Open the downloaded file.
- Drag Raspberry Pi Imager to the Applications folder.
- Open it from Applications.
3. Insert the microSD Card
“`Insert the microSD card into your computer using a card reader. Make sure your computer detects the card correctly.
4. Open Raspberry Pi Imager
“`Open Raspberry Pi Imager. You will usually see three main options:
- Choose Device: select your Raspberry Pi model.
- Choose OS: select the operating system to install.
- Choose Storage: select the microSD card.
5. Choose the Raspberry Pi Device
“`Click Choose Device, then select:
| Option | Value |
|---|---|
| Device | Raspberry Pi 4 |
Selecting the correct board helps Raspberry Pi Imager recommend compatible operating systems.
“`6. Choose the Operating System
“`Click Choose OS. For most users, the recommended option is:
| Use Case | Recommended OS |
|---|---|
| Desktop use with screen, mouse, and keyboard | Raspberry Pi OS 64-bit |
| Server, SSH, MQTT, Node-RED, Linux lab | Raspberry Pi OS Lite 64-bit |
| Beginner with graphical interface | Raspberry Pi OS with Desktop |
7. Choose the Storage Device
“`Click Choose Storage, then select your microSD card.
8. Configure Advanced OS Settings
“`Before writing the operating system, click Next. Raspberry Pi Imager may ask if you want to apply OS customization settings. Choose Edit Settings or open the settings menu if available.
These settings are very important because they allow you to prepare the Raspberry Pi before the first boot.
Recommended General Settings
| Parameter | Recommended Value |
|---|---|
| Hostname | raspberrypi or pi4-server |
| Username | mourad |
| Password | Choose a strong private password |
| Wireless LAN | Enable if you want Wi-Fi connection |
| SSID | Your Wi-Fi network name |
| Wi-Fi Password | Your Wi-Fi password |
| Wireless LAN Country | DZ for Algeria, or select your country |
| Timezone | Africa/Algiers |
| Keyboard Layout | us, fr, or your preferred layout |
Recommended Services Settings
| Parameter | Recommended Value |
|---|---|
| Enable SSH | Yes |
| SSH Authentication | Password authentication for beginners, SSH key for better security |
| Username for SSH | mourad |
9. Write the Operating System to the microSD Card
“`After selecting the device, OS, storage, and configuration settings, click Write or Next.
Raspberry Pi Imager will:
- Download the selected operating system if needed.
- Erase the microSD card.
- Write the OS image to the card.
- Verify that the image was written correctly.
When the process finishes, Raspberry Pi Imager will show a success message. You can then safely remove the microSD card from your computer.
“`10. Insert the microSD Card into the Raspberry Pi 4
“`Make sure the Raspberry Pi is powered off. Insert the prepared microSD card into the microSD slot of the Raspberry Pi 4.
Then connect:
- USB-C power supply
- Ethernet cable if using wired network
- HDMI screen if using desktop mode
- Keyboard and mouse if needed
11. First Boot
“`Power on the Raspberry Pi 4. The first boot may take a little longer than normal because Raspberry Pi OS expands the filesystem and applies your configuration.
After the first boot, your Raspberry Pi should connect to your network automatically if Wi-Fi or Ethernet was configured correctly.
“`12. Find the Raspberry Pi IP Address
“`To connect to your Raspberry Pi by SSH, you need its IP address. You can find it using one of these methods:
Method 1: Check Your Router
Open your router admin page and look for connected devices. Search for the hostname you configured, for example raspberrypi or pi4-server.
Method 2: Use ping with Hostname
ping raspberrypi.local
Method 3: Scan Your Local Network
On Linux, you can use:
ip neigh
“`
13. Connect to Raspberry Pi Using SSH
“`If SSH was enabled in Raspberry Pi Imager, you can connect from your computer using:
ssh mourad@raspberrypi.local
Or using the IP address:
ssh mourad@192.168.1.104
Replace 192.168.1.104 with the real IP address of your Raspberry Pi.
14. Update Raspberry Pi OS After Installation
“`After logging in for the first time, update the system packages.
sudo apt update
```
sudo apt full-upgrade -y
“`
After the update, reboot the Raspberry Pi:
sudo reboot
“`
15. Optional: Open Raspberry Pi Configuration Tool
“`You can use raspi-config to configure system options after installation.
sudo raspi-config
Useful options include:
- Enable or disable SSH
- Change hostname
- Configure Wi-Fi country
- Set timezone
- Enable interfaces such as I2C, SPI, Serial, or Camera
- Expand filesystem if needed
16. Optional: Enable Interfaces for IoT Projects
“`If you plan to use your Raspberry Pi 4 for IoT, sensors, LoRa, MQTT, or serial communication, you may need to enable hardware interfaces.
| Interface | Use Case |
|---|---|
| SSH | Remote terminal access |
| SPI | LoRa modules, displays, ADC modules |
| I2C | Sensors such as BME280, INA219, OLED displays |
| Serial | GPS modules, Arduino communication, LoRa HAT serial mode |
| VNC | Remote desktop access |
Open the configuration tool:
sudo raspi-config
Then go to:
Interface Options → Enable SSH / SPI / I2C / Serial
“`
17. Recommended Basic Security After Installation
“`After installing Raspberry Pi OS, apply these basic security steps:
- Use a strong password.
- Keep the system updated.
- Disable services you do not use.
- Use SSH keys instead of password login for better security.
- Do not expose SSH directly to the internet without protection.
You can check your current username with:
whoami
You can check the hostname with:
hostname
“`
18. Troubleshooting Common Problems
“`Problem 1: Raspberry Pi Does Not Boot
- Check that the microSD card was written successfully.
- Use a good-quality power supply.
- Try another microSD card.
- Make sure you selected Raspberry Pi 4 in Raspberry Pi Imager.
Problem 2: Cannot Connect by SSH
- Make sure SSH was enabled in Raspberry Pi Imager.
- Check that the Raspberry Pi is connected to the same network as your computer.
- Check the IP address from your router.
- Try using the IP address instead of raspberrypi.local.
ssh mourad@192.168.1.104
Problem 3: Wi-Fi Does Not Connect
- Check the SSID and Wi-Fi password.
- Make sure the wireless country is correct.
- Try Ethernet first, then fix Wi-Fi from the terminal.
Problem 4: Wrong Keyboard Layout
Open the configuration tool and change the keyboard layout:
sudo raspi-config
“`
Final Result
“`At the end of this tutorial, your Raspberry Pi 4 is ready with Raspberry Pi OS installed on the microSD card. You should now have:
- A bootable Raspberry Pi OS microSD card.
- A configured username and password.
- Wi-Fi or Ethernet network access.
- SSH access enabled.
- Correct timezone and keyboard layout.
- An updated Raspberry Pi system ready for projects.
| Example Username | mourad |
|---|---|
| Example Hostname | raspberrypi |
| Example SSH Command | ssh [email protected] |
| Recommended Timezone | Africa/Algiers |
Official Links
“`Use the official Raspberry Pi website to download Raspberry Pi Imager and read the official documentation:
“`Conclusion
This article highlights key aspects and practical applications of the discussed technology.
References
- IEEE Xplore Digital Library
- SpringerLink Research
- Google Scholar
Author: Mourad Elgorma
IoT & Networking Specialist
👉 Read more: Explore more ICT articles

