-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3170 from raspberrypi/develop
Push to production
- Loading branch information
Showing
8 changed files
with
35 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 22 additions & 53 deletions
75
documentation/asciidoc/computers/configuration/headless.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,46 @@ | ||
== Setting up a Headless Raspberry Pi | ||
[[setting-up-a-headless-raspberry-pi]] | ||
== Set up a headless Raspberry Pi | ||
|
||
To use your Raspberry Pi without a monitor or keyboard (known as headless), you need to enable wireless networking and SSH. | ||
A **headless** Raspberry Pi runs without a monitor, keyboard, or mouse. To run a Raspberry Pi headless, you need a way to access it from another computer. To access your Raspberry Pi remotely, you'll need to connect your Raspberry Pi to a network, and a way to access the Raspberry Pi over that network. | ||
|
||
If you haven't already imaged your Raspberry Pi, you can set up wireless networking and SSH during the xref:getting-started.adoc#installing-the-operating-system[imaging process]. | ||
To connect your Raspberry Pi to a network, you can either plug your device into a wired connection via Ethernet or configure wireless networking. | ||
|
||
If you already have an image on the micro SD card, you can access the xref:configuration.adoc#the-boot-folder[boot folder] by inserting the card into a card reader on a Linux or Windows machine. Adding certain files to this folder will activate certain setup features on the first boot of the Raspberry Pi. | ||
To access your Raspberry Pi over that network, use SSH. Once you've connected over SSH, you can use `raspi-config` to xref:remote-access.adoc#vnc[enable VNC] if you'd prefer a graphical desktop environment. | ||
|
||
If you plan on using VNC to access the desktop environment of your headless Raspberry Pi, use the `raspi-config` tool to set a xref:configuration.adoc#resolution[default display resolution]. | ||
If you're setting up your Raspberry Pi from scratch, set up wireless networking and SSH during the xref:getting-started.adoc#installing-the-operating-system[imaging process]. If you've already got a Raspberry Pi set up, you can configure SSH using `raspi-config`. | ||
|
||
IMPORTANT: If you are installing Raspberry Pi OS, and intend to run it headless, you will need to create a new user account. Since you will not be able to create the user account xref:getting-started.adoc#configuration-on-first-boot[using the first-boot wizard] as it requires both a monitor and a keyboard, you *MUST* add a `userconf.txt` file to the boot folder to create a user on first boot or configure the OS with a user account using the xref:getting-started.adoc#advanced-options[Advanced Menu] in the Raspberry Pi Imager. | ||
WARNING: Depending on the model and SD card, your Raspberry Pi may require up to 5 minutes to boot and connect to your wireless network the first time it boots. | ||
|
||
=== Configuring Networking | ||
=== Connect to a wired network | ||
|
||
You will need to define a `wpa_supplicant.conf` file for your particular wireless network. Put this file onto the boot folder of the SD card. When the Raspberry Pi boots for the first time, it will copy that file into the correct location in the Linux root file system and use those settings to start up wireless networking. | ||
To connect to a wired network at first boot, plug your headless Raspberry Pi in via Ethernet, or an Ethernet adapter if your Raspberry Pi model does not include an Ethernet port. Your Raspberry Pi will automatically connect to the network. | ||
|
||
The Raspberry Pi's IP address will not be visible immediately after power on, so this step is crucial to connect to it headlessly. Depending on the OS and editor you are creating this on, the file could have incorrect newlines or the wrong file extension so make sure you use an editor that accounts for this. Linux expects the line feed (LF) newline character. | ||
=== Connect to a wireless network | ||
|
||
WARNING: After your Raspberry Pi is connected to power, make sure to wait a few (up to 5) minutes for it to boot up and register on the network. | ||
To configure wireless network access at first boot in a headless Raspberry Pi, use the advanced settings menu in Raspberry Pi Imager. Enter the SSID and password of your preferred wireless network. Your Raspberry Pi will use these credentials to connect to the network on first boot. Some wireless adapters and some Raspberry Pi boards do not support 5Ghz networks; check the documentation for your wireless module to ensure compatibility with your preferred network. | ||
|
||
A xref:configuration.adoc#wireless-networking-command-line[`wpa_supplicant.conf`] file example: | ||
NOTE: Previous versions of Raspberry Pi OS made use of a `wpa_supplicant.conf` file which could be placed into the boot folder to configure wireless network settings. This is no longer possible from Raspberry Pi OS Bookworm onwards. | ||
|
||
---- | ||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev | ||
country=<Insert 2 letter ISO 3166-1 country code here> | ||
update_config=1 | ||
network={ | ||
ssid="<Name of your wireless LAN>" | ||
psk="<Password for your wireless LAN>" | ||
} | ||
---- | ||
|
||
Where the country code should be set the two letter ISO/IEC alpha2 code for the country in which you are using, e.g. | ||
|
||
* GB (United Kingdom) | ||
* FR (France) | ||
* DE (Germany) | ||
* US (United States) | ||
* SE (Sweden) | ||
=== Remote access | ||
|
||
Here is a more elaborate example that should work for most typical wpa2 personal networks. This template below works for 2.4ghz/5ghz hidden or not networks. The utilization of quotes around the ssid - psk can help avoid any oddities if your network ssid or password has special chars (! @ # $ etc) | ||
|
||
---- | ||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev | ||
update_config=1 | ||
country=<Insert 2 letter ISO 3166-1 country code here> | ||
network={ | ||
scan_ssid=1 | ||
ssid="<Name of your wireless LAN>" | ||
psk="<Password for your wireless LAN>" | ||
proto=RSN | ||
key_mgmt=WPA-PSK | ||
pairwise=CCMP | ||
auth_alg=OPEN | ||
} | ||
---- | ||
With no keyboard or monitor, you need a way to xref:remote-access.adoc[remotely control] your headless Raspberry Pi. On first boot, the only option is SSH. To enable SSH on a fresh installation of Raspberry Pi OS, choose one of the following methods: | ||
|
||
NOTE: Some older Raspberry Pi boards and some USB wireless dongles do not support 5GHz networks. | ||
* enable SSH in the Advanced Menu of Raspberry Pi Imager, then enter a username and password | ||
* create a file named `ssh` at the root of the SD card, then configure a user manually with `userconf.txt` following the instructions in the section below | ||
|
||
NOTE: With no keyboard or monitor, you will need some way of xref:remote-access.adoc[remotely accessing] your headless Raspberry Pi. For headless setup, SSH can be enabled by placing a file named `ssh`, without any extension, onto the boot folder of the SD Card. For more information see the section on xref:remote-access.adoc#ssh[setting up an SSH server]. | ||
For more information, see xref:remote-access.adoc#ssh[set up an SSH server]. Once you've connected over SSH, you can use `raspi-config` to xref:remote-access.adoc#vnc[enable VNC] if you'd prefer a graphical desktop environment. | ||
|
||
[[configuring-a-user]] | ||
=== Configuring a User | ||
==== Configure a user manually | ||
|
||
You will need to add a `userconf.txt` in the boot partition of the SD card; this is the part of the SD card which can be seen when it is mounted in a Windows or MacOS computer. | ||
At the root of your SD card, create a file named `userconf.txt`. | ||
|
||
This file should contain a single line of text, consisting of `username:password` – so your desired username, followed immediately by a colon, followed immediately by an *encrypted* representation of the password you want to use. | ||
This file should contain a single line of text, consisting of `<username>:<password>`: your desired username, followed immediately by a colon, followed immediately by an *encrypted* representation of the password you want to use. | ||
|
||
To generate the encrypted password, the easiest way is to use OpenSSL on a Raspberry Pi that is already running – open a terminal window and enter: | ||
To generate the encrypted password, use https://www.openssl.org[OpenSSL] on another computer. Open a terminal and enter the following: | ||
|
||
---- | ||
openssl passwd -6 | ||
---- | ||
|
||
This will prompt you to enter your password, and verify it. It will then produce what looks like a string of random characters, which is actually an encrypted version of the supplied password. | ||
When prompted, enter your password and verify it. This command will then output an encrypted version of the supplied password. |
Binary file modified
BIN
-1.97 MB
(67%)
documentation/asciidoc/computers/configuration/images/blanking.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters