rocky9 配置静态ip 24小时制时间 selinux 防火墙 docker安装
# 配置静态IP
# rocky 9.0 NetworkManager 配置文件位置 vim /etc/NetworkManager/system-connections/ens32.nmconnection [connection] id=ens32 uuid=7d544488-2c79-3871-8a12-c16a559b9c98 type=ethernet autoconnect-priority=-999 interface-name=ens32 timestamp=1659320523 [ethernet] [ipv4] address1=192.168.164.113/24,192.168.164.2 dns=8.8.8.8;114.114.114.114; may-fail=false method=manual [ipv6] addr-gen-mode=eui64 method=auto [proxy] # 重新加载配置文件 nmcli connection load /etc/NetworkManager/system-connections/ens32.nmconnection # 激活配置文件 nmcli connection up /etc/NetworkManager/system-connections/ens32.nmconnection # 测试ping ping www.baidu.com 64 bytes from 103.235.46.40 (103.235.46.40): icmp_seq=1 ttl=128 time=54.2 ms
# 24小时制时间
# 查看时间
date
Tue Aug 16 03:54:43 PM CST 2022
# 配置24小时制
localectl set-locale LC_TIME=en_GB.UTF-8
exit
#重新登录
restart login
# 查看时间
date
Tue 16 Aug 16:07:11 CST 2022
# 关闭防火墙和selinux
# 关闭防火墙
systemctl stop firewalld && systemctl disable firewalld
# 永久关闭selinux
grubby --update-kernel ALL --args selinux=0
# 临时关闭
setenforce 0
# 查看selinux状态
getenforce
# 恢复selinux(少用)
grubby --update-kernel ALL --remove-args selinux
# 安装docker服务
# 安装docker依赖
dnf install -y yum-utils device-mapper-persistent-data lvm2
# 添加阿里 docker 源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
# 安装docker
dnf install docker-ce -y
# 查看docker版本
docker --version
Docker version 20.10.17, build 100c701
# 配置docker加速源和日志
cat >/etc/docker/daemon.json <<EOF
{
"registry-mirrors": ["https://pee6w651.mirror.aliyuncs.com"],
"insecure-registries": ["127.0.0.1"],
"max-concurrent-downloads": 3,
"max-concurrent-uploads": 5,
"storage-driver": "overlay2",
"storage-opts": ["overlay2.override_kernel_check=true"],
"log-driver": "json-file",
"log-opts": {
"max-size": "25m",
"max-file": "2"
}
}
EOF
# 重启docker
systemctl restart docker
本文来自博客园,站在巨人的肩膀上,坚持开源精神,遵循开源协议:Apache Licene 2.0协议。
浙公网安备 33010602011771号