Foundational Server Configuration
After your new Arh24.com VPS is deployed, performing a few initial setup steps is crucial for security and usability. This guide outlines the essential best practices for any new Linux server.
Prerequisite: You must first be connected to your server via SSH as the root
user.
Step 1: Update Your System
The first action on any new server should be to update all system packages to their latest versions. This ensures you have the most recent security patches.
For Debian/Ubuntu systems:
apt update && apt upgrade -y
For AlmaLinux/Rocky Linux/CentOS systems:
dnf update -y
Step 2: Create a New Sudo User
Operating directly as the root
user for routine tasks is a security risk. It is best practice to create a new user account with administrative (sudo) privileges.
- Create the new user (replace `newuser` with your desired username):
You will be prompted to set a password and fill in some optional information.adduser newuser
- Add the new user to the `sudo` (or `wheel` on CentOS-based systems) group to grant them administrative rights:
On Debian/Ubuntu:
usermod -aG sudo newuser
On AlmaLinux/Rocky/CentOS:
usermod -aG wheel newuser
After this, you should log out and log back in as your new user.
Step 3: Set Up a Basic Firewall
A firewall is your first line of defense. UFW (Uncomplicated Firewall) is a user-friendly tool available on most systems.
- Allow SSH connections so you don't lock yourself out:
ufw allow OpenSSH
- Enable the firewall:
Press `y` to confirm.ufw enable
- If you plan to host websites, allow HTTP and HTTPS traffic:
ufw allow http ufw allow https
With these foundational steps complete, your server is now significantly more secure and ready for application or control panel installation.