1️⃣ System Preparation¶
Step 1 — Update and Upgrade System Packages¶
Note: Some services may restart automatically after upgrade. Restart any critical ones if needed.
Step 2 — Install Essential Tools¶
Step 3 — Set Timezone and Synchronize Time¶
Note: Ubuntu uses systemd-timesyncd for NTP by default. Set your local timezone (run
timedatectl list-timezonesto find yours) so Gunbot timestamps display correctly.
2️⃣ User and Permissions Setup¶
Step 1 — Create Gunbot User¶
Note: This creates a passwordless user account intended for running Gunbot services securely without direct login.
Step 2 — Add Gunbot User to sudoers¶
Note: Adding Gunbot to the sudo group allows managing services, logs, and SSL updates. For least privilege, use this sudoers rule to restrict commands without password:
echo "gunbot ALL=(ALL) NOPASSWD: /bin/systemctl, /usr/bin/journalctl, /usr/bin/certbot" | sudo tee /etc/sudoers.d/gunbot
Step 3 — Setup SSH Access for Gunbot User¶
sudo mkdir /home/gunbot/.ssh
sudo nano /home/gunbot/.ssh/authorized_keys
sudo chown -R gunbot:gunbot /home/gunbot/.ssh
sudo chmod 700 /home/gunbot/.ssh
sudo chmod 600 /home/gunbot/.ssh/authorized_keys
Note: Verify SSH access for the Gunbot user before closing your current session.
3️⃣ Firewall Configuration¶
Step 1 — Enable and Configure UFW¶
Note: Ensure SSH is allowed before enabling UFW (
sudo ufw statusshould show OpenSSH as ALLOW).
Step 2 — Allow SSH and HTTP/HTTPS¶
Step 3 — Enable UFW¶
Note: Ensure SSH is allowed before enabling UFW (
sudo ufw statusshould show OpenSSH as ALLOW).