A note on what to do if you install CentOS Stream with the minimum configuration.
--ISO image used for installation - CentOS-Stream-8-x86_64-20200629-boot.iso
The installation procedure is omitted.
The main part of this article. Do the following in order.
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
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.
yum update -y
After that, the firewall is an obstacle when setting SSH etc., so stop it once.
systemctl disable firewalld
systemctl stop firewalld
vi /etc/sysconfig/selinux
Edit the file and set it to SELINUX = disabled
.
If you can do this, reboot the OS once.
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
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.
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
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
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