安装centos stream 8的笔记

一、安装

下载centos stream 8的iso文件:

https://mirrors.tuna.tsinghua.edu.cn/centos/8-stream/isos/x86_64/

安装过程与之前的centos类似,我这里进行的是在vmware workstation 16.1中安装。

文件系统配置建议/boot 512MB占sda1,LVM管理 / 和 swap,创建sda2作为物理卷,vg00作为卷组,swap给2GB,/ 给20GB;

时区选择中国上海;

关闭没有任何用的KDump;

软件可以使用最小化software的方式安装,安装之后 / 下约1.9GB,一般不需要GUI;

网络和主机名可以先不配置,安装好了以后再配。

二、配置

1 处理1分30秒等待的bug

启动时,systemd-journal-flush服务卡住,提示
centos8 a start job is running for flush journal......
等待1分30秒后通过
该问题是因为systemd-journal-flush.service这个服务,在启动时因为/var/log下没有journal目录,启动失败导致的
首次进入OS,手工在/var/log下,创建该目录
mkdir /var/log/journal
重启OS验证该问题解决。
详见:
https://forums.centos.org/viewtopic.php?f=54&t=80095

2 启用ens32网卡

cd /etc/sysconfig/network-scripts
cp ifcfg-ens32 /tmp/ifcfg-ens32
sed -i 's/ONBOOT=no/ONBOOT=yes/' ifcfg-ens32
nmcli c reload
nmcli c down ens32
nmcli c up ens32

注意centos8开始强制使用NetworkManager服务管理网络,老牌的network不让用了,且nmcli命令代替了之前的ifup和ifdown。

网卡启用后可以使用终端命令行执行后续配置,不用再在控制台中弄了。

3 配置主要的yum源

默认的yum源用的是官方的,特别慢,可以将repo文件全部备份,换成全套阿里yum源。

CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
#failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/BaseOS/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
#failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/os/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
#failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
 
[PowerTools]
name=CentOS-$releasever - PowerTools - mirrors.aliyun.com
#failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/PowerTools/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/PowerTools/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official


[AppStream]
name=CentOS-$releasever - AppStream - mirrors.aliyun.com
#failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
        http://mirrors.aliyuncs.com/centos/$releasever/AppStream/$basearch/os/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

docker-ce.repo

#docker-ce.repo
#docker repo from aliyun
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/stable
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/test
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg

kubernetes.repo

#kubernetes.repo
#kubernetes el7 from aliyun
[kubernetes]
name=Kubernetes el7
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg

4 yum install一些常用包

yum clean all
yum makecache
yum install wget chrony iproute net-tools telnet vim samba-client sysstat nmap-ncat tree psmisc lsof iputils

5 防火墙、selinux关闭并打卡时间同步

systemctl stop firewalld
systemctl disable firewalld
sed -i 's/enforcing/disabled/' /etc/selinux/config
systemctl start chronyd
systemctl enable chronyd

6 网卡标准配置

DHCP的网卡:

TYPE=Ethernet
DEVICE=ens32
NAME=ens32
ONBOOT=yes
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
BOOTPROTO=DHCP

注意centos8开始强制使用NetworkManager管理网络,NAME参数必须有。DHCP也是做标准虚拟机镜像推荐使用的设置。

固定IP的网卡:

TYPE=Ethernet
DEVICE=ens32
NAME=ens32
ONBOOT=yes
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
BOOTPROTO=none
IPADDR=192.168.124.11
NETMASK=255.255.255.0
GATEWAY=192.168.124.1

7 克隆新系统

将该centos stream 8,克隆为一个新的操作系统,需要做的工作:

1.修改hostname
hostnamectl --static set-hostname newhostname
2.网卡文件/etc/sysconfig/network-scripts/ifcfg-ens32中改为
BOOTPROTO=none
并增加指定的IP地址、子网掩码和网关
IPADDR=192.168.124.11
NETMASK=255.255.255.0
GATEWAY=192.168.124.1
3./etc/resolv.conf中增加DNS
nameserver 114.114.114.114
nameserver 8.8.8.8
4.通过nmcli重新加载网卡
nmcli c reload
nmcli c down ens32
nmcli c up ens32
5.验证
可以ping通网关和www.baidu.com

(全文完)

posted @   宝马大盗  阅读(1288)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
点击右上角即可分享
微信分享提示