Arch Linux System Configuration - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Arch Linux System Configuration Guide
Complete beginner-friendly guide to configuring Arch Linux system settings, including systemd, services, users, and system administration.
Table of Contents
- Systemd Basics
- Service Management
- User Management
- System Information
- Time and Locale
- Hostname Configuration
- System Maintenance
Systemd Basics
What is Systemd?
systemd is the init system and service manager.
Functions:
- Manages services
- Handles boot process
- Controls system resources
- Manages users and sessions
Systemd Components
Main components:
- systemd: Core system manager
- systemctl: Service control
- journalctl: Log viewing
- systemd-analyze: Boot analysis
Service Management
Enable Service
Start service at boot:
# Enable service
sudo systemctl enable service-name
# Enable and start
sudo systemctl enable --now service-name
Example:
# Enable NetworkManager
sudo systemctl enable NetworkManager
# Enable and start
sudo systemctl enable --now NetworkManager
Start/Stop Service
Control services:
# Start service
sudo systemctl start service-name
# Stop service
sudo systemctl stop service-name
# Restart service
sudo systemctl restart service-name
# Reload service (if supported)
sudo systemctl reload service-name
Service Status
Check service status:
# Check status
systemctl status service-name
# Check if running
systemctl is-active service-name
# Check if enabled
systemctl is-enabled service-name
Example output:
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; preset: disabled)
Active: active (running) since Mon 2024-01-15 10:00:00 UTC; 5min ago
List Services
List all services:
# List all services
systemctl list-units --type=service
# List running services
systemctl list-units --type=service --state=running
# List enabled services
systemctl list-unit-files --type=service --state=enabled
Disable Service
Stop service from starting:
# Disable service
sudo systemctl disable service-name
# Disable and stop
sudo systemctl disable --now service-name
User Management
Create User
Add new user:
# Create user
sudo useradd -m -G wheel username
# Set password
sudo passwd username
Explanation:
-m: Create home directory-G wheel: Add to wheel group (sudo access)
User Groups
Common groups:
- wheel: Sudo access
- audio: Audio device access
- video: Video device access
- optical: Optical drive access
- storage: Storage device access
Add user to group:
# Add to group
sudo usermod -aG group-name username
# Example: Add to audio group
sudo usermod -aG audio username
Log out and back in for groups to take effect.
Delete User
Remove user:
# Remove user (keep home directory)
sudo userdel username
# Remove user and home directory
sudo userdel -r username
Sudo Configuration
Configure sudo:
# Edit sudoers
sudo visudo
Ensure wheel group has sudo:
%wheel ALL=(ALL) ALL
Test sudo:
# Test sudo
sudo whoami
# Should output: root
System Information
System Info
Get system information:
# Kernel version
uname -r
# System information
uname -a
# Hostname
hostname
# Uptime
uptime
Hardware Info
Check hardware:
# CPU info
lscpu
# Memory info
free -h
# Disk info
df -h
# PCI devices
lspci
# USB devices
lsusb
Install Info Tools
Useful tools:
# Install neofetch
sudo pacman -S neofetch
# Display system info
neofetch
# Install inxi
sudo pacman -S inxi
# Detailed system info
inxi -F
⏰ Time and Locale
Set Timezone
Configure timezone:
# List timezones
timedatectl list-timezones
# Set timezone
sudo timedatectl set-timezone America/New_York
# Check timezone
timedatectl
Set System Time
Configure time:
# Enable NTP
sudo timedatectl set-ntp true
# Set time manually (if needed)
sudo timedatectl set-time "2024-01-15 10:00:00"
# Check time
timedatectl status
Configure Locale
Set locale:
# Edit locale
sudo vim /etc/locale.gen
Uncomment desired locale:
en_US.UTF-8 UTF-8
Generate locale:
# Generate locale
sudo locale-gen
# Set locale
echo "LANG=en_US.UTF-8" | sudo tee /etc/locale.conf
Set for user:
# Add to ~/.bashrc or ~/.zshrc
export LANG=en_US.UTF-8
Hostname Configuration
Set Hostname
Configure hostname:
# Set hostname
sudo hostnamectl set-hostname myhostname
# Check hostname
hostnamectl
# Or
hostname
Edit Hosts File
Configure hosts file:
# Edit hosts
sudo vim /etc/hosts
Add entries:
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
System Maintenance
System Updates
Update system:
# Update package database and upgrade (recommended)
# Note: Always use -Syu together to avoid dependency issues
sudo pacman -Syu
# Check for updates
pacman -Qu
Clean Package Cache
Clean old packages:
# Remove old packages
sudo pacman -Sc
# Remove all cached packages
sudo pacman -Scc
Remove Orphan Packages
Clean unused packages:
# List orphans
pacman -Qdt
# Remove orphans
sudo pacman -Rns $(pacman -Qdtq)
System Logs
View system logs:
# View journal logs
journalctl
# View recent logs
journalctl -n 50
# Follow logs
journalctl -f
# View boot logs
journalctl -b
Boot Time
Analyze boot time:
# Boot time analysis
systemd-analyze
# Detailed boot time
systemd-analyze blame
# Critical chain
systemd-analyze critical-chain
Summary
This guide covered:
- Systemd basics - Init system
- Service management - Enable/disable services
- User management - Create/manage users
- System information - Hardware and system info
- Time and locale - Timezone and language
- Hostname - System name
- Maintenance - System upkeep
Key Takeaways:
- systemd manages services
- Use systemctl for services
- Configure users and groups
- Set timezone and locale
- Regular maintenance keeps system healthy
Next Steps
- Arch Linux Bootloader Configuration - Bootloader setup
- Arch Linux Kernel Management - Kernel management
- ArchWiki Systemd: https://wiki.archlinux.org/title/Systemd
This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.