On this page
- Before you begin
- Check whether the server is online
- Connect with Wi-Fi on a desktop
- Connect with a network cable (recommended)
- Connect with Wi-Fi in the terminal on Linux Mint or Raspberry Pi OS
- Connect with Wi-Fi in the terminal on Ubuntu Server
- Connect with Wi-Fi in the terminal on Debian
- Things to note
- If it does not work
- Find out more
How-to
Connect to the internet, by cable or Wi-Fi
Check that your server is online, and connect it by network cable or Wi-Fi: with the network icon on a computer with a desktop, or with commands in the terminal on one without. At the end, the server can reach the internet and you are ready to run the Run first script.
Before you begin
- Linux is installed on the server. Read Install Linux on a computer.
- A monitor and keyboard on the server. With no desktop, a terminal open on it: read The terminal: entering commands.
- For Wi-Fi: your Wi-Fi network's name and password.
- Some commands in this article have quotes
"and other symbols in them. If a symbol is not where you expect on your keyboard, read Symbols that are in different places on different keyboards.
Check whether the server is online
- Enter this command and press Enter:
ping -c 3 debian.org
- Read what it prints:
- Lines that end in a time, such as
time=14.2 ms, and "0% packet loss": the server is online. You do not need the rest of this page. - "Temporary failure in name resolution" or "Network is unreachable": the server is not online. Follow the section for your connection in this article.
Connect with Wi-Fi on a desktop
On Linux Mint and on Raspberry Pi OS with the desktop, the network icon shows the Wi-Fi networks nearby.
- Select the network icon: in the panel on Linux Mint, in the taskbar on Raspberry Pi OS.
- Select your Wi-Fi network's name.
- Enter its password and select Connect. On Raspberry Pi OS, select OK.
- When the icon shows the Wi-Fi signal, the computer is online. It connects by itself every time it starts.
To check from a terminal, use the ping command in Check whether the server is online.
Connect with a network cable (recommended)
A cable is faster and more reliable than Wi-Fi for a server.
- Plug the cable into the server and into your router.
- Wait 10 seconds, then check again with the
pingcommand. Most systems connect a cable by themselves. - Debian with no desktop, if it is still not online: Debian sets up only the network it saw while it was being installed. List the server's network connections:
ip -br link
The cable's connection has a name such as enp3s0 or eno1: not lo, and not a name starting with wl, which
is Wi-Fi.
4. Add it to Debian's network settings, with your connection's name in place of enp3s0 in both places. It asks for
your password:
printf 'allow-hotplug enp3s0\niface enp3s0 inet dhcp\n' | sudo tee -a /etc/network/interfaces
- Start it, again with your connection's name:
sudo ifup enp3s0
- Check again with the
pingcommand.
Connect with Wi-Fi in the terminal on Linux Mint or Raspberry Pi OS
These use a program called NetworkManager, which you control with the nmcli command. On Raspberry Pi OS Lite,
sudo raspi-config also sets up Wi-Fi, under System Options then Wireless LAN.
- List the Wi-Fi networks the server can find:
nmcli device wifi list
- Connect to yours, with its name in place of
My network. Keep the quotes:
nmcli --ask device wifi connect "My network"
- When it asks for the password, enter it and press Enter. Nothing appears as you enter it.
- Check again with the
pingcommand. The server connects by itself every time it starts.
Connect with Wi-Fi in the terminal on Ubuntu Server
Ubuntu Server keeps its network settings in a file. If you set up Wi-Fi while installing Ubuntu, it is set up already.
- Find the Wi-Fi connection's name. It starts with
wl, such aswlan0orwlp2s0:
ip -br link
- Open a new settings file. It asks for your password:
sudo nano /etc/netplan/60-wifi.yaml
- Enter these lines, with your connection's name, your network's name and its password in place of
wlan0,My networkandmy-wifi-password. The spaces at the start of each line matter: use spaces, not Tab:
network:
version: 2
wifis:
wlan0:
dhcp4: true
access-points:
"My network":
password: "my-wifi-password"
- Save the file: press Ctrl and O, then Enter, then Ctrl and X to close it.
- Keep the password private to the administrator, then apply the settings:
sudo chmod 600 /etc/netplan/60-wifi.yaml
sudo netplan apply
- Check again with the
pingcommand in Check whether the server is online.
Connect with Wi-Fi in the terminal on Debian
A minimal Debian has no Wi-Fi tools unless you set up Wi-Fi while installing it. Connect a network cable for now, with Connect with a network cable, then install NetworkManager:
sudo apt install network-manager
After that, follow Connect with Wi-Fi in the terminal on Linux Mint or Raspberry Pi OS. Keep the cable plugged in until Wi-Fi works.
Things to note
- For a server, a network cable is better: Wi-Fi is slower, drops out more often, and can slow down films that are playing on other devices.
- Give the server the same address every time, so your bookmarks keep working. Most routers call this an address reservation or a static lease.
If it does not work
pingworks with1.1.1.1but not withdebian.org: the server is online but cannot find the addresses for names. Restart it and try again; if it still fails, check the DNS setting on your router.nmcli: command not found: this Linux does not use NetworkManager. Use the section for your Linux in this article.- "No Wi-Fi device found" or no name starting with
wl: the server has no Wi-Fi, or its Wi-Fi needs extra files. Use a network cable. - "Error: Connection activation failed: Secrets were required": the password was not right. Run the connect command again and enter it carefully.
Find out more
This page on GitHub, where the help is written.