Are you looking to set up a new server with CentOS 8? Look no further! In this blog post, we will guide you through the initial server setup process with CentOS 8. CentOS 8 is a popular Linux distribution known for its stability and security, making it a great choice for hosting servers.
- Log in to your server:
After purchasing a server with CentOS 8, the first step is to log in to your server. You can do this using SSH (Secure Shell) with the credentials provided by your hosting provider. Once logged in, you will have access to the command line interface of your server. - Update the system:
The next step is to update the system to ensure that you have the latest security patches and software updates. Run the following command to update the packages on your server:
sudo dnf update
- Set up a firewall:
Security is essential when setting up a server. CentOS 8 comes with the firewalld firewall pre-installed. You can enable and start the firewall with the following commands:
sudo systemctl enable firewalld
sudo systemctl start firewalld
You can then enable specific ports that you want to allow traffic through using the following command:
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
sudo firewall-cmd --reload
- Create a new user:
It is recommended to create a new user with sudo privileges for daily use, rather than using the root account. To create a new user, run the following command (replaceusername
with your desired username):
sudo adduser username
sudo passwd username
sudo usermod -aG wheel username
- Secure SSH access:
To enhance the security of your server, you can configure SSH to only allow key-based authentication and disable password authentication. Edit the SSH configuration file with the following command:
sudo nano /etc/ssh/sshd_config
Find the following lines and make the changes:
PasswordAuthentication no
PubkeyAuthentication yes
Save and close the file, then restart the SSH service with the following command:
sudo systemctl restart sshd
That’s it! You have successfully completed the initial server setup with CentOS 8. You can now start installing and configuring software on your server. If you have any questions or need further assistance, feel free to reach out to our support team. Thank you for choosing Greenhost.Cloud for your hosting needs!