Use this tutorial to configure your CentOS 8 Linux machine for the first time. For example, you have launched a new VPS or dedicated host with CentOS 8, Follow the below steps to complete the initial server setup with CentOS 8.
Step 1 – Login to CentOS 8
Login to your CentOS 8 Linux machine. The desktop users can use the GUI interface to log in. Remote users connect to there server using SSH access.
ssh [email protected]_server_ip
Step 2 – Update Current Pacakges
After login, first, update all the current packages on your system.
dnf clean all dnf update
Step 3 – Install Required Packages
dnf install vim wget
Step 4 – Create User Account
Some of the cloud hosting providers like DigitalOcean provider root access only. This is the best practice to create a separate account for the system administrator works.
Use the following command to create user:
Then set a strong password to the newly created account.
You will need Sudo privileges to work with system admin tasks. The CentOS Linux systems have a default group named “wheel” with Sudo privileges. Add your newly created user to the wheel group.
usermod -aG wheel rahul
Step 5 – Setup Basic Firewall
If your CentOS 8 default installation does not have a firewall installed, follow the below steps to setup a firewall on your CentOS 8.
dnf install firewalld
After installation, start firewall service and enable it to auto-start on system boot.
systemctl start firewalld systemctl enable firewalld
By default firewall allowed SSH access to remote users. You may also need to allow other services through the firewall to remote users.
You can directly provide a service name like “http” or “https” to allow. The firewalld uses /etc/services file to determine the corresponding port of the service.
firewall-cmd --permanent --add-service=http firewall-cmd --permanent --add-service=https
If the service name is not defined in /etc/services, add allow access by port number directly. For example to allow TCP port 8080 or 10000 (default Webmin) to your firewall.
firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --permanent --add-port=10000/tcp
After making any changes to your firewall, make sure to reload changes using the following command.
To view, all the allowed port and services use the following command.
firewall-cmd --permanent --list-all
public target: default icmp-block-inversion: no interfaces: sources: services: cockpit dhcpv6-client http https ssh ports: 8080/tcp 10000/tcp protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
Your CentOS 8 system is ready for use. Thank You.