Initial Server Setup with CentOS 7

Initial Server Setup with CentOS 7 Tutorial

Initial Server Setup with CentOS 7 Tutorial

In this tutorial, we will guide you through the steps to set up a CentOS 7 server for initial use. This tutorial assumes that you have already installed CentOS 7 on your server.

Step 1: Update the System

The first step in setting up your CentOS 7 server is to update the system. You can do this by running the following command:

yum update

Step 2: Create a New User Account

It is not recommended to use the root account for everyday tasks. Therefore, you should create a new user account for regular use. You can create a new user by running the following command:

adduser username

Replace "username" with the name you want to use for your new user.

Step 3: Grant Sudo Privileges to the User Account

The new user account that you created will not have sudo privileges by default. You can grant sudo privileges to the user by running the following command:

usermod -aG wheel username

Replace "username" with the name of your new user.

Step 4: Configure the Firewall

The firewall on your CentOS 7 server is enabled by default. You should configure the firewall to allow incoming traffic on the services that you want to use. For example, if you want to use SSH to connect to your server, you should allow incoming traffic on port 22. You can configure the firewall by running the following commands:

firewall-cmd --zone=public --add-service=ssh --permanent
firewall-cmd --reload

Step 5: Disable Root Login

For security reasons, it is recommended to disable root login. You can do this by editing the SSH configuration file. Open the file using the following command:

sudo nano /etc/ssh/sshd_config

Find the line that says "PermitRootLogin" and change the value to "no". Save and exit the file.

Restart the SSH service to apply the changes by running the following command:

sudo systemctl restart sshd

Conclusion

By following these steps, you have set up a CentOS 7 server for initial use. You have updated the system, created a new user account, granted sudo privileges to the user, configured the firewall, and disabled root login for enhanced security.

Keywords: CentOS 7, server setup, initial server setup, tutorial, update system, create user account, grant sudo privileges, configure firewall, disable root login, SSH configuration.

Комментарии

Популярные сообщения из этого блога

How To Modify CSS Classes in JavaScript

How To Backup MySQL Databases on an Ubuntu VPS

How To Backup PostgreSQL Databases on an Ubuntu VPS