CentOS 8¶
修改时区¶
# 列出可用时区
timedatectl list-timezones
# 更改时区
timedatectl set-timezone Asia/Shanghai
配置ssh¶
# 当ssh找不到目录,执行
ssh localhost
安装docker¶
安装最新版的docker报错
报错:错误:
问题 1: 安装的软件包的问题 podman-3.3.1-9.module_el8.5.0+988+b1f0b741.x86_64
软件包 podman-3.3.1-9.module_el8.5.0+988+b1f0b741.x86_64 需要 runc >= 1.0.0-57,但没有提供者可以被安装
...
解决:
sudo yum install docker-ce docker-ce-cli containerd.io --allowerasing
换源¶
CentOS Linux 8 进行yum update时报错:- AppStream 错误:为仓库 ‘appstream‘ 下载元数据失败 : Cannot prepare internal mirrorlist: No URLs
# 1.备份旧的源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# 2.下载对应版本的阿里源(wget -O 下载并以指定的文件名保存)
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
# 3.删除yum旧的缓存,生成新的换源后的缓存
yum makecache
# 4.检查是否换源成功
cat /etc/yum.repos.d/CentOS-Base.repo
修改DNS¶
# 1、通过 ifconfig 或 nmcli connection show 命令确定当前使用的网卡名称(如:eth0、eno1 等,以下均以 eno1 为例进行设置)
ifconfig
#2、通过命令 nmcli con mod eno1 ipv4.dns "114.114.114.114 223.5.5.5" 修改对应网卡的 dns 设置
nmcli con mod eno1 ipv4.dns "114.114.114.114 223.5.5.5"
#3、或通过命令 vi /etc/sysconfig/network-scripts/ifcfg-eno1 修改网卡配置文件,找到 DNS1 的配置进行设置
vi /etc/sysconfig/network-scripts/ifcfg-eno
DNS1=114.114.114.114
DNS2=223.5.5.5
#4、通过命令 systemctl restart NetworkManager.service 或 reboot 重启系统生效
systemctl restart NetworkManager.service
#5、通过命令 cat /etc/resolv.conf 查看当前 dns
cat /etc/resolv.conf
#6、能上网了就可以下载:yum install bind-utils 工具包,以使用 nslookup、host、dig 等命令进行详细诊断。
yum install bind-utils