这是安装部分,可以参考,我的另一篇博文
VMware Workstation Pro 17.6.3安装 CentOS Stream10的20250324
https://blog.youkuaiyun.com/u013901725/article/details/146552671?spm=1011.2415.3001.10575&sharefrom=mp_manage_link
刚安装完的系统会有一堆问题。我记录一些我的一些初始化问题。
安装软件
dnf install -y lrzsz
yum -y install wget tree curl bash-completion jq vim net-tools telnet lrzsz
#关闭防火墙
sudo firewall-cmd --state
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
# 关闭文件控制 关闭seliux
getenforce
setenforce 0 && sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config
#设置hostname
hostnamectl set-hostname centos10test001
#关闭swap
彻底关闭 #/dev/mapper/cl-swap swap swap defaults 0 0
swapoff -a
sed -i ‘/swap/s/^(.*)$/#\1/g’ /etc/fstab
#修改dns解析 线上的配置
cat > /etc/resolv.conf << EO
nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 114.114.114.114
options timeout:3 attempts:2 rotate
EOF
#默认文件打开数目 ulimit -n 默认是1024 需要修改
ulimit -n
#修改
cat >> /etc/security/limits.conf << EOF
- hard nofile 1024000
- soft nofile 1024000
- hard nproc 1024000
- soft nproc 1024000
EOF
#设置时区
timedatectl
timedatectl set-timezone Asia/Shanghai
#安装chrony命令
#Centos9里是预安装的,没有安装的话执行以下命令:
yum install -y chrony
#说明:Centos9 时间同步要使用chrony命令,ntp命令不能使用了
#2、查看chrony状态
##启用chronyd服务
systemctl enable chronyd
##重启chronyd服务
systemctl restart chronyd
##查看chronyd服务状态
systemctl status chronyd
vim /etc/chrony.conf
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
pool ntp1.aliyun.com iburst
pool ntp2.aliyun.com iburst
pool ntp3.aliyun.com iburst
pool ntp4.aliyun.com iburst
pool ntp5.aliyun.com iburst
pool ntp6.aliyun.com iburst
#内网ip
pool 10.70.130.88 iburst
#通过命令进行查看是否同步,出现^*即表示有可同步的源
chronyc sources
#System clock synchronized: yes 表示同步成功
timedatectl