Linux Package Management: apt/yum/dnf and Package Building

Overview Package management is foundational to Linux system administration. Debian-based systems use apt/dpkg, while Red Hat-based systems use yum/dnf/rpm. Understanding both package management ecosystems — their principles and usage — along with repository management, dependency resolution, package building, version pinning, and offline installation, is a prerequisite for efficient operations. This article systematically compares the two ecosystems and dives into practical package building and mirror optimization. apt/dpkg Ecosystem Architecture apt (high-level frontend) │ ├── apt-get → package install/remove/update ├── apt-cache → package query/search └── apt → unified command (user-friendly) │ dpkg (low-level tool) │ ├── dpkg → ....

April 26, 2024 · 19 mins · 3900 words · XuBaojin

Disk I/O Performance Diagnosis and Optimization

Introduction Disk I/O is often the slowest link in the system performance chain. A single mechanical disk seek takes about 10ms, while memory access takes only about 100ns — a 100,000x difference. When business applications experience latency jitter or slow response times, the investigation inevitably points to the I/O subsystem. This article starts from the metrics system, combined with hands-on tool usage and production case studies, to build a reusable I/O diagnosis methodology....

March 27, 2024 · 8 mins · 1627 words · XuBaojin

Scheduled Task Management: cron vs systemd timer

Overview Scheduled tasks are a foundational component of operations automation — log rotation, data backups, certificate renewal, health checks, report generation — nearly every ops scenario relies on scheduled execution. Most people’s understanding of scheduled tasks stops at crontab -e plus a line like 0 2 * * * /path/to/script.sh, but this is far from sufficient in production: who gets notified when a task fails? Who handles execution timeouts? How do you coordinate tasks across multiple machines?...

March 18, 2024 · 21 mins · 4276 words · XuBaojin

Linux Log Management: journald and Log Rotation

Overview Logs are the eyes of system operations. From kernel messages to application logs, from security auditing to performance analysis, logs run through every aspect of troubleshooting. Modern Linux uses journald as the system logging daemon, combined with logrotate for log rotation, forming a complete log management infrastructure. This article dives deep into journald internals and configuration, advanced journalctl query techniques, log rotation strategies, remote log collection solutions, and practical analysis cases....

February 14, 2024 · 14 mins · 2925 words · XuBaojin

systemd Service Management Deep Guide

systemd Architecture Overview systemd is the de facto standard init system for modern Linux distributions, having replaced SysVinit as the default init in most mainstream distributions since 2015. It is not merely a “service starter” but a complete system and service manager. Core Unit Types systemd manages system resources through units, with each unit type corresponding to a specific resource type: Unit Type Extension Purpose service .service System services (daemons) socket ....

February 13, 2024 · 9 mins · 1787 words · XuBaojin

Linux Performance Profiling Toolkit: From top to perf

Overview Performance profiling is a core SRE skill. Linux provides a rich set of performance analysis tools, from the simple top to the powerful perf/eBPF — each with its applicable scenario. Knowing when and how to use these tools is key to quickly identifying performance bottlenecks. This article systematically covers the Linux performance profiling toolkit across five dimensions — CPU, memory, IO, network, and comprehensive tools — and provides use-case quick reference tables and real-world examples....

January 19, 2024 · 18 mins · 3658 words · XuBaojin

Practical Shell Script Automation Tips

Introduction Shell scripts are the most common automation tool for operations engineers. This post records several practical patterns used in the field. Log Rotation Cleanup #!/bin/bash # clean_logs.sh - Log cleanup script LOG_DIR="/var/log/app" KEEP_DAYS=30 find "$LOG_DIR" -name "*.log" -type f -mtime +${KEEP_DAYS} -exec gzip {} \; find "$LOG_DIR" -name "*.gz" -type f -mtime +${KEEP_DAYS} -delete echo "$(date): Log cleanup complete, kept ${KEEP_DAYS} days" Run daily via crontab: 0 2 * * * /opt/scripts/clean_logs....

January 11, 2024 · 2 mins · 369 words · XuBaojin

Linux Filesystem Selection and Performance Optimization

Overview The filesystem is the bridge between the operating system and storage devices, directly impacting data reliability, I/O performance, and operational complexity. Linux supports multiple filesystems, each with its own design trade-offs. This article compares the four mainstream filesystems — ext4, xfs, btrfs, and zfs — and dives into mount parameter optimization, I/O scheduler selection, journal modes, fsync performance, and other core topics, with production-grade selection recommendations and tuning strategies....

January 1, 2024 · 12 mins · 2507 words · XuBaojin

Linux Kernel Parameter Tuning Practical Handbook

Overview The Linux kernel exposes thousands of tunable parameters through /proc/sys/ and the sysctl interface, covering networking, memory, filesystem, security, and more. Properly adjusting these parameters can significantly improve system performance and stability, but blind tuning can be counterproductive. This article systematically covers the sysctl system across four dimensions — networking, file descriptors, memory, and security — and provides production tuning templates and parameter validation methods. sysctl System Viewing and Modifying Parameters # View all parameters $ sysctl -a # View specific parameter $ sysctl net....

December 21, 2023 · 13 mins · 2727 words · XuBaojin

Linux Security Hardening Checklist: From Minimal Installation to Compliance

Introduction A default Linux server installation exposes a far larger attack surface than most realize: unnecessary RPM packages, open network services, permissive SSH configurations, and inactive audit systems. Security hardening is not a one-time operation but a full lifecycle checklist from installation to runtime. This article follows the CIS Benchmark framework to organize hardening essentials, with directly executable configurations for each step. System Minimal Installation Principles Package Management Trimming The core principle of minimal installation: install only what you need, not what you might need....

December 18, 2023 · 12 mins · 2482 words · XuBaojin