services 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #!/usr/bin/env bash
  2. # NAME: Enable and configure system services
  3. set -euo pipefail
  4. echo "Enabling and configuring system services..."
  5. # ═══════════════════════════════════════════════════════════
  6. # 🌐 NETWORKING SERVICES
  7. # ═══════════════════════════════════════════════════════════
  8. echo "Enabling networking services..."
  9. # NetworkManager (main network management)
  10. sudo systemctl enable --now NetworkManager.service
  11. # Bluetooth
  12. sudo systemctl enable --now bluetooth.service
  13. # SSH daemon
  14. sudo systemctl enable --now sshd.service
  15. # ═══════════════════════════════════════════════════════════
  16. # 🔊 AUDIO SERVICES
  17. # ═══════════════════════════════════════════════════════════
  18. echo "Enabling audio services..."
  19. # PipeWire audio (replaces PulseAudio)
  20. systemctl --user enable --now pipewire.service
  21. systemctl --user enable --now pipewire-pulse.service
  22. systemctl --user enable --now wireplumber.service
  23. # ═══════════════════════════════════════════════════════════
  24. # 🖨️ PRINTING SERVICES
  25. # ═══════════════════════════════════════════════════════════
  26. echo "Enabling printing services..."
  27. # CUPS printing system
  28. sudo systemctl enable --now cups.service
  29. # ═══════════════════════════════════════════════════════════
  30. # ⏰ TIME & SCHEDULING SERVICES
  31. # ═══════════════════════════════════════════════════════════
  32. echo "Configuring time and scheduling services..."
  33. echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen
  34. sudo locale-gen
  35. # Set system locale
  36. echo "LANG=en_US.UTF-8" | sudo tee /etc/locale.conf
  37. echo "→ System locale set to en_US.UTF-8"
  38. sudo timedatectl set-timezone America/Montevideo
  39. # Enable NTP time synchronization
  40. sudo timedatectl set-ntp true
  41. sudo systemctl enable --now systemd-timesyncd.service
  42. # Cron daemon for scheduled tasks
  43. sudo systemctl enable --now cronie.service
  44. # ═══════════════════════════════════════════════════════════
  45. # 🔒 SECURITY & FIREWALL SERVICES
  46. # ═══════════════════════════════════════════════════════════
  47. echo "Enabling security services..."
  48. # UFW firewall
  49. sudo systemctl enable --now ufw.service
  50. # Enable basic firewall rules
  51. sudo ufw --force enable
  52. sudo ufw default deny incoming
  53. sudo ufw default allow outgoing
  54. # ═══════════════════════════════════════════════════════════
  55. # 💾 BACKUP & SYNC SERVICES
  56. # ═══════════════════════════════════════════════════════════
  57. echo "Enabling backup services..."
  58. # Snapper for BTRFS snapshots (if using BTRFS)
  59. if findmnt / -t btrfs &>/dev/null; then
  60. sudo systemctl enable --now snapper-timeline.timer
  61. sudo systemctl enable --now snapper-cleanup.timer
  62. echo "→ Snapper enabled (BTRFS detected)"
  63. else
  64. echo "→ Skipping Snapper (no BTRFS detected)"
  65. fi
  66. # ═══════════════════════════════════════════════════════════
  67. # ⚡ POWER MANAGEMENT
  68. # ═══════════════════════════════════════════════════════════
  69. echo "Enabling power management..."
  70. # Power profiles daemon
  71. sudo systemctl enable --now power-profiles-daemon.service
  72. # ═══════════════════════════════════════════════════════════
  73. # 🔧 SYSTEM OPTIMIZATION
  74. # ═══════════════════════════════════════════════════════════
  75. echo "Enabling system optimization..."
  76. # Haveged entropy daemon
  77. sudo systemctl enable --now haveged.service
  78. # Locate database updates
  79. sudo systemctl enable --now plocate-updatedb.timer