On Windows you install software with an installer and manage services in services.msc. On Ubuntu Linux, the package manager apt installs software, and systemd runs services. Learn these two and you can run most Linux servers.
These examples use Ubuntu/Debian. Red Hat-family systems (RHEL, Rocky, Amazon Linux) use
dnfinstead ofapt; thesystemctlcommands are identical.
apt – the software manager
Software comes from repositories: trusted online sources that apt downloads from and checks signatures for.
sudo apt update # refresh the list of available packages (doesn't install)
apt list --upgradable # what can be updated
sudo apt upgrade # install updates
sudo apt install -y nginx # install a package (-y = don't ask)
sudo apt remove nginx # remove it (keeps config files)
sudo apt purge nginx # remove including config
apt search jq # find a package
apt show nginx # details and version
dpkg -l | grep nginx # is it installed?
apt update then apt upgrade is Linux’s monthly patching – often more often. If /var/run/reboot-required exists afterwards, the server needs a restart (usually for a new kernel).
systemd – the service manager
A unit is something systemd manages – most often a .service.
systemctl status nginx # running? since when? last log lines
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl reload nginx # re-read config without dropping connections (if supported)
sudo systemctl enable nginx # start at boot (like Startup type: Automatic)
sudo systemctl disable nginx # don't start at boot
systemctl is-enabled nginx
systemctl list-units --type=service --state=running
systemctl --failed # anything that failed – a great first check
Windows comparison:
| Windows | Linux |
|---|---|
Get-Service x |
systemctl status x |
Start-Service x |
sudo systemctl start x |
| Startup type Automatic | sudo systemctl enable x |
| Services that should run but don’t | systemctl --failed |
| Event Viewer for a service | journalctl -u x (next guide) |
Reading a status
● nginx.service - A high performance web server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: active (running) since Sat 2026-11-28 10:02:11 IST; 1 day ago
Main PID: 812 (nginx)
- Loaded … enabled → starts at boot
- Active: active (running) → healthy; failed → read the log lines below it
Write your own service
Run a script as a proper service – restarted automatically if it crashes:
# /etc/systemd/system/myapp.service
[Unit]
Description=My demo app
After=network-online.target
[Service]
User=myapp
WorkingDirectory=/opt/myapp
ExecStart=/opt/myapp/run.sh
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload # tell systemd about new/changed unit files
sudo systemctl enable --now myapp # enable and start in one step
Run services as a dedicated user, never as root unless they truly need it.
FAQ
apt or apt-get?
Both work. apt is friendlier for people; apt-get has a stable output format, so scripts often use it.
Why didn’t my config change take effect?
Most services read config only at start – reload or restart them. For unit-file changes, run daemon-reload first.
What’s next
Next: Logs and troubleshooting with journalctl.
LinuxsystemdaptUbuntuServicesBeginner