Com as mudanças do CentOS todos da comunidade ficaram com medo das mudanças impostas depois de anos na distribuição pela IBM, então essa semana a empresa decidiu migrar todos os servidores que atualmente usam Centos 7 para Oracle Linux 8 baseados em argumentos técnicos e informações consolidadas de anos usando Oracle Linux para banco de dados.
Lembre-se sempre de testar todos os serviços, pacotes e aplicações antes de migrar os servidores de produção, só assim será possível medir o impacto e possíveis problemas que podem ocorrer, para esta migração iremos utilizar o utilitário Leapp.
O utilitário Leapp é utilizado para atualizar sistemas operacionais, bem como aplicativos. Os pacotes de componentes do utilitário permitem a criação de diferentes fluxos de trabalho em perfis para atualização de software.
As operações do Leapp consistem em duas fases: uma fase de pré-atualização que executa verificações no sistema para determinar se o software pode ser atualizado. A segunda fase é a atualização propriamente dita, cujo processo é baseado em arquivos de configuração que mapeiam pacotes entre versões anteriores e atuais do software.
Observação.
Atualmente, o utilitário Leapp é usado apenas para atualizar os sistemas operacionais, especificamente, da versão atual do Oracle Linux 7 para a versão atual do Oracle Linux 8. Os procedimentos neste documento não se aplicam e não são suportados em nenhum outro sistema operacional ou versão.
1 – Confirmando que nossa versão do Oracle Linux é 7.
[root@srvv001 ~]# cat /etc/*-release | grep PRETTY
PRETTY_NAME="Oracle Linux Server 7.9"
ShellScript2 – Levantamento de serviços ou aplicativos atualmente utilizados no servidor.
[root@srvv001 ~]# systemctl list-unit-files --state=enabled
UNIT FILE STATE
auditd.service enabled
[email protected] enabled
chronyd.service enabled
crond.service enabled
dbus-org.freedesktop.NetworkManager.service enabled
dbus-org.freedesktop.nm-dispatcher.service enabled
dmraid-activation.service enabled
[email protected] enabled
irqbalance.service enabled
libstoragemgmt.service enabled
lvm2-monitor.service enabled
microcode.service enabled
NetworkManager-dispatcher.service enabled
NetworkManager-wait-online.service enabled
NetworkManager.service enabled
ol-consolebaud.service enabled
postfix.service enabled
rhel-autorelabel.service enabled
rhel-configure.service enabled
rhel-dmesg.service enabled
rhel-domainname.service enabled
rhel-import-state.service enabled
rhel-loadmodules.service enabled
rhel-readonly.service enabled
rngd.service enabled
rsyslog.service enabled
smartd.service enabled
sshd.service enabled
sysstat.service enabled
systemd-readahead-collect.service enabled
systemd-readahead-drop.service enabled
systemd-readahead-replay.service enabled
tuned.service enabled
waagent-network-setup.service enabled
waagent.service enabled
dm-event.socket enabled
lvm2-lvmetad.socket enabled
lvm2-lvmpolld.socket enabled
rpcbind.socket enabled
default.target enabled
multi-user.target enabled
remote-fs.target enabled
runlevel2.target enabled
runlevel3.target enabled
runlevel4.target enabled
[root@srvv001 ~]# systemctl list-units --type=service --state=running
UNIT LOAD ACTIVE SUB DESCRIPTION
auditd.service loaded active running Security Auditing Service
chronyd.service loaded active running NTP client/server
crond.service loaded active running Command Scheduler
dbus.service loaded active running D-Bus System Message Bus
[email protected] loaded active running Getty on tty1
hypervkvpd.service loaded active running Hyper-V KVP daemon
irqbalance.service loaded active running irqbalance daemon
libstoragemgmt.service loaded active running libstoragemgmt plug-in server daemon
lvm2-lvmetad.service loaded active running LVM2 metadata daemon
network.service loaded active running LSB: Bring up/down networking
NetworkManager.service loaded active running Network Manager
polkit.service loaded active running Authorization Manager
postfix.service loaded active running Postfix Mail Transport Agent
rngd.service loaded active running Hardware RNG Entropy Gatherer Daemon
rsyslog.service loaded active running System Logging Service
[email protected] loaded active running Serial Getty on ttyS0
smartd.service loaded active running Self Monitoring and Reporting Technology (SMART) Daemon
sshd.service loaded active running OpenSSH server daemon
systemd-journald.service loaded active running Journal Service
systemd-logind.service loaded active running Login Service
systemd-udevd.service loaded active running udev Kernel Device Manager
tuned.service loaded active running Dynamic System Tuning Daemon
waagent.service loaded active running Azure Linux Agent
webmin.service loaded active running LSB: web-based administration interface for Unix systems
ShellScript3 – Interrompa toda a carga de trabalho existente, como banco de dados ou servidores web.
[root@srvv001 ~]# systemctl stop mysql
[root@srvv001 ~]# systemctl status mysql
[root@srvv001 ~]# systemctl stop zabbix-server
[root@srvv001 ~]# systemctl status zabbix-server
ShellScript4 – Desabilite o Secure Boot se estiver executando.
[root@srvv001 ~]# sudo bootctl status
System:
Machine ID: 97da09219a2d42489c8b8f748e6d2fb7
Boot ID: 0047229b30834535b9a87057d59677c7
No suitable data is provided by the boot manager. See:
http://www.freedesktop.org/wiki/Software/systemd/BootLoaderInterface
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
for details.
## OR ##
...
Secure Boot: disabled
...
[root@srvv001 ~]# sudo mokutil --sb-state
SecureBoot disabled
ShellScript5 – Verifique se o locale está definido como en_US.UTF-8.
[root@srvv001 ~]# cat /etc/locale.conf
LANG="en_US.UTF-8"
# If necessary, edit the file to set the locale accordingly.
sudo localectl set-locale LANG=en_US.UTF-8
ShellScript6 – Se o seu sistema tiver sistemas de arquivos montados em nfs, desmonte-os e comente as entradas relacionadas no arquivo /etc/fstab.
[root@srvv001 ~]# umount /BACKUP
ShellScript7 – Se você instalou o pacote yum-plugin-versionlock, limpe todos os pacotes com versões bloqueadas.
[root@srvv001 ~]# yum versionlock clear
ShellScript8 – Obtenha os pacotes mais recentes do Oracle Linux 7.
[root@srvv001 ~]# yum update -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No packages marked for update
ShellScript9 – Reinicie o servidor após as atualizações.
[root@srvv001 ~]# sudo reboot
ShellScript10 – Instale o utilitário Leapp habilitando determinados repositórios, conforme abaixo:
[root@srvv001 ~]# sudo yum install -y leapp --enablerepo=ol7_leapp,ol7_latest
Installed:
leapp.noarch 0:0.12.1-1.0.1.el7_9
ShellScript11 – Executando o Preupgrade, Edite PermitRootLogin para yes.
[root@srvv001 yum.repos.d]# cat /etc/ssh/sshd_config | grep PermitRootLogin
##PermitRootLogin yes
## the setting of "PermitRootLogin without-password".
PermitRootLogin yes # <============================
[root@srvv001 yum.repos.d]# systemctl restart sshd
[root@srvv001 leapp answer --section remove_pam_pkcs11_module_check.confirm=True --add
ShellScript12 – Gerando relatório para análise e validação antes de atualizar do Oracle Linux 7 para o Oracle Linux 8.
12.1 – Verificação pré-atualização do sistema local
leapp preupgrade --oraclelinux
ShellScript12.2 – Verificação pré-atualização OCI
leapp preupgrade --oci
ShellScript12.3 – Repositórios de verificação pré-atualização
leapp preupgrade --enablerepo
ShellScript[root@srvv001 yum.repos.d]# leapp preupgrade --oraclelinux
Transaction Summary
===================================================================================================================
Install 187 Packages
Upgrade 500 Packages
Remove 60 Packages
Downgrade 15 Packages
Total size: 687 M
Total download size: 610 M
Downloading Packages:
Check completed.
==> Processing phase `Reports`
====> * verify_check_results
Check all dialogs and notify that user needs to make some choices.
====> * verify_check_results
Check all generated results messages and notify user about them.
============================================================
UPGRADE INHIBITED
============================================================
Upgrade has been inhibited due to the following problems:
1. Inhibitor: Missing required answers in the answer file
Consult the pre-upgrade report for details and possible remediation.
============================================================
UPGRADE INHIBITED
============================================================
Debug output written to /var/log/leapp/leapp-preupgrade.log
============================================================
REPORT
============================================================
A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt
============================================================
END OF REPORT
============================================================
Answerfile has been generated at /var/log/leapp/answerfile
ShellScript13 – Leia os logs para entender quais pacotes, bibliotecas ou aplicativos podem ser afetados ou possíveis problemas que devem ser avaliados antes do upgrade de verão.
============================================================
UPGRADE INHIBITED
============================================================
Upgrade has been inhibited due to the following problems:
1. Inhibitor: Missing required answers in the answer file
Consult the pre-upgrade report for details and possible remediation.
ShellScript14 – Aplique as correções recomendadas.
[root@srvv001 leapp]# leapp answer --section remove_pam_pkcs11_module_check.confirm=True --add
ShellScript15 – Aplicando a atualização do Oracle Linux 7 para o Oracle Linux 8.
[root@srvv001 yum.repos.d]# leapp upgrade --oraclelinux --verbose
--------------------------------------------------------------------------------
Total 33 MB/s | 610 MB 00:18
Running transaction check
Transaction check succeeded.
Running transaction test
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
ShellScript16 – Se sua sessão cair, siga os logs gerados no diretório.
[root@srvv001 leapp]# cd /var/log/leapp/
[root@srvv001 leapp]# ls -lat
total 1872
-rw-r--r--. 1 root root 153514 Oct 23 14:53 leapp-report.txt
drwx------. 3 root root 170 Oct 23 14:53 .
-rw-r--r--. 1 root root 160300 Oct 23 14:53 leapp-report.json
-rw-r--r--. 1 root root 1571178 Oct 23 14:53 leapp-upgrade.log
-rw-r--r--. 1 root root 49 Oct 23 14:53 answerfile.userchoices
-rw-r--r--. 1 root root 501 Oct 23 14:53 answerfile
-rw-r--r--. 1 root root 8593 Oct 23 14:51 dnf-plugin-data.txt
drwxr-xr-x. 2 root root 86 Oct 23 14:27 archive
ShellScript17 – Avaliar e analisar relatórios após migração de versão.
============================================================
END OF ERRORS
============================================================
Debug output written to /var/log/leapp/leapp-upgrade.log
============================================================
REPORT
============================================================
A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt
============================================================
END OF REPORT
============================================================
ShellScript18 – Ao realizar a validação encontrei os erros abaixo, para resolver tive que remover o pacote sysvinit-tools.
STDERR:
Warning: Packages marked by Leapp for install not found in repositories metadata: rpcgen
RPM: warning: Generating 6 missing index(es), please wait...
Error: Transaction test error:
file /usr/sbin/pidof from install of procps-ng-3.3.15-6.0.1.el8.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
file /usr/bin/last from install of util-linux-2.32.1-27.el8.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
file /usr/bin/mesg from install of util-linux-2.32.1-27.el8.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
file /usr/bin/wall from install of util-linux-2.32.1-27.el8.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
file /usr/share/man/man1/last.1.gz from install of util-linux-2.32.1-27.el8.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
file /usr/share/man/man1/mesg.1.gz from install of util-linux-2.32.1-27.el8.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
file /usr/share/man/man1/wall.1.gz from install of util-linux-2.32.1-27.el8.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
ShellScript[root@srvv001 leapp]# yum remove sysvinit-tools*
[root@srvv001 yum.repos.d]# leapp upgrade --oraclelinux --verbose
ShellScript19 – Reinicie o servidor.
[root@srvv001 yum.repos.d]# sudo reboot
ShellScript20 – Verificando a versão atual do kernel instalado e a versão do SO.
[root@srvv001 ~]# cat /etc/*-release | grep PRETTY
PRETTY_NAME="Oracle Linux Server 8.4"
[root@srvv001 ~]# uname -r
5.4.17-2136.300.7.el8uek.x86_64
ShellScript21 – Update e upgrade de packages.
[root@srvv001 ~]# dnf update -y
[root@srvv001 ~]# dnf upgrade -y
ShellScript22 – Links:
https://www.oracle.com/br/linux/
https://docs.oracle.com/en/operating-systems/oracle-linux/8/leapp/chap-leapp-prep.html
https://docs.oracle.com/en/operating-systems/oracle-linux/8/leapp/about-leapp.html#features
https://docs.oracle.com/en/operating-systems/oracle-linux/8/leapp/chap-leapp-upgrade.html#leapp-answerfile
https://docs.oracle.com/en/operating-systems/oracle-linux/8/leapp/about-leapp.html#kernel-support
ShellScript