Linux Server Administration Guide

From Server rental store
Revision as of 16:00, 12 April 2026 by Admin (talk | contribs) (New guide article)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Linux server administration encompasses the essential skills needed to manage, maintain, and troubleshoot Linux-based servers. Whether you are running a VPS or a dedicated server, mastering these fundamentals is critical.

Essential Commands

File System Navigation

ls -la          # list files with details and hidden files
cd /var/www     # change directory
pwd             # print working directory
du -sh /var/*   # disk usage summary
df -h           # filesystem disk space

File Operations

cp -r source/ dest/       # copy recursively
mv oldname newname        # move or rename
rm -rf directory/         # remove directory (use with caution)
chmod 755 script.sh       # set permissions
chown user:group file     # change ownership

Text Processing

cat /var/log/syslog       # view file contents
tail -f /var/log/nginx/access.log  # follow log in real time
grep "error" /var/log/syslog       # search for patterns
nano /etc/nginx/nginx.conf         # edit files

User Management

Creating Users

sudo adduser newuser                  # create user interactively
sudo usermod -aG sudo newuser         # add to sudo group
sudo passwd newuser                   # set or change password

Managing Permissions

Linux permissions follow the owner-group-others model:

  • r (4) — read
  • w (2) — write
  • x (1) — execute

Example: chmod 750 file gives owner full access, group read+execute, others nothing.

Service Management with systemd

Modern Linux distributions use systemd to manage services:

sudo systemctl start nginx       # start a service
sudo systemctl stop nginx        # stop a service
sudo systemctl restart nginx     # restart a service
sudo systemctl enable nginx      # start on boot
sudo systemctl disable nginx     # don't start on boot
sudo systemctl status nginx      # check service status
journalctl -u nginx -f           # view service logs

Creating a Custom Service

Create /etc/systemd/system/myapp.service:

[Unit]
Description=My Application
After=network.target
[Service]
User=appuser
WorkingDirectory=/opt/myapp
ExecStart=/opt/myapp/start.sh
Restart=always
[Install]
WantedBy=multi-user.target

Then:

sudo systemctl daemon-reload
sudo systemctl enable --now myapp

Package Management

Task Debian/Ubuntu CentOS/RHEL
Update package list apt update dnf check-update
Upgrade packages apt upgrade dnf upgrade
Install package apt install nginx dnf install nginx
Remove package apt remove nginx dnf remove nginx
Search packages apt search keyword dnf search keyword

Process Management

ps aux                    # list all processes
top / htop                # interactive process viewer
kill PID                  # terminate a process
kill -9 PID               # force kill
nice -n 10 command        # run with lower priority

Networking

ip addr show              # show network interfaces
ss -tulnp                 # show listening ports
curl -I https://example.com  # check HTTP headers
ping -c 4 8.8.8.8        # test connectivity
traceroute example.com    # trace network path

See Also