Your First Server: Access and Orientation
System administration means keeping machines running, secure and recoverable. This track assumes you have finished Linux & the Command Line. Practise on a cheap cloud VPS (Hetzner, DigitalOcean, Linode, AWS Lightsail) or a local virtual machine, never first on a production server.
Connecting
ssh root@203.0.113.10 # first login, often with a password or provider key
ssh -i ~/.ssh/id_ed25519 panda@203.0.113.10
Save hosts in ~/.ssh/config so you can type ssh web1:
Host web1
HostName 203.0.113.10
User panda
IdentityFile ~/.ssh/id_ed25519
Orientation checklist
Run these on any machine you have not seen before:
cat /etc/os-release # which distribution and version
uname -r # kernel version
hostnamectl # hostname, OS, virtualisation
uptime # how long since reboot, load
nproc && free -h # CPU cores and memory
df -h # disks and free space
ip -brief addr # network interfaces and IPs
ss -tulpn # which programs listen on which ports
systemctl --failed # services that crashed
last -n 10 # recent logins
Ten commands, and you know the machine's size, health, exposure and recent history.
Distributions
| Family | Examples | Package tool |
|---|---|---|
| Debian | Debian, Ubuntu | apt |
| Red Hat | RHEL, Rocky, AlmaLinux, Fedora | dnf |
| Alpine | Alpine (common in containers) | apk |
This track uses Ubuntu LTS commands. The concepts carry over to every distribution.
First tasks on a new server
- Update everything:
sudo apt update && sudo apt full-upgrade -y. - Set the timezone and hostname:
sudo timedatectl set-timezone UTC,sudo hostnamectl set-hostname web1. - Create a personal admin user (next module).
- Lock down SSH (module "Securing SSH and the Firewall").
- Turn on automatic security updates.
Use UTC on servers. Logs from several machines and time zones are impossible to correlate otherwise.
Keep a runbook
Write down every change you make in a RUNBOOK.md: what, why, and how to undo it. When something breaks at 2 a.m., or when you hand the server to someone else, this file is worth more than your memory.
Check yourself
- Which command shows listening ports and the programs behind them?
- Why should servers use UTC?
- What are the five first tasks on a new server?
Seu progresso fica salvo apenas neste navegador.
Enviar para revisão (10 pontos)