refer to : https://blog.csdn.net/DCTANT/article/details/125430461
镜像下载地址
https://dl.rockylinux.org/vault/rocky/8.6/isos/x86_64/
https://mirrors.cqu.edu.cn/rockylinux/8.7/isos/x86_64/
网络配置
cd /etc/sysconfig/network-scripts/
#重启网络服务:
nmcli c reload
#重启网卡:
nmcli c up ens160
nmcli d reapply ens160
nmcli d connect ens160
开启防火墙
#查看状态
firewall-cmd --state
#启动防火墙
systemctl start firewalld.service
软件包镜像配置
更换软件包镜像
cd /etc/yum.repos.d
ls
sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' \
-i.bak \
/etc/yum.repos.d/Rocky-*.repo
yum clean all
yum makecache
安装常用的工具包
yum install vim*
yum -y install lrzsz
设置主机名
hostnamectl set-hostname weipeng.host1
# 查看主机名
hostname
设置时区和ntp
正确的时间如下:其中Mon 2023-02-27 11:18:57 CST
的时间,需要和windows电脑的时间,保持一致
[root@localhost ~]# timedatectl
Local time: Mon 2023-02-27 11:18:57 CST
Universal time: Mon 2023-02-27 03:18:57 UTC
RTC time: Mon 2023-02-27 03:18:57
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
设置时区 refer to :https://www.alibabacloud.com/help/zh/elastic-compute-service/latest/configure-chrony-for-linux-instances-1
# 查看时区列表
ls /usr/share/zoneinfo/Asia
# 修改时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 更新硬件时钟(RTC)
hwclock -w
# 查看时区
timedatectl status
设置ntp refer to :https://sys-blog.net/rocky-linux/about-chrony/
# 确认chrony是否安装
rpm -qa | grep chrony
# 安装
dnf install chrony
# 启动chronyd服务并设置开机自启动
systemctl start chronyd.service
systemctl enable chronyd.service
修改/etc/chrony.conf配置文件,如下:
# vi /etc/chrony.conf
pool ntp.aliyun.com iburst
pool ntp1.aliyun.com iburst
driftfile /var/lib/chrony/drift
#makestep 1.0 3
rtcsync
keyfile /etc/chrony.keys
leapsectz right/UTC
logdir /var/log/chrony
leapsecmode slew
maxslewrate 1000
smoothtime 400 0.001024 leaponly
# 重启chronyd服务
systemctl restart chronyd
# 确认chronyd服务是否设定为开机自动启动
systemctl is-enabled chronyd
# 强制与系统时钟进行同步
chronyc -a makestep
#重新查看时间
[root@localhost ~]# date
Mon Feb 27 11:18:09 CST 2023
[root@localhost ~]# timedatectl
Local time: Mon 2023-02-27 11:18:57 CST
Universal time: Mon 2023-02-27 03:18:57 UTC
RTC time: Mon 2023-02-27 03:18:57
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
查看系统发行版信息
cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.7 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.7 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.7"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.7"