How to Set Up a Headless Raspberry Pi, No Monitor Needed
The Raspberry Pi is very convenient because it’s cheap and small, but connecting one to a dedicated monitor, keyboard, and mouse requires more space and money. If you just want to program with your Pi or control electronics like lights, motors, sensors, etc., you can use VNC or SSH to remotely control your system, so you don’t need to connect to a display or input device. . Install the client on your main computer. This screenless installation is called a headless Raspberry Pi setup.
By default, the Raspberry Pi’s official operating system, Raspberry Pi OS (previously known as Raspbian), is installed with all forms of remote access disabled. The good news, though, is that you don’t need to plug in a monitor and keyboard to power it up. By following the steps below, you can create a headless Raspberry Pi ready for remote access before booting for the first time. If you have a monitor and keyboard handy, check out our guide on how to set up a Raspberry Pi for the first time.
Install Raspberry Pi OS on microSD card
1. Insert a microSD card to your computer. The card should be at least 8GB (the lite version of the Raspberry Pi OS uses less space). We have a list of the best microSD cards for the Raspberry Pi to help you choose the one that optimizes performance.
2. Download, Install, Run raspberry pi imager (opens in new tab).
3. [OS の選択]Click the button. A menu appears.
Four. Select an OS. The best choice for most people is the Raspberry Pi OS (32-bit). However, if you have a Pi 3 or 4, you can use the 64-bit version under “Pi OS (Other)”. There are other options as well.
Five. [ストレージの選択]Click When select card from the menu.
6. Click the settings button Or press CTRL + Shift + X to bring up the settings menu.
A menu appears.
7. Switch host name settings When Change hostname If you want to name your device something other than “raspberrypi”.
8. Toggle Enable SSH on When Select User Password Authentication.
9. Set up a username and password for your Pi. If you use the username ‘pi’ with the password ‘raspberry’, you will get a warning message when logging in, and it is recommended (but not compulsory) that you change your password.
Ten. Setting the Wi-Fi network SSID and password When Country. So [保存]ClickThe country usually defaults to ‘GB’ (United Kingdom), so if you’re in the US you’ll have to scroll down a very long way to get the country code you want.
11. [書き込み]Click. When asked if you want to continue,[はい]Click.
It takes a few minutes for the system to download the OS and write it to the card.
Once done, plug the card into the Raspberry Pi, boot it up, wait a few seconds for it to connect to the network, then try to log in via SSH. But only if you’re using both Wi-Fi networks. The Pi and client PC are connected.
Edit Wi-Fi on written card
Let’s say you already created a card, but forgot to enter the correct Wi-Fi credentials into the Raspberry Pi Imager. Or you may have moved to a different Wi-Fi network. Change Wi-Fi networks without having to connect the screen and keyboard to your Pi.
To set up a Wi-Fi connection on your headless Raspberry Pi, open the microSD card on your PC. Next, create a text file called wpa_supplicant.conf and place it in the root directory of your microSD card. The file should have the following text:
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
scan_ssid=1
ssid="your_wifi_ssid"
psk="your_wifi_password"
}
Change the country to ‘GB’ for the UK or another country code for another country and enter the actual SSID and password. Once booted, the Raspberry Pi OS will log into that network.However, on the splash page before connecting to the Internet[OK]This method won’t work if you’re on a public Wi-Fi network that requires you to click
Want Ethernet? If you connect your Raspberry Pi directly to your wired network, you should be able to access it by its name (raspberrypi or raspberrypi.local) without changing any other files.
Direct USB connection (Pi Zero / Zero W only)
My favorite connection method is the direct USB connection, which connects the Pi Zero W directly to a port on your PC. This method is better. Because it works wherever you are (even if you don’t have Wi-Fi available) and provides both power and connection to your Pi with a single cable. However, this can only be done on the Pi Zero or Zero W.
1. Open the file config.txt to the root directory of the micro SD card, and add line dtoverlay=dwc2 Go to the bottom of the file and save.
2. Open cmdline.txt and add the text modules-load=dwc2,g_ether. After the word rootwait save the file. There are no line breaks in this file.
3. Download and install Bonjour printing service (opens in new tab) From apple.com (if you’re using Windows). It seems strange that you need an Apple program to access your Pi from Windows, but this helps your PC recognize your Pi. Ignore the name. I have not used this for printing.
Four. Connect the micro USB cable to the port labeled “USB”. with Pi Zero. This doesn’t work when connected to the port labeled “PWR”. However, the “USB” port also powers the Pi, so there’s no need to connect a dedicated power line.
direct ethernet connection
If your PC has a spare Ethernet port, or an Ethernet-to-USB dongle, you can use a network cable to connect the Pi directly to your computer. Make sure you have Bonjour installed on your PC and SSH enabled on your Pi (see above). Then simply connect the two devices via Ethernet.
In order for your Raspberry Pi to get internet connectivity from your PC via its Ethernet port, you need to do the following on Windows 10 or 11:
1. [ネットワーク接続]go to menu, part of the old-fashioned control panel. To navigate to this screen,[設定]->[ネットワークとインターネット]->[Wi-Fi]on the right side of the screen.[アダプターの設定の変更]Click. This works whether you’re sharing your Internet connection from Wi-Fi or Ethernet to your PC.
2. Right click on the adapter connected to the internet and Select property.
3. Enable “Allow other network users to connect” In the “Share” tab.
4. Select Ethernet port [ホーム ネットワーク接続]Connected to the Raspberry Pi from the menu[OK]Click.
Connect to Pi via SSH
Once you’ve connected your Pi directly to your network or PC, you’ll need to establish an SSH connection.
1. Download and install putty If you don’t already have one. Putty is the leading SSH client for Windows.
2. Please enter a host name (by default raspberry pi Also raspberrypi.local) as the address you want to connect to with Putty, and [開く]ClickIf your .Pi is directly connected to your PC via USB or Ethernet cable, you usually need to add .local.
3. [OK]Click. If you see a security warning alert. It doesn’t matter.
Four. Please enter your username and password.
Now that you are connected to the command prompt, you need to enable VNC to access the desktop and GUI with floating windows.
Enabling and connecting via VNC
1. Enter sudo raspi-config at the command prompt.
The configuration app will open.
2. Choosing an interface option (Number 5 on the list)
3. Select VNC (Menu No. 3)
Four. [はい]Choose.
Five. press enter Make sure the VNC server is enabled.
6. Choose your finish
On PC:
1. Download, install, launch VNC viewer.
2. Selection new connection from the File menu.
3. Enter your host name (Example: raspberrypi.local) in the “VNC Server” fieldIf this doesn’t work, try again without .local in the name.
Four. [OK]Click.
Five. Double click on the connection icon Connecting.
6. [OK]Click. If you see a security warning.
7. Enter your Pi username and password when prompted.
The Raspberry Pi desktop will appear in a window on your main computer’s desktop. You can control everything from there.