CentOS8.x system configuration record

0 x00 Foreword###

Description: It mainly records the installation, use and basic settings of CentOS8, as well as the new feature configuration practice of the release version;


0 x01 Installation process###

Installation Environment:

The installation process of CentOS 8.0 is as follows:

WeiyiGeek.Step1

WeiyiGeek.Step2

WeiyiGeek.Step3

WeiyiGeek.Step4

0 x02 basic configuration###

Network Configuration#####

Description: Since CentOS8 has abandoned network.service to manage the network, and uses nmcli for the network, this section simply records how to use nmcli for OS8 network configuration;
Manual network configuration file:

sed -i 's/ONBOOT=no/ONBOOT=yes/g'/etc/sysconfig/network-scripts/ifcfg-ens192
sed -i 's/BOOTPROTO=dhcp/BOOTPROTO=static/g'/etc/sysconfig/network-scripts/ifcfg-ens192
sed -i 's/BOOTPROTO=\"dhcp\"/BOOTPROTO=\"static\"/g'/etc/sysconfig/network-scripts/ifcfg-ens192
cat >>/etc/sysconfig/network-scripts/ifcfg-ens192 <<EOF
IPADDR=10.20.172.241
NETMASK=255.255.255.0
GATEWAY=10.20.172..1
EOF
  1. Initial CentOS8 static IP settings: (refer to the configuration file above)
nmcli connect delete'Wired connection 1'&& nmcli disconnect ens192 && nmcli connect ens192 && nmcli c load /etc/sysconfig/network-scripts/ifcfg-ens192
  1. Initial CentOS8 dynamic IP settings:
nmcli connect delete'Wired connection 1' 
nmcli connect add type ethernet con-name ens192 ifname ens192 ipv4.method manual
  1. Switch to establish the specified Connection link
nmcli conn add type ethernet con-name eth0 ifname ens192 ipv4.addr 100.20.172.242/24 ipv4.gateway 100.20.172.1 ipv4.dns '223.6.6.6,223.5.5.5' ipv4.method manual
nmcli conn up eth0

Supplementary note:

Synchronization time configuration

The ntp software package is no longer supported by default in CentOS8.0, and time synchronization will be implemented by chrony, so the following methods can be used to achieve time synchronization

Time time zone:

# Way 1
cp /etc/localtime{,.bak}
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

# Way 2
timedatectl
timedatectl list-timezones
timedatectl set-timezone Asia/Shanghai

chrony service time synchronization

systemctl restart chronyd

ntp service time synchronization

# The ntp service will be installed from the source provided by wlnmp
# Add wlnmp source-Time synchronization-Time synchronization
rpm -ivh http://mirrors.wlnmp.com/centos/wlnmp-release-centos.noarch.rpm && yum install wntp && ntpdate ntp1.aliyun.com

# You can also write timed tasks to achieve ntp1 every 3 minutes.aliyun.com synchronizes the time once and sets the system time as hardware time
crontab -l && systemctl enable crond.service
$crontab -e
* /3****/usr/sbin/ntpdate ntp1.aliyun.com &>/dev/null;/usr/sbin/hwclock -w

0 x03 Into the pit solution

1. Forgot to change CentOS8.x password#####
  1. Restart the server Press e on the kernel version interface to enter the edit Grub interface, change the ro after cl-root to rw init=/sysroot/bin/bash

  1. Hold down the Ctrl and x keys at the same time, the system enters emergency (emergency) mode.

  2. Run the command "chroot /sysroot/" to switch back to the original system and then change the password. After changing the password, run the command touch /.autorelabel to make the SELinux effective password effective.

/# chroot /sysroot//# LANG=en (change language to English)
/# passwd
/# touch /.autorelabel
  1. Hold down the Ctrl and d keys at the same time, type reboot and press Enter to restart the system.
2. The system time differs from the actual time by 8 hours

Problem description: Check the system time and find that the system time and the Universal time time differ by 8 hours;

$date
Thu May 1421:13:32 UTC 2020

$timedatectl
  Local time:One 2020-05-1421:13:19 CST
 Universal time:One 2020-05-1413:13:19 UTC  #Actual time
  RTC time:One 2020-05-1413:13:19
  Time zone: Asia/Shanghai(CST,+0800)
  NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
  DST active: n/a

Solution:

#1. View the system time zone and delete the partition where the current system is located
ls /usr/share/zoneinfo/
sudo rm /etc/localtime

#2. From/usr/share/zoneinfo/Create a soft link in to replace the current time zone information, and directly select Universal:
sudo ln -s /usr/share/zoneinfo/Universal /etc/localtime

#3. Check the system time again and return to normal

Recommended Posts

CentOS8.x system configuration record
CentOS7.x system configuration record
Ubuntu 14.04 configuration record
Centos backend system setup record
cobbler automatic installation system (Centos7.X)
cobbler automatic installation system (Centos7.X)
CentOS7.x system root directory partition expansion
CentOS 7 system installation and configuration graphic tutorial