-
-
Notifications
You must be signed in to change notification settings - Fork 2
Arch Linux System Configuration
Complete beginner-friendly guide to configuring Arch Linux system settings, including systemd, services, users, and system administration.
- Systemd Basics
- Service Management
- User Management
- System Information
- Time and Locale
- Hostname Configuration
- System Maintenance
systemd is the init system and service manager.
Functions:
- Manages services
- Handles boot process
- Controls system resources
- Manages users and sessions
Main components:
- systemd: Core system manager
- systemctl: Service control
- journalctl: Log viewing
- systemd-analyze: Boot analysis
Start service at boot:
# Enable service
sudo systemctl enable service-name
# Enable and start
sudo systemctl enable --now service-nameExample:
# Enable NetworkManager
sudo systemctl enable NetworkManager
# Enable and start
sudo systemctl enable --now NetworkManagerControl 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-nameCheck service status:
# Check status
systemctl status service-name
# Check if running
systemctl is-active service-name
# Check if enabled
systemctl is-enabled service-nameExample 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 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=enabledStop service from starting:
# Disable service
sudo systemctl disable service-name
# Disable and stop
sudo systemctl disable --now service-nameAdd new user:
# Create user
sudo useradd -m -G wheel username
# Set password
sudo passwd usernameExplanation:
-
-m: Create home directory -
-G wheel: Add to wheel group (sudo access)
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 usernameLog out and back in for groups to take effect.
Remove user:
# Remove user (keep home directory)
sudo userdel username
# Remove user and home directory
sudo userdel -r usernameConfigure sudo:
# Edit sudoers
sudo visudoEnsure wheel group has sudo:
%wheel ALL=(ALL) ALL
Test sudo:
# Test sudo
sudo whoami
# Should output: rootGet system information:
# Kernel version
uname -r
# System information
uname -a
# Hostname
hostname
# Uptime
uptimeCheck hardware:
# CPU info
lscpu
# Memory info
free -h
# Disk info
df -h
# PCI devices
lspci
# USB devices
lsusbUseful tools:
# Install neofetch
sudo pacman -S neofetch
# Display system info
neofetch
# Install inxi
sudo pacman -S inxi
# Detailed system info
inxi -FConfigure timezone:
# List timezones
timedatectl list-timezones
# Set timezone
sudo timedatectl set-timezone America/New_York
# Check timezone
timedatectlConfigure 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 statusSet locale:
# Edit locale
sudo vim /etc/locale.genUncomment 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.confSet for user:
# Add to ~/.bashrc or ~/.zshrc
export LANG=en_US.UTF-8Configure hostname:
# Set hostname
sudo hostnamectl set-hostname myhostname
# Check hostname
hostnamectl
# Or
hostnameConfigure hosts file:
# Edit hosts
sudo vim /etc/hostsAdd entries:
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
Update system:
# Update package database and upgrade (recommended)
# Note: Always use -Syu together to avoid dependency issues
sudo pacman -Syu
# Check for updates
pacman -QuClean old packages:
# Remove old packages
sudo pacman -Sc
# Remove all cached packages
sudo pacman -SccClean unused packages:
# List orphans
pacman -Qdt
# Remove orphans
sudo pacman -Rns $(pacman -Qdtq)View system logs:
# View journal logs
journalctl
# View recent logs
journalctl -n 50
# Follow logs
journalctl -f
# View boot logs
journalctl -bAnalyze boot time:
# Boot time analysis
systemd-analyze
# Detailed boot time
systemd-analyze blame
# Critical chain
systemd-analyze critical-chainThis 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
- 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.