Menu
User

DropVPS Team

Writer: Cooper Reagan

How to install logrotate on Ubuntu Server 26.04

How to install logrotate on Ubuntu Server 26.04

Publication Date

05/21/2026

Category

Articles

Reading Time

2 Min

Table of Contents

Logrotate is a Linux utility used to manage log files automatically. It helps rotate, compress, and remove old logs so they do not consume too much disk space on the server.

On a Linux VPS server, installing logrotate is useful for keeping system and application logs under control, especially when services generate large log files every day.

Step 1: Connect to the Ubuntu Server

Access the server using SSH:

ssh root@your_server_ip

Step 2: Update Package Information

Refresh the Ubuntu package index:

apt update

This ensures the server can install the latest available package version from the configured repositories.

Step 3: Check If logrotate Is Already Installed

Many Ubuntu Server installations include logrotate by default. Check the installed version:

logrotate --version

If logrotate is installed, the command will display version and configuration information.

Step 4: Install logrotate on Ubuntu Server 26.04

If the command is not found, install logrotate using APT:

apt install logrotate -y

APT will install logrotate and any required dependencies automatically.

Step 5: Verify the Installation

Check the installed version again:

logrotate --version

You can also confirm the package status:

dpkg -l | grep logrotate

Step 6: Check the Main Configuration File

The main logrotate configuration file is located at:

/etc/logrotate.conf

View the file without editing it:

cat /etc/logrotate.conf

This file contains global log rotation settings used by the system.

Step 7: Check Application-Specific Configurations

Most service-specific logrotate rules are stored inside:

/etc/logrotate.d/

List available configuration files:

ls -lah /etc/logrotate.d/

Packages such as web servers, databases, and system services may place their own log rotation rules in this directory.

Step 8: Test logrotate Manually

Run logrotate in debug mode to check the configuration without making changes:

logrotate -d /etc/logrotate.conf

Debug mode shows what logrotate would do, but it does not rotate or modify log files.

Step 9: Check the logrotate Timer

On modern Ubuntu systems, logrotate is usually triggered automatically by systemd. Check the timer status:

systemctl status logrotate.timer

If needed, enable the timer:

systemctl enable --now logrotate.timer

Check when the timer will run next:

systemctl list-timers | grep logrotate

After installation, logrotate is ready to manage system logs automatically on Ubuntu Server 26.04. The next step is to create or adjust log rotation rules for specific services and application log files.

Linux VPS
U
Loading...

Related Posts