[LINUX] The first thing to do after installing CentOS Stream minimally

Summary of this article

A note on what to do if you install CentOS Stream with the minimum configuration.

Premise

--ISO image used for installation - CentOS-Stream-8-x86_64-20200629-boot.iso

The installation procedure is omitted.

First thing to do

The main part of this article. Do the following in order.

1. Check your internet connection

It will not start without an internet connection. You can set it at the time of installation, but check it again.

grep -e BOOTPROTO -e ONBOOT /etc/sysconfig/network-scripts/ifcfg-eth0
#OK if it is as shown below
BOOTPROTO=dhcp
ONBOOT=yes
If it doesn't work
If it does not match the above display, change the setting with the ``` nmcli``` command.
nmcli connection modify "eth0" ipv4.method auto
nmcli connection modify eth0 connection.autoconnect yes

It is OK if the OS is rebooted and the settings are reflected.

2. Update

yum update -y

3. Stop firewalld

After that, the firewall is an obstacle when setting SSH etc., so stop it once.

systemctl disable firewalld
systemctl stop firewalld

4. Disable SELinux

vi /etc/sysconfig/selinux

Edit the file and set it to SELINUX = disabled. If you can do this, reboot the OS once.

5. Install rsyslog

It is useful to have a quick look at the system logs when investigating the cause of a bad Ssh connection or when exposing the server to the Internet.

yum install -y rsyslog
systemctl enable rsyslog
systemctl start rsyslog

6. Set up SSH

Since it is difficult to continue to operate the console directly, we will make it possible to connect with SSH as soon as possible. The following setting command is an example.

echo "Port 10022" >> /etc/ssh/sshd_config #Change port
echo "PermitRootLogin no" >> /etc/ssh/sshd_config #Ssh login prohibited for root user
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config #Ssh login prohibited by PW authentication

If PW authentication is prohibited, the public key will also be registered. The following is an example command when user user is SSH.

mkdir -p /home/user/.ssh
cd /home/user/.ssh
touch authorized_keys
cat id_rsa.pub >> authorized_keys
chmod 600 *
chmod 700 ../.ssh
chown -R user ../.ssh

After completing the settings up to this point, restart the SSH server.

systemctl restart sshd

After that, you can operate from SSH client such as TeraTerm.

If it doesn't work
If the SSH connection doesn't work, check / var / log / secure etc.

7. Install bash-completion

yum install -y wget
yum install -y bash-completion
wget https://github.com/terralinux/systemd/raw/master/src/systemctl-bash-completion.sh -O /etc/bash_completion.d/systemctl-bash-completion.sh

8. Create an alias

Convenient aliases such as ll and tailf are not available from the beginning, so you can set them yourself.

echo "alias ll='ls -la'" >> /etc/bashrc
echo "alias tailf='tail -f'" >> /etc/bashrc
source /etc/bashrc

Summary

I put CentOS in my home server and often crush it, so it was a memorandum.

Reference: The first thing to do when I install CentOS 7 Reference: Make it minimum usable after installing CentOS7 minimal

Recommended Posts

The first thing to do after installing CentOS Stream minimally
13 Things to Do After Installing Ubuntu 20.04 LTS
What to do after installing Linux (Ubuntu)
10 Things to Do After Installing Ubuntu 18.04 LTS
[For beginners] What to do after installing Anaconda
[First Deep Learning] Notes on running the sample after installing Deel
What to do if you get "The session could not be opened" when installing CentOS on VirtualBox
What to do if scrapy doesn't work after installing scrapy with pip on mac
The first thing to check when a No Reverse Match occurs in Django