Once you successfully install a Linux server operating system (OS), it can be tempting to immediately start building web servers or databases. However, using the system in its default state without considering security and operational stability puts you at high risk of external hacking attacks or system management errors.
The very first tasks you should perform right after setting up a server are applying the latest patches, configuring account security, and setting up network firewalls. Today, we’ll break down the 5 essential initial settings every beginner administrator must complete after installing a Linux server.
1. Updating and Modernizing Package Systems
System packages installed initially are likely outdated. To patch security vulnerabilities and maintain the latest software versions, you should perform a full system update first.
Commands (Ubuntu/Debian)
Bash
sudo apt update && sudo apt upgrade -y
Commands (RHEL/CentOS/Rocky Linux)
Bash
sudo dnf update -y # or sudo yum update -y
update: Updates the list of available packages (index).upgrade: Upgrades the currently installed software packages to their latest versions.
2. Disabling Direct Root Login & Creating a Sudo User
The root account in Linux is a superuser with unrestricted permissions. Accidental command errors or a compromised root account can devastate your entire server. Therefore, it is far safer to create a separate user account for day-to-day management and restrict direct root access.
① Creating a New User & Granting Sudo Privileges
Bash
# 1. Create a new user (e.g., myadmin)
sudo adduser myadmin
# 2. Add user to the sudo group
sudo usermod -aG sudo myadmin
From now on, log in using your newly created account (e.g., myadmin) instead of root, and make it a habit to prepend sudo only when root privileges are required.
3. Strengthening SSH Security (Changing Port & Disabling Root Login)
Linux servers are typically accessed remotely via SSH (Secure Shell, default Port 22). Hackers frequently target port 22 and the root account using brute-force attacks, so modifying your access settings is essential.
Modifying SSH Configuration
- Open the configuration file:Bash
sudo nano /etc/ssh/sshd_config - Locate and modify the following directives:
Port 22→Port 2222(Change default port to a custom 4-digit number)PermitRootLogin yes→PermitRootLogin no(Block direct root login)
- Save the file and restart the SSH service:Bash
sudo systemctl restart sshd
4. Enabling the Firewall & Configuring Allowed Ports
Leaving all server ports open is extremely dangerous. Setting up a firewall to open only necessary ports and block all other incoming traffic is mandatory.
Setting Up Ubuntu Default Firewall (UFW)
Bash
# 1. Allow custom SSH port (e.g., Port 2222)
sudo ufw allow 2222/tcp
# 2. Allow web service ports (80: HTTP, 443: HTTPS)
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
# 3. Enable firewall
sudo ufw enable
Warning: Make sure to allow the SSH access port first before enabling the firewall. Otherwise, your active session will be disconnected, and you will be locked out of your server.
5. Setting Timezone & Syncing Time
If your server’s time is inaccurate, it can cause issues such as corrupted system log sequences, database timestamp errors, and SSL certificate validation failures. Make sure to configure your server’s local timezone accurately.
Setting and Verifying Timezone
Bash
# 1. Set timezone to Korea Standard Time (Asia/Seoul)
sudo timedatectl set-timezone Asia/Seoul
# 2. Verify current time settings
timedatectl
6. Summary Checklist for Initial Setup
After completing your server setup, go through this checklist to ensure everything is properly applied:
| Category | Key Configuration | Purpose |
| Package Updates | apt update & upgrade | Patch security vulnerabilities |
| Account Management | Create regular user & grant sudo | Prevent root account misuse |
| SSH Security | Change default port 22 & disable root login | Block brute-force attacks |
| Firewall | Enable UFW / Firewalld | Block unauthorized port access |
| Time Settings | Configure local timezone (e.g., Asia/Seoul) | Maintain accurate system logs |
7. Wrap-up
Investing a few minutes upfront in these 5 fundamental steps—package updates, user creation, SSH hardening, firewall setup, and timezone configuration—is essential for server security and operational stability.
Building a solid foundation now will drastically prevent security incidents and unexpected system errors when you deploy web applications in the future!