Skip to main content

Linux Server Monitoring and Maintenance Essentials

Learn to monitor system resources, manage logs, configure automatic security updates, and set up basic alerting with cron jobs on your Ubuntu server.

Need a server? Get $200 free credits on DigitalOcean
intermediate
cloud
Linux
45 minutes
7 steps
Prerequisites
  • A running Ubuntu 24.04 server with sudo access
  • Basic familiarity with the command line
  • SSH access to your server

You need a running Linux server for this exercise. Any Ubuntu server works, but we recommend DigitalOcean for quick setup.

Get $200 in free credits to get started.

Get Started with DigitalOcean

Disclosure: This is an affiliate link. We may earn a commission at no extra cost to you.

Learning Objectives
  • Monitor CPU, memory, and disk usage with standard Linux tools
  • Use journalctl to read and filter systemd logs
  • Configure logrotate to manage log file sizes
  • Set up automatic security updates with unattended-upgrades
  • Write a simple monitoring script and schedule it with cron
Technologies Used
Ubuntu 24.04
systemd
journalctl
logrotate
cron
unattended-upgrades
Exercise Steps
1

Monitor System Resources

Current

Get a quick overview of your server's health using built-in tools. These commands are the first thing you run when something feels slow or a service stops responding.

2

Monitor Processes and Network Connections

Identify what processes are using the most resources and which network ports are in use.

3

Read and Filter Logs with journalctl

systemd's journal collects logs from all services. journalctl is how you read them. Learning to filter effectively saves a lot of time when debugging.

4

Configure Log Rotation

Log files grow over time and can fill your disk. logrotate compresses and rotates old logs automatically. Nginx installs its own logrotate config, but you should understand how to create one for custom applications.

5

Set Up Automatic Security Updates

Keeping your server patched is critical. Ubuntu's unattended-upgrades package can automatically install security updates so you do not have to do it manually every day.

6

Create a Simple Monitoring Script

Write a shell script that checks disk usage, memory, and load average. If any value crosses a threshold, it writes a warning to a log file. You can later extend this to send email or Slack notifications.

7

Schedule the Monitoring Script with Cron

Use cron to run the health check script every 5 minutes. Cron is the standard job scheduler on Linux and is useful for any recurring task.

Found an issue?