Initial Server Setup Centos 8

Introduction

When launching a new server with CentOS 8, ensuring a secure and properly configured foundation is essential. Whether you’re setting up a VPS for the first time or deploying infrastructure for production, a systematic initial server setup will help harden your system and prepare it for future installations. In this guide, we’ll walk through the essential steps to Initial Server Setup CentOS 8 server – from creating a non-root sudo user to configuring your firewall and installing core utilities.

Update Your System

Before any configuration, ensure that your system is up to date. This not only secures your server but also ensures compatibility with future installations:

sudo dnf update -y
sudo dnf upgrade -y

Create a Sudo User and Granting Administrative Privileges

useradd devopsroles
passwd devopsroles
usermod -aG wheel devopsroles
su - devopsroles

The output terminal as below

Initial Server Setup Centos 8

Open a new terminal window

ssh devopsroles@SERVER_IP_ADDRESS

Disable SSH Root Login

We have new account. so, I can secure our server by disabling remote SSH account to the root account.

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config_BK
sudo sed -i -e 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config
sudo cat /etc/ssh/sshd_config | grep PermitRootLogin

The output terminal as below

Initial Server Setup Centos 8

we need to restart the SSH

sudo systemctl reload sshd

Changing the hostname

sudo hostnamectl set-hostname server1.devopsroles.com

Setting Up a Basic Firewall CentOS 8

Firewalld is a firewall management tool for Linux operating systems. you need to make sure that the server firewall allows web access.

sudo firewall-cmd --add-service=http --permanent
sudo systemctl enable firewalld
sudo systemctl start firewalld
sudo systemctl status firewalld

Update CentOS 8 System

sudo yum check-update
sudo yum upgrade -y
sudo yum clean all

Install System Utilities

sudo yum -y install bind-utils net-tools  psmisc traceroute tree vim-enhanced wget

Conclusion

By following this initial server setup guide for CentOS 8, you’ve established a secure and functional baseline for your system. Creating a non-root user with sudo privileges, securing SSH access, enabling the firewall, and installing essential tools are critical steps to ensure stability, security, and readiness for production workloads. With this solid foundation, you’re now well-prepared to deploy applications, configure services, or automate infrastructure tasks confidently.

For ongoing security, remember to regularly update your system and monitor user access and services. If you’re planning to install a web server, database, or other services next, this setup ensures you start from a well-configured environment. I hope will this your helpful. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology, especially Devops Skill such as Docker, vagrant, git, and so forth. I like open-sources, so I created DevopsRoles.com to share the knowledge I have acquired. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.