How to configure a Raspberry Pi without a head, without ever connecting a monitor



[ad_1]

Raspberries are very practical because they are inexpensive and small, but connecting one to your own monitor, keyboard and mouse requires much more space and money. If you are simply trying to program on the Pi or use it to control electronic components such as lights, motors, and sensors, you do not need to connect it to a monitor because you can control the system at remote using a VNC or SSH client from your computer. main computer. We call this configuration without a Raspberry Pi "headless" screen.

By default, the official operating system of Raspberry Pi, Raspbian, is installed with all forms of remote access disabled. But the good news is that you do not need to connect to a monitor so you can turn it on. By following the instructions below, you can create a headless Raspberry Pi that is ready for remote access before starting it for the first time. If you have a monitor and keyboard on hand, check out our guide titled How to set up a Raspberry Pi for the first time.

Install Raspbian on your microSD card

1. Insert a microSD card in your computer. Your card must be 8 GB or more (the light version of Raspbian will use less space).

2 Download Raspbian in .zip format. We recommend using the full version rather than the light version.

3 Down, install and launch Etcher.

4 Click the Select Image button and choose the .zip file you just downloaded.

5 Click on Flash.

Etcher will take a few minutes to install Raspbian on your microSD card. When this is done – at least under Windows – you will see a number of alerts inviting you to format the card. Close these dialog boxes or press Cancel (otherwise you will format on the operating system).

If you do not configure a Raspberry Pi without a head, you can simply insert the card, connect your Pi to a monitor, keyboard, power source, and pointing device, and then start it.

6 Write an empty text file named "ssh" (no file extension) at the root of the map directory. When it sees the "ssh" when it first starts, Raspbian will automatically activate SSH (Secure Socket Shell), which will allow you to remotely access the Pi command line from your PC.

7. Set up a network connection for your Raspberry Pi.

Although you have enabled SSH, which will allow you to connect and issue terminal commands, you still need a way to reach your Pi. You can connect via Wi-Fi / Ethernet, an Ethernet connection direct or direct USB connection (Pi Zero only). Here are the instructions for each.

Without Wi-Fi / Ethernet head

To set up a Wi-Fi connection on your Raspberry Pi without a head, create a text file called wpa_supplicant.conf and place it in the root directory of the microSD card. You will need the following text in the file.

country = US
ctrl_interface = DIR = / var / run / wpa_supplicant GROUP = netdev
update_config = 1
network = {
ssid = "your_wifi_ssid"
scan_ssid = 1
psk = "your_wifi_password"
key_mgmt = WPA-PSK
}

Change the country to "GB" for the UK or another country code for another country, then enter your SSID and password. At startup, Raspbian will connect you to this network. However, if you are on a public Wi-Fi network and you need to click "OK" on a start page before accessing the Internet, this method will not work.

Prefer to use Ethernet? If you connect your Raspberry Pi directly to a wired network, you should be able to access it by its name (raspberrypi or raspberrypi.local) without modifying any other file.

Direct USB connection (Pi Zero / Zero W only)

My preferred connection is via a direct USB connection, connecting my Pi Zero W directly to a port on my PC. This method is excellent because it works wherever you are (even if there is no available Wi-Fi network), and provides both power and a connection to your Pi, via a single cable. However, you can only do this on a Pi Zero or Zero W.

1. Open the config.txt file in the root directory of the micro SD card, and add the line dtoverlay = dwc2 at the bottom of the file and save.

2 Open cmdline.txt and add the text modules-load = dwc2, g_ether after the word rootwait, and save the file. There are no line breaks in this file.

3 Download and install Hello Printing Services Apple.com (if you have Windows). It seems strange that you need an Apple program to access a Pi from Windows, but it helps your PC to see the Pi. Ignore the name; you do not use it for printing.

4 Connect the micro USB cable to the port labeled "USB" on the Pi Zero. This will not work if you connect to the port labeled "PWR". However, the "USB" port will also power your Pi, so you will not need to connect a dedicated power cable.

Direct Ethernet connection

If your PC has an available Ethernet port or you have an Ethernet to USB dongle, you can use a network cable to connect directly from your Pi to your computer. Just make sure that Bonjour is installed on your PC and that SSH is enabled on the Pi (see above). Then you can simply connect both devices via Ethernet.

If you want the Raspberry Pi to get its Internet connection from your PC via the Ethernet port, follow these steps in Windows 10:

1. Navigate to the Network Connections menu, which is part of the old school's control panel. You can access this screen by going to Settings-> Network and Internet-> Wi-Fi, then clicking "Change Adapter Settings" on the right side of the screen. It works whether you are sharing an Internet connection connected to your PC via Wi-Fi or Ethernet.

2. Right-click on the adapter. who is connected to the Internet, and select properties.

3. Enable "Allow other network users to connect" on the "Sharing" tab.

4. Select the Ethernet port connected to the Raspberry Pi from the "Home Network Connection" menu, then click OK.

Connection via SSH

Once the Pi is connected to your network or directly to your PC, you need to establish an SSH connection.

1. Download and install Puttyif you do not have it already. Putty is the main SSH client for Windows.

2 Enter raspberry pie or raspberrypi.local as the address to which you want to connect in Putty, and click Open. You usually need to add the .local file if the Pi is directly connected to your PC via a USB or Ethernet cable.

3 OK if you receive a security alert. This is not a problem.

4 Enter pi as the user name and raspberry as a password. You may want to change them later.

You are now logged in at the command prompt, but if you want to access the GUI, with a desktop and floating windows, you must enable VNC.

Activation and connection on VNC

1. Enter sudo raspi-config at the command prompt.

A configuration application opens.

2 Select the interfacing options (number 5 on the list)

3 Select VNC (number 3 on the menu)

4 Select Yes.

5 Press Enter to acknowledge receipt of the VNC server is enabled.

6 Select Finish

On your PC:

1. Download, install and launch VNC viewer.

2. Select New connection in the File menu.

3. Enter raspberry.local in the "VNC Server" field.. If that does not work, try again with the name "raspberrypi" without .local.

4 Click OK.

5 Double-click on the connection icon to log in.


6 OK if a security warning is presented to you.

7. Enter the user name and password of the Pi when prompted The default values ​​are user name: pi and password: raspberry. Click OK.


Your Raspberry Pi desktop will appear in a desktop window on your main computer. You can control everything from there.

[ad_2]

Source link