Manajemen Service
Bab ini penting karena semua aplikasi di server (Apache, Nginx, MySQL, SSH, dll.) berjalan sebagai service. Dengan menguasai systemctl, kamu bisa mengontrol hidup-mati service, cek status, dan mengatur agar otomatis aktif saat booting.
📑 Bab 4 – SOP Manajemen Service di Ubuntu Server
1. Tujuan
Memberikan panduan standar untuk:
- Mengelola service (start, stop, restart, reload).
- Mengecek status service.
- Mengatur service agar otomatis aktif saat boot.
- Melakukan troubleshooting dasar jika service bermasalah.
2. Lingkup
- Sistem operasi: Ubuntu Server.
- Service yang umum: Apache2, Nginx, MySQL, SSH, UFW (firewall).
3. Langkah Kerja
3.1 Melihat Status Service
Gunakan perintah:
sudo systemctl status apache2
Output akan menunjukkan apakah service active (running) atau inactive (dead).
3.2 Menghidupkan & Mematikan Service
- Start service (menyalakan):
sudo systemctl start apache2 - Stop service (mematikan):
sudo systemctl stop apache2
3.3 Restart & Reload Service
- Restart (matikan lalu nyalakan ulang):
sudo systemctl restart apache2 - Reload (muat ulang konfigurasi tanpa mematikan service):
sudo systemctl reload apache2
3.4 Enable & Disable Service
- Enable (otomatis aktif saat booting):
sudo systemctl enable apache2 - Disable (tidak otomatis aktif):
sudo systemctl disable apache2
3.5 Melihat Semua Service Aktif
systemctl list-units --type=service --state=running
3.6 Contoh Praktik
- Cek status Apache:
sudo systemctl status apache2 - Restart Apache setelah edit konfigurasi:
sudo systemctl restart apache2 - Pastikan Apache otomatis aktif saat boot:
sudo systemctl enable apache2
4. Command Ringkas
| Fungsi | Command |
|---|---|
| Cek status service | sudo systemctl status nama_service |
| Start service | sudo systemctl start nama_service |
| Stop service | sudo systemctl stop nama_service |
| Restart service | sudo systemctl restart nama_service |
| Reload konfigurasi | sudo systemctl reload nama_service |
| Enable auto start | sudo systemctl enable nama_service |
| Disable auto start | sudo systemctl disable nama_service |
| Lihat semua service aktif | systemctl list-units --type=service --state=running |
5. Catatan Penting
- Gunakan
restartsetelah mengubah konfigurasi service. - Gunakan
reloadjika hanya ingin muat ulang konfigurasi tanpa downtime. - Pastikan service penting (SSH, firewall, web server) selalu
enableagar otomatis aktif saat boot. - Jika service gagal start, cek log di
/var/log/(misalnya/var/log/apache2/error.log).
👉 Dengan bab ini, kamu sudah bisa mengontrol penuh service di Ubuntu Server.
Komentar
Posting Komentar