Configure CentOS 8 after installation

In a previous article we understood how to install CentOS 8 on the computer. Any freshly installed operating system needs to configure and personalize to suit your needs. CentOS is no exception.

In this article we will discuss how do you configure CentOS 8 after installation how to configure network, ssh, firewall, and how to remove unnecessary services. Everything will be step by step, the main thing — carefully read and then you will succeed, as the instructions.

Configure CentOS 8 after installation

Step 1. System update

Perhaps the most standard procedure when installing any operating system. First we need to go to the text console or open a terminal if you work in a graphical interface. Open console with the key combination Ctrl+Alt+F1 (or F2, F3, F4 and so on to F12). And the terminal can be found in the main menu. We consider the case with a text console.

And here she is, login on behalf of user root. Then, use the command:

dnf check-update

dnf update

It took me 3-4 minutes, and at the end you will receive this message:

Now you can clean the cache to clear disk space and go to the other steps. This is done with the command:

dnf clean all

Step 2. Install system utilities

Configure centos 8 is not complete without the installation of service utilities. These are the utilities that can be used every day, so let’s set them in advance. Most likely, you will be on the right track. tools: vim, wget curl net-tools lsof and bash-completion. “What’s that?” — you will ask. And here it is:

  • wget and curl you will need to download the files over the network;
  • net-tools contains a set of programs to support networks;
  • lsof utility chic, it allows you to display information about which files are involved in these or other processes;
  • nano and vim are editors. First, by the way, more suitable for beginners, and the second is for the experienced. Largely due to the fact that in vim editor tools wider.
  • bash-completion – without avtonapovnennya does not go far.

So, write the command length to life:

dnf install vim nano wget curl net-tools lsof bash-completion

Thus we establish immediately all utilities. Here’s what you need will appear on the screen

Step 3. Setting computer name

CentOS is notable that it has the widest range of tools for working and configuring networks. For a beginner it is better to start with the command nmtui. Set the hostname. To do this, write:

nmtui-hostname

Will appear this window:

Here we set any desired name. Literally any, but still worth it not to bend with jokes where this is not necessary.

Step 4. Configure a static IP

Now we need to set a static IP. Use all the same command nmtui:

nmtui-edit

Then you are welcomed here is the interface:

Click on Edit and get into the trail. menu:

Now I set the values for statics. On the contrary IPv4 Configuration set to Manual.

Then, write the desired ip address in this field Addresses, gateway address (router) in the Gateway and DNS servers that you want to use, such as 8.8.8.8 from Google. Once all done need to restart the network. This is done with the command:

nmtui-connect

Click on Deactivate/Activate. Did? Now the new settings took effect. Go ahead. I will check whether we have these. Write command:

ifconfig enp0s3

ip a

ping -c2 google.com

Everything else has additional utilities that will let you know what speed the network, its status, and indeed more information to pull. Write command:

ethtool enp0s3

mii-tool enp0s3

Step 5. Create a new user

Generally it is best to always have a user with rights to administer, so we will do that. To create a user, run:

useradd nomanoma

Create a password for the user:

passwd nomanoma

Add user to the sudo group:

usermod -aG wheel nomanoma

Simple enough, right?

Step 6. Setting up SSH

If you are going to connect to your server via ssh, it is more convenient to use ssh keys instead of username and password. We will use public and private keys. They are called public and private (public and private key). First you need to go back to your working system and create the key pair. To do this, run:

ssh-keygen-t RSA

Note string Enter passphrase (empty for no passphrase). Not to enter a password when you log on to the server via SSH leave her empty one then you have to consider that if this file falls into the wrong hands, that person will have full access to the server.

The system will then indicate where preserved the SSH key. Since we have generated, it is necessary to use it. Write command ssh-copy-id, and user name and IP address of our server, which we are now configurable:

ssh-copy-id [email protected]

Now on the remote server can be accessed without a password.

Step 7. Configuring security ssh

Safety does not happen much, therefore we disable the ability to remotely access the root account directly in the configuration file. Write command

vi /etc/ssh/sshd_config

Find the line #PermitRootLogin yes and change it to PermitRootLogin no. Look at block # Authentication, there will be need for us line. Restart the ssh service for the changes to take effect:

systemctl restart sshd

Step 8. Firewall configuration

Basic setup of centos will not be without a firewall by default the firewall is used here. To run it on the server it is necessary to use the commands:

systemctl enable firewalld

systemctl start firewalld

And to see the status use:

systemctl status firewalld

But first of all it is necessary to add the SSH service, because if it’s not in the rules, how you will interact with the system on this Protocol? If you connect to the server remotely, it can break. To add it use:

firewall-cmd --add-service=ssh

firewall-cmd --add-service=ssh --permanent

Well, if you need to use SMTP or a web server, it is obvious that you should add allow rules for these services:

firewall-cmd --permanent --add-service=http

firewall-cmd --permanent --add-service=https

firewall-cmd --permanent --add-service=smtp

With the command below I can see all the rules on the server.

firewall-cmd --permanent list-all

Step 9. Removing unnecessary services

You thought that Windows only have to do this? Anymore. Each service has its own purpose. So I will show you how to see the whole list of services, and you have to decide what are necessary and which are not. To see the whole list use:

ss-tulpn

That’s how it looks:

In order to remove unnecessary service use the command

systemctl stop ServiceName

systemctl disable ServiceName

Step 10. Manage services

There is a wonderful team that will allow you to see all active and not just service:

systemctl list-units

The list is really big. In General, so you can monitor services on your system. Our article on how to configure centos after the installation completed, but there still a lot of things. I hope the article was useful and you learned something new for you. And that you configure after installation? Write in the comments!

Source: losst.ru

(Visited 7 times, 1 visits today)