MigrationFromCentOS76ToRocky

1. 初始环境(CentOS76)

使用vagrant创建CentOS7.6.1810虚拟机一台:

# vim Vagrantfile
Vagrant.configure("2") do |config|
  config.vm.box = "bento/centos-7.6"
    config.vm.provider "virtualbox" do |v|
        v.memory = 4096
        v.cpus = 4
    end
end
# vagrant up 
# vagrant ssh

登陆入系统后检查初始环境信息:

[vagrant@localhost ~]$ cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 
[vagrant@localhost ~]$ uname -a
Linux localhost.localdomain 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

2. CentOS7.6升级到CentOS8.1

2.1 升级前准备

安装EPEL(Extra Package for Enterprise Linux)库,因升级中需用到该库, 并创建该库缓存:

# yum install -y epel-release.noarch
# yum makecache fast

安装升级CentOS 7到8过程中需要用到的rpmconf包及yum-utils包:

# yum install -y yum-utils rpmconf

计算重复/无用包及配置:

# rpmconf -a
安装过程中,选择 N:  
*** aliases (Y/I/N/O/D/M/Z/S) [default=N] ? 
Your choice: N

升级yumdnf,安装完毕后,删除不再需要的yum及相关包:

# yum install -y dnf
# dnf remove -y yum yum-metadata-parser

删除现有的repo配置并重新生成仓库缓存, 并使用dnf升级为最新状态:

# rm -Rf /etc/yum
#  dnf makecache
Extra Packages for Enterprise Linux 7 - x86_64   5.9 MB/s |  16 MB     00:02    
CentOS-7 - Base                                  4.1 MB/s |  10 MB     00:02    
CentOS-7 - Updates                               7.6 MB/s |  21 MB     00:02    
CentOS-7 - Extras                                165 kB/s | 332 kB     00:02    
Metadata cache created.
# dnf upgrade -y

2.2 升级8仓库准备

跨大版本升级可能会衍生出一些问题,因而我们先使用8.1版本的CentOS8系统包作为中间状态升级:

# dnf upgrade -y  https://mirrors.ustc.edu.cn/centos-vault/8.1.1911//BaseOS/x86_64/os/Packages/{centos-release-8.1-1.1911.0.8.el8.x86_64.rpm,centos-gpg-keys-8.1-1.1911.0.8.el8.noarch.rpm,centos-repos-8.1-1.1911.0.8.el8.x86_64.rpm}

升级EPEL仓库包从EL 7到EL 8:

# dnf upgrade -y epel-release

因跨大版本升级可能会导致问题,切换BaseOSAppStream库为8.1.1911:

# cd /etc/yum.repos.d
# mkdir back
# mv CentOS-* back/
# sudo tee CentOS-Linux-BaseOS.repo<<EOM
[baseos]
name=CentOS Linux \$releasever - BaseOS
baseurl=http://vault.centos.org/8.1.1911/BaseOS/\$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOM

# sudo tee CentOS-Linux-AppStream.repo<<EOM
[appstream]
name=CentOS Linux \$releasever - AppStream
baseurl=http://vault.centos.org/8.1.1911/AppStream/\$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOM
# sudo cp CentOS-Linux-BaseOS.repo /root/CentOS-Linux-BaseOS.repo
# sudo cp CentOS-Linux-AppStream.repo /root/CentOS-Linux-AppStream.repo
# dnf makecache
Extra Packages for Enterprise Linux 8 - x86_64                4.7 MB/s |  13 MB     00:02    
CentOS-8 - Base                                               1.1 MB/s | 4.6 MB     00:04    
Extra Packages for Enterprise Linux Modular 8 - x86_64        197 kB/s | 733 kB     00:03    
CentOS-8 - AppStream                                          1.3 MB/s | 8.4 MB     00:06    
CentOS-8 - Extras                                             4.3 kB/s |  10 kB     00:02    
Module yaml error: Unexpected key in data
Module yaml error: Unexpected key in data
Module yaml error: Unexpected key in data
Module yaml error: Unexpected key in data
Module defaults error: Unexpected key in data
Module defaults error: Unexpected key in data
Module defaults error: Unexpected key in data
Module defaults error: Unexpected key in data
Metadata cache created.

2.3 升级到CentOS 8

删除所有安装过的kernel:

# rpm -e `rpm -q kernel`

删除sysvinit-tools等冲突包:

# rpm -e --nodeps sysvinit-tools sysvinit-tools python36-rpmconf 

执行以下命令,升级到CentOS 8:

# dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync

升级成功后,/etc/yum.repos.d目录下会被覆盖,回归到8.1版本

# cd /etc/yum.repos.d
# mkdir back1
# mv CentOS-* back1/
# sudo cp /root/CentOS-Linux-BaseOS.repo .
# sudo cp /root/CentOS-Linux-AppStream.repo .

安装内核包:

# dnf makecache
# dnf install -y kernel-core

安装minimalCore包组合:

# mv /etc/yum/protected.d /etc/yum/protected.d.back
# dnf -y groupupdate "Core" "Minimal Install"

2.4 升级CentOS8.5

回归原来的包配置:

# cd /etc/yum.repos.d/
# rm -f CentOS-*
# mv back1/* .
# CENTOS_BASE=http://vault.centos.org
# sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-* 
# sed -i -e 's|#baseurl=http://mirror.centos.org|baseurl='$CENTOS_BASE'|g' /etc/yum.repos.d/CentOS-*
# dnf update

更新完毕后,重启,而后检查内核及操作系统版本:

# uname -a
Linux localhost.localdomain 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/redhat-release 
CentOS Linux release 8.5.2111

3. CentOS 8 -> Rocky Linux 8

下载Rocky Linux升级脚本:

# dnf -y install wget
# wget https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
# chmod a+x migrate2rocky.sh

升级到Rocky Linux 8.6:

./migrate2rocky.sh -r

/images/2022_11_02_16_04_40_865x689.jpg

等待一段时间(取决于网速及机器配置,vagrant虚拟机约15分钟),等待升级完成:

/images/2022_11_02_16_11_03_707x457.jpg

4. 验证

重启该机器后,验证升级情况:

[vagrant@localhost ~]$ uname -a
Linux localhost.localdomain 4.18.0-372.32.1.el8_6.x86_64 #1 SMP Thu Oct 27 15:18:36 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
[vagrant@localhost ~]$ cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.6 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.6 (Green Obsidian)"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
ROCKY_SUPPORT_PRODUCT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8"

WindowsVirtualBoxUCC

Env Preparation

Install VirtualBox 7.0.2:

/images/2022_10_26_09_19_41_455x301.jpg

View version:

/images/2022_10_26_09_20_32_843x589.jpg

Disable the dhcp server for default Host-only Networks:

/images/2022_10_26_09_27_37_627x467.jpg

VM Creation

Create a new vm(type Linux->Other Linux):

/images/2022_10_26_09_29_24_778x373.jpg

2 Cores, 2048MB Memory:

/images/2022_10_26_09_29_56_643x203.jpg

Specify centos85.vdi file for hard disk:

/images/2022_10_26_09_30_38_648x273.jpg

Configure the vm to specify its networking:

/images/2022_10_26_09_31_24_804x391.jpg

Visit https://192.168.56.199 should reach the ucc server web admin page:

/images/2022_10_26_09_34_44_771x540.jpg

UCC Client Testing

Create a new machine(type Windows 10):

/images/2022_10_26_09_36_04_747x326.jpg

2 Cores, 3072 MB Memory, Enable EFI:

/images/2022_10_26_09_36_49_648x238.jpg

Create 50 GB disk:

/images/2022_10_26_09_37_09_646x267.jpg

Configure this VM, select ICH9 as its chipset:

/images/2022_10_26_09_38_41_620x481.jpg

Enable Network as its boot sequence:

/images/2022_10_26_09_40_04_594x370.jpg

Change Network to host-only type:

/images/2022_10_26_09_42_16_713x344.jpg

System will boot into EFI shell, input exit to bios:

/images/2022_10_26_09_40_52_603x279.jpg

Select Boot Manage, press enter:

/images/2022_10_26_09_41_13_582x236.jpg

Select UEFI PXEv4 for booting:

/images/2022_10_26_09_41_34_638x346.jpg

pxe will boot into register name, input name ucctestwin10 for continue:

/images/2022_10_26_09_44_19_1152x854.jpg

Click setup button for initialization this node:

/images/2022_10_26_09_45_11_958x620.jpg

Initialize the disk using the default parameters:

/images/2022_10_26_09_46_25_1706x560.jpg

Now return to login page, the disk and network indication should be green, enter username/password for continue:

/images/2022_10_26_09_49_10_470x605.jpg

Click TCI for downloading the package and boot into windows 10:

/images/2022_10_26_09_49_59_1529x871.jpg

windows 10 in virtualbox:

/images/2022_10_26_09_59_21_909x816.jpg

Don’t try idv, cause in virtualbox it will run into error:

/images/2022_10_26_10_00_56_1024x531.jpg

Ubuntu Verification

Upload the image and copy it into corresponding directory:

/images/2022_10_26_10_30_02_651x127.jpg

Register image in UCC Server admin pages:

/images/2022_10_26_10_31_04_714x559.jpg

Create a new machine for testing Ubuntu:

/images/2022_10_26_10_31_44_633x307.jpg

2Core, 2048 MB , enable uefi:

/images/2022_10_26_10_32_08_663x260.jpg

Select ICH9 for chipset, and enable the network boot:

/images/2022_10_26_10_32_57_681x426.jpg

Change the network:

/images/2022_10_26_10_33_13_568x366.jpg

exit and into the bios:

/images/2022_10_26_10_34_06_616x290.jpg

Boot Manager and select UEFI PXEv4:

/images/2022_10_26_10_34_33_600x419.jpg

Register client:

/images/2022_10_26_10_35_33_658x218.jpg

Initialize the disk:

/images/2022_10_26_10_36_03_1413x407.jpg

Select Ubuntu for downloading and boot into system:

/images/2022_10_26_10_37_38_1001x301.jpg

Ubuntu desktop:

/images/2022_10_26_10_41_47_809x720.jpg

WorkingTipsOnucc

Create a inner networking for testing:

/images/2022_10_25_09_48_58_519x557.jpg

Select the inner networking for imported vm:

/images/2022_10_25_09_49_48_719x410.jpg

Change vm’s ip address configuration:

/images/2022_10_25_09_52_46_481x379.jpg

Check the changed ip configuration:

/images/2022_10_25_09_53_37_639x193.jpg

visit https://10.17.18.2 for changing ucc server configuration:

/images/2022_10_25_09_54_54_541x562.jpg

Changed the server address:

/images/2022_10_25_09_59_20_312x164.jpg

Change the dhcp service:

/images/2022_10_25_10_01_51_448x397.jpg

Delete all of the registed server:

/images/2022_10_25_10_04_49_817x322.jpg

Verification

Create 2 vm images file under /var/lib/libvirt/images:

# qemu-img create -f qcow2 win1.qcow2 50G
# qemu-img create -f qcow2 win2.qcow2 50G

Manually import :

/images/2022_10_25_10_10_19_423x263.jpg

2 core, 4096 MiB memory. Select win1.qcow2:

/images/2022_10_25_10_11_07_396x234.jpg

uefi relatd configuration:

/images/2022_10_25_10_13_03_786x544.jpg

Select Nic:

/images/2022_10_25_10_13_28_581x324.jpg

Change the boot options:

/images/2022_10_25_10_15_40_469x345.jpg

Configuration:

/images/2022_10_25_10_20_34_465x219.jpg

Initialize the disk:

/images/2022_10_25_10_21_09_1830x619.jpg

Succeed:

/images/2022_10_25_10_22_25_1172x265.jpg

Login with user1:

/images/2022_10_25_10_23_12_448x582.jpg

Select the TCI for downloading:

/images/2022_10_25_10_23_46_541x315.jpg

Virtualbox way

Create vm and import:

/images/2022_10_25_11_28_49_964x545.jpg

Import vm disk:

/images/2022_10_25_11_30_03_1059x541.jpg

Create network(without dhcp):

/images/2022_10_25_11_31_46_520x218.jpg

Choose the network:

/images/2022_10_25_11_32_23_802x439.jpg

WorkingTipsOnProxmoxGVTG

Change configuration

Change grub options:

# vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
TO
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt i915.enable_gvt=1"

# vi /etc/modules
vfio
vfio_iommu_type1
vfio_pci
vfio_virqfd
kvmgt

Update:

# update-grub2
# update-initramfs -u -k all

Check status:

Check iommu features:

# dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
# find /sys/kernel/iommu_groups/ -type l

Get the VGA related:

root@pve:~# lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 630 (rev 04)
root@pve:~# ls /sys/bus/pci/devices/0000\:00\:02.0/mdev_supported_types/
i915-GVTg_V5_4	i915-GVTg_V5_8

vm installation

Create a vm (win7) like:

/images/2022_09_30_10_01_06_720x245.jpg

/images/2022_09_30_10_02_04_724x216.jpg

Add PCI device:

/images/2022_09_30_10_03_54_614x173.jpg

hardware:

/images/2022_09_30_10_04_22_961x349.jpg

Then install the windows in console.

Install “Jianjizhi” and test usage.

/images/2022_09_30_10_30_50_943x660.jpg

Install intel video:

/images/2022_09_30_10_31_52_599x404.jpg

/images/2022_09_30_10_32_15_427x337.jpg

Select Install this driver software anyway:

/images/2022_09_30_10_32_37_549x382.jpg

Select reboot this computer now:

/images/2022_09_30_10_33_49_438x342.jpg

Status:

/images/2022_09_30_10_43_27_657x467.jpg

WorkingtipsOnXenGT

hardware

hardware:

$ cat /proc/cpuinfo | grep model
model		: 60
model name	: Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz
$ free -g
             total       used       free     shared    buffers     cached
Mem:            30          1         29          0          0          0
-/+ buffers/cache:          0         30
Swap:            0          0          0
dash@ubuntu1404:~$ cat /etc/issue
Ubuntu 14.04.5 LTS \n \l

dash@ubuntu1404:~$ uname -a
Linux ubuntu1404 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Install ubuntu14.04, change repository to mirrors.ustc.edu.cn, then install packages:

# apt-get install libarchive-dev libghc-bzlib-dev  zlib1g-dev mercurial gettext bcc iasl uuid-dev libncurses5-dev kpartx bc libperl-dev libgtk2.0-dev libc6-dev-i386 libaio-dev libsdl1.2-dev nfs-common libyajl-dev libx11-dev autoconf libtool xsltproc bison flex xutils-dev xserver-xorg-dev x11proto-gl-dev libx11-xcb-dev vncviewer libxcb-glx0 libxcb-glx0-dev libxcb-dri2-0-dev libxcb-xfixes0-dev bridge-utils python-dev bin86 git vim libssl-dev pciutils-dev tightvncserver ssh texinfo -y

Check

Before install driver:

/images/2022_09_29_10_00_16_732x530.jpg

Install driver:

/images/2022_09_29_10_06_34_519x420.jpg

Restart the machine, check the driver status: