proxy代理   norton 诺顿病毒库   代理列表   search FTP搜索   whois IP地理位置   blog 追求完美  
soft 软件   firefox WEB浏览器   免费域名   typeset 假古文   AntiVirus 反病毒   ipcn 站点导航  

« 迁移到 GCP 更新了MovableType版本 默认改成 https | Main

April 17, 2022

更新系统为 Oracle Linux Server 8.5

版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明。
https://windtear.net/2022/04/upgade_to_oracle_linux_server_85.html

完成三年前的计划/欠债

曲折的路线 (因为内存太小 无法直接安装重装 7 8)
CentOS 6.10 -> CentOS 7.2 -> CentOS 7.9 -> CentOS 8.3 -> CentOS 8.5 -> Oracle Linux Server 8.5

Red Hat Enterprise Linux release 8.5 (Ootpa)
Oracle Linux Server 8 (5.4.17-2136.306.1.3.el8uek.x86_64)

备份数据 备份关键配置
覆盖加密分区避免anaconda卡住 # dd if=/dev/zero of=/dev/vda3 bs=512 count=1
修改 grub 编写 ks
title reinstall
root (hd0,0)
kernel /boot/vmlinuz ro root=LABEL=/ biosdevname=0 noipv6 ksdevice=eth0 ks=https://somedomain某个域名/someks某个配置 lang=en_GB keymap=be-latin1 ip=实际IP netmask=255.255.255.128 gateway=网关 dns=8.8.8.8 hostname=主机名
initrd /boot/initrd.img
ks 包括格盘和安装后替换仓库 解压覆盖之前备份的关键配置 如果遇到时间或证书问题 可以加 --noverifyssl
part / --fstype=ext4 --label="/" --size=6000 --ondisk /dev/vda
part swap --size=1024 --ondisk /dev/vda
#part /data --fstype=ext4 --label="/data" --size=1 --grow --ondisk /dev/vda
url --url https://vault.centos.org/6.10/os/x86_64
repo --name="updates" --baseurl=https://vault.centos.org/6.10/updates/x86_64

%packages --nobase
@core
wget

minorver=6.10
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=https://vault.centos.org/$minorver|g" \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo

服务器起来后更新 CentOS 7.2
cat > /etc/yum.repos.d/upgrade.repo <<EOF
[upgrade]
name=upgrade
baseurl=http://buildlogs.centos.org/centos/6/upg/x86_64/
enabled=1
gpgcheck=1
EOF

yum erase openscap -y
yum install https://buildlogs.centos.org/centos/6/upg/x86_64/Packages/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm -y
yum install redhat-upgrade-tool preupgrade-assistant-contents -y

preupg
centos-upgrade-tool-cli --network 7 --instrepo=https://vault.centos.org/7.2.1511/os/x86_64/

重起后自动安装新系统 CentOS 7.2
title System Upgrade (redhat-upgrade-tool)
root (hd0,0)
kernel /boot/vmlinuz-redhat-upgrade-tool ro root=UUID=c8300b8e-2543-43fa-8000-053b32d5962e rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us r
d_NO_DM upgrade init=/usr/libexec/upgrade-init selinux=0 rd.plymouth=0 plymouth.enable=0 net.ifnames=0 consoleblank=0
initrd /boot/initramfs-redhat-upgrade-tool.img
报 libpcre.so.0 错误
等自动重起 ssh会启动失败
cd /lib64
ln -s libpcre.so.1 libpcre.so.0
ln -s libsasl2.so.3.0.0 libsasl2.so.2
systemctl start sshd

修改仓库为 CentOS 7.9
rm -f upgrade.repo redhat-upgrade-*repo

yum install centos-release-7
# centos-release-7-9.2009.1.el7.centos.x86_64
yum update

yum downgrade grep json-c
yum downgrade busybox
yum update grep
yum update openldap busybox json-c

yum remove atmel-firmware libnih dash busybox zd1211-firmware ipw2100-firmware ipw2200-firmware mingetty MAKEDEV b43-openfwwf

yum remove openscap redhat-upgrade-tool

这里手动替换 grub2 或更新8后替换
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-working_with_the_grub_2_boot_loader#sec-Upgrading_from_GRUB_Legacy_to_GRUB_2

cat > /etc/default/grub <<EOF
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
EOF

#grub2-install /dev/vda --grub-setup=/bin/true

正式替换前可以测试下
title GRUB 2 Test
root (hd0,0)
kernel /boot/grub2/i386-pc/core.img
boot

grubby --info=ALL # 这个需要记下来 紧急情况不着急

grub2-install /dev/vda
rm /boot/grub/grub.conf

grub2-set-default 0
grubby --set-default /boot/vmlinuz-xxx

awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg


# 7.9 -> 8.3
yum -y install epel-release
yum -y install rpmconf
rpmconf -a
按情况选择

yum -y remove python36-rpmconf rpmconf
yum -y install dnf
dnf -y upgrade

dnf -y install https://vault.centos.org/8.3.2011/BaseOS/x86_64/os/Packages/centos-linux-repos-8-2.el8.noarch.rpm https://vault.centos.org/8.3.2011/BaseOS/x86_64/os/Packages/centos-linux-release-8.3-1.2011.el8.noarch.rpm https://vault.centos.org/8.3.2011/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-2.el8.noarch.rpm

minorver=8.3.2011
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=https://vault.centos.org/$minorver|g" \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo

rm -f /etc/yum.repos.d/epel*

epel-release-latest-8
dnf -y upgrade https://mirrors.tuna.tsinghua.edu.cn/epel/epel-release-latest-8.noarch.rpm

yum -y remove kmod-kvdo
rpm -e `rpm -q kernel-devel`
rpm -e `rpm -q kernel`
rpm -e --nodeps sysvinit-tools

dnf -y remove yum yum-metadata-parser
rm -rf /etc/yum


dnf -y install kernel-core kernel-modules
dnf -y groupupdate "Core" "Minimal Install"
rpm -qa |grep el7 | xargs dnf -y remove
systemctl enable NetworkManager
systemctl disable network
dnf -y remove tuned sssd-common

grubby --info=ALL
grub2-set-default 0
grubby --set-default /boot/vmlinuz-4.18.0-240.22.1.el8_3.x86_64
重启后系统是 CentOS Linux release 8.3.2011


替换仓库为
minorver=8.5.2111
(应该也可以直接更新到 Oracle Linux Server 8.5
dnf update

grubby --info=ALL
grubby --set-default /boot/vmlinuz-4.18.0-348.7.1.el8_5.x86_64

cryptsetup 遇到了 oom bug
# cryptsetup luksFormat --pbkdf-memory 32768 /dev/vda3

# 更新为 Oracle Linux Server 8.5
https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/getPackage/oraclelinux-release-8.5-1.0.8.el8.x86_64.rpm
https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/getPackage/redhat-release-8.5-0.8.0.2.el8.x86_64.rpm
https://yum.oracle.com/repo/OracleLinux/OL8/baseos/latest/x86_64/getPackage/oraclelinux-release-el8-1.0-22.el8.x86_64.rpm

rpm -ivh --force oraclelinux-release-8.5-1.0.8.el8.x86_64.rpm redhat-release-8.5-0.8.0.2.el8.x86_64.rpm
rpm -evh centos-gpg-keys centos-linux-repos centos-linux-release
rpm -evh epel-release
rpm -ivh oraclelinux-release-el8-1.0-22.el8.x86_64.rpm

yum -y install oracle-epel-release-el8
yum update

yum install kernel-uek

本blog WWW

Posted by windtear at April 17, 2022 1:14 PM

本站使用中的任何问题,请与 windtear @ windtear.net 联系
Copyright© 1999-2024 Windtear. All rights reserved.