跳至主要內容

centos8笔记

Moments小于 1 分钟

centos8笔记

使用docker安装centos8镜像

docker pull centos:centos8
docker run -dit -p 800:80 --privileged=true --name=centos8 centos:centos8 /usr/sbin/init
docker exec -it centos8 /bin/bash

Waiting for process with pid 53 to finish.

ps uax | grep 53
kill -9 53

Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

查看版本

cat /etc/redhat-release
// 通过查找找到版本
cat /etc/* | grep "CentOS"

更新yum源为阿里云

// 安装wget
yum install wget -y
// 备份/etc/yum.repos.d/CentOS-Linux-Base.repo
mv /etc/yum.repos.d/CentOS-Linux-BaseOS.repo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo.backup
// 下载aliyun的yum源配置文件
wget -O /etc/yum.repos.d/CentOS-Linux-BaseOS.repo http://mirrors.aliyun.com/repo/Centos-8.repo
// 使用此源可以解决安装vim失败的问题。
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
// 运行yum makecache生成缓存
yum makecache
// 更新yum
yum update -y
上次编辑于:
贡献者: Moments