A Linux server is a computer running the Linux operating system that provides a service to other computers, such as hosting a website, storing files, running a database, or sending email, and you manage it mostly by typing commands over a secure remote connection (SSH) instead of clicking through a desktop.
Most of the internet runs on Linux servers. If you want to host your own website, run a database, set up a file server, or work in IT, learning server administration is one of the most useful skills you can build. It looks intimidating at first because there is no desktop and no mouse, but a small set of ideas covers most of the daily work: connect, update, create users, install software, manage services, read logs, and keep backups. This guide walks through each one for a complete beginner. If you are new to Linux itself, start with what Linux is.
What a Linux Server Does
A server is defined by its job, not by special hardware. Common jobs include:
- Web server. Serves websites using software such as Nginx or Apache.
- Database server. Runs a database such as PostgreSQL or MySQL.
- File server. Shares files on a network. See how to set up a Samba server or an SFTP server.
- Application server. Runs your own apps, APIs, or containers.
- Monitoring and utility servers. Run tools such as Uptime Kuma, backups, or a VPN.
A Linux server can be a physical machine, a virtual machine, a rented VPS, a cloud instance, or even a small Raspberry Pi. The administration skills are the same on all of them. For the cloud side, see what cloud computing is, and for renting a server, see Learn VPS.
Why People Choose Linux for Servers
- It is free and open source. There are no license fees, and you can inspect, change, and share the software. See why open source software matters.
- It is stable. Linux servers can run for long periods without rebooting, and most updates apply without downtime.
- It is efficient. A server without a desktop uses few resources, so small machines can do a lot.
- It is flexible and scriptable. Everything can be done from the command line, so tasks can be automated.
- It has a huge community and extensive documentation, which matters when you are stuck.
Choosing a Distribution
A distribution (or distro) is a version of Linux packaged with a package manager and a set of defaults. For servers, the common choices are:
| Distribution | Good for | Package manager |
|---|---|---|
| Ubuntu Server (LTS) | Beginners, tutorials, and the widest community support | apt |
| Debian | Stable, minimal, long-lived servers | apt |
| Rocky Linux / AlmaLinux | Environments that follow the Red Hat family | dnf |
| Fedora Server | Newer software, learning, and testing | dnf |
For a first server, Ubuntu Server LTS is the easiest choice. LTS means long-term support, so you get security updates for years. The examples in this guide use Ubuntu or Debian commands. If you use a Red Hat family distro, the ideas are the same but package commands use dnf and a few service and file names differ.
Getting a Server
You have three simple options:
- Rent a VPS or cloud server. You get a server in minutes with a public address. Good for hosting real services.
- Run a virtual machine on your own computer. Safe for learning. See what a virtual machine is.
- Install on spare hardware or a Raspberry Pi. Good for a home lab. See how to install Ubuntu Linux and Raspberry Pi for beginners.
If you are just learning, use a virtual machine, so a mistake costs you nothing.
Step 1: Connect with SSH
You manage a server remotely using SSH (Secure Shell), which gives you an encrypted command line on the server. From a terminal on your computer:
ssh username@server-ip-address
The first time, you will be asked to trust the server’s fingerprint. After that, you log in with a password or, better, an SSH key. For how keys work and how to set them up, see what SSH is.
Step 2: Update the System
The first thing to do on a new server is to apply updates:
sudo apt update
sudo apt upgrade
apt update refreshes the list of available packages, and apt upgrade installs the newer versions. The word sudo runs a command with administrator rights. Reboot afterward if the system says it is needed:
sudo reboot
Step 3: Create a Regular User and Stop Using Root
The root account can do anything, so mistakes are dangerous and attackers target it. Create a normal user with administrator rights instead:
sudo adduser deploy
sudo usermod -aG sudo deploy
The first command creates a user named deploy (use any name you like), and the second adds it to the sudo group. Log in as that user from now on.
Step 4: Secure SSH
Use key-based login, then turn off password login and direct root login. Keep your current session open while you test, or you can lock yourself out.
From your own computer, copy your key to the server:
ssh-copy-id deploy@server-ip-addressConfirm you can log in with the key from a new terminal.
On the server, edit the SSH configuration:
sudo nano /etc/ssh/sshd_configSet these lines:
PermitRootLogin no PasswordAuthentication noCheck the file for mistakes, then reload SSH:
sudo sshd -t sudo systemctl reload sshOn Red Hat family systems the service is named
sshd.Open a new terminal and confirm you can still log in before closing the old one.
Step 5: Turn On a Firewall
A firewall blocks everything except the services you choose to allow. Ubuntu includes UFW (Uncomplicated Firewall):
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status
Allow SSH before you enable the firewall, or you will cut off your own connection. Open only the ports you need. For what ports are, see well-known port numbers, and for how firewalls fit into a network, see networking devices explained.
Essential Commands
You do not need to memorize hundreds of commands. These cover most of the daily work. For a longer list, see the Linux terminal guide.
| Task | Command |
|---|---|
| Where am I? | pwd |
| List files (with details) | ls -la |
| Change folder | cd /var/log |
| Read a file | less filename |
| Edit a file | nano filename |
| Copy / move / delete a file | cp, mv, rm |
| Search inside files | grep "text" filename |
| Disk space | df -h |
| Folder sizes | du -sh * |
| Memory use | free -h |
| Running processes | top |
| System and distro info | uname -a and cat /etc/os-release |
| Who is logged in | who |
| Restart the server | sudo reboot |
Be careful with rm. There is no recycle bin, and rm -rf on the wrong folder can destroy a server. Read the command twice before you press Enter.
The Linux Directory Layout
Everything in Linux lives in one tree that starts at /. A few folders matter most for server work:
/etcholds configuration files./var/logholds logs./var/wwwis the usual place for website files./homeholds users’ personal files./usrand/opthold installed software./tmpholds temporary files.
Users, Groups, and Permissions
Every file has an owner, a group, and permissions for the owner, the group, and everyone else, each of which can allow read (r), write (w), and execute (x). View them with:
ls -l
Change who owns a file, and what they can do:
sudo chown deploy:deploy myfile.txt
chmod 640 myfile.txt
The number 640 means: the owner can read and write, the group can read, and others get nothing. A good rule is least privilege: give each user and program only the access it needs. Avoid chmod 777, which lets everyone change everything.
Installing and Managing Software
Use the package manager instead of downloading random files:
sudo apt install nginx
sudo apt remove nginx
apt search keyword
Packages come from trusted repositories, are checked for integrity, and are updated with the rest of the system.
Managing Services with systemd
Software that runs in the background, such as a web server or database, is a service. Most modern distributions manage services with systemctl:
sudo systemctl status nginx
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl enable nginx
start and stop act now. enable makes the service start automatically when the server boots. After you install Nginx, you can check that it responds:
curl -I http://localhost
A 200 OK in the first line means the web server is answering.
Reading Logs
When something breaks, the logs usually say why.
sudo journalctl -u nginx -n 50 --no-pager
sudo journalctl -f
sudo tail -n 50 /var/log/syslog
The first command shows the last 50 log lines for one service, the second follows new messages live (press Ctrl+C to stop), and the third shows recent system messages on Debian and Ubuntu. Web server logs are usually under /var/log/nginx/ or /var/log/apache2/.
Basic Networking Commands
ip a
ping -c 4 example.com
ss -tulpn
ip ashows your network interfaces and IP addresses. See Internet Protocol explained.pingtests whether another machine is reachable.ss -tulpnshows which programs are listening on which ports, which is useful for checking that only the services you expect are exposed.
Keep It Updated Automatically
Security updates matter most on a server that faces the internet. Ubuntu can install them for you:
sudo apt install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades
This installs security updates automatically. You should still log in regularly to apply other updates, check disk space, and reboot when needed.
Back Up Your Data
A server without a tested backup is one mistake away from disaster.
- Back up configuration and data, such as
/etc, website files, and databases. - Keep a copy off the server, on another machine or storage service.
- Test restoring at least once.
Two simple tools:
tar -czf etc-backup.tar.gz /etc
rsync -avz /var/www/ backupuser@backup-host:/backups/www/
tar bundles and compresses files into one archive, and rsync copies only what changed, over SSH. To run a backup on a schedule, use cron:
crontab -e
Add a line such as the following to run a script every day at 2:00 AM:
0 2 * * * /usr/local/bin/backup.sh
For databases, see PostgreSQL backup and restore.
Monitor Your Server
Know when something goes wrong before your users do. Basic habits:
- Check
df -handfree -hregularly, since a full disk is a common cause of failures. - Use an uptime monitor such as Uptime Kuma to alert you when a site or service goes down.
- Read the logs when you see odd behavior.
Security Basics Checklist
- Use SSH keys and disable password login
- Do not log in as root
- Turn on the firewall and open only the ports you need
- Apply security updates automatically
- Install only the software you need
- Use strong, unique passwords, and two-factor authentication wherever it is offered
- Keep backups and test them
- Check the logs and the open ports now and then
Servers on the internet get automated login attempts within minutes of going online, so treat security as the first task, not the last. For the bigger picture, see what ransomware is and how to prevent it.
Troubleshooting Quick Reference
| Problem | First things to check |
|---|---|
| Can’t connect with SSH | Is the server running and reachable (ping)? Is the firewall allowing SSH? Are you using the right user, IP address, and key? |
| Website not loading | sudo systemctl status nginx, then the firewall, then the error log. |
| “Permission denied” | Check ls -l for owner and permissions, and whether you need sudo. |
| Disk full | df -h, then du -sh /var/* to find large folders, often logs. |
| Service won’t start | sudo journalctl -u servicename -n 50, and check the configuration file for typos. |
| Server feels slow | top and free -h to see CPU and memory use. |
| Port in use | ss -tulpn to see which program holds it. |
A Learning Plan
- Week 1: Create a virtual machine, install Ubuntu Server, connect with SSH, and practice the essential commands.
- Week 2: Create a regular user, set up SSH keys, turn on the firewall, and enable automatic updates.
- Week 3: Install Nginx, serve a simple page, and read its logs.
- Week 4: Set up a backup with
rsyncand cron, and test a restore. - After that: Try a database, a file server, or containers. See Docker for beginners.
Conclusion
Linux server administration comes down to a handful of habits: connect securely, keep the system updated, give each user only the access they need, run only the services you need, read the logs, and back everything up. Practice on a virtual machine until the commands feel natural, and add one new skill at a time. If you need help setting up or securing a server for your business, you can book a free consultation.
Commands and package names can differ between distributions and versions. Check your distribution’s documentation, and test changes on a non-production server first.
