{"id":988,"date":"2018-11-15T10:10:46","date_gmt":"2018-11-15T03:10:46","guid":{"rendered":"https:\/\/www.whplus.com\/blog\/?p=988"},"modified":"2020-06-27T13:58:36","modified_gmt":"2020-06-27T06:58:36","slug":"upgrading-centos-6-to-centos-7","status":"publish","type":"post","link":"https:\/\/www.whplus.com\/blog\/2018\/11\/15\/upgrading-centos-6-to-centos-7.html","title":{"rendered":"Upgrading CentOS 6 to CentOS 7"},"content":{"rendered":"<p><strong>PRE TASKS<\/strong><\/p>\n<p>There are some tasks you can do to prevent from unwanted results. Like:<\/p>\n<ul>\n<li>Disable selinux<\/li>\n<li>Remove unnecessary repositories<\/li>\n<li>Take a recent backup!<\/li>\n<\/ul>\n<p><strong>CENTOS UPGRADE REPOSITORY<\/strong><\/p>\n<p>Create a new centos repository:<\/p>\n<p><code>cat &gt; \/etc\/yum.repos.d\/centos-upgrade.repo &lt;&lt;EOF<br \/>\n[centos-upgrade]<br \/>\nname=centos-upgrade<br \/>\nbaseurl=https:\/\/buildlogs.centos.org\/centos\/6\/upg\/x86_64\/<br \/>\nenabled=1<br \/>\ngpgcheck=0<br \/>\nEOF<\/code><\/p>\n<p><strong>INSTALL PRE-UPGRADE TOOL<\/strong><\/p>\n<p>First install the openscap version from dev.centos.org:<\/p>\n<p><code># yum -y install https:\/\/buildlogs.centos.org\/centos\/6\/upg\/x86_64\/Packages\/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm<\/code><\/p>\n<p>then install the redhat upgrade tool:<\/p>\n<p><code># yum -y install redhat-upgrade-tool preupgrade-assistant-*<\/code><br \/>\n<!--more--><\/p>\n<p><strong>IMPORT CENTOS 7 PGP KEY<\/strong><\/p>\n<p><code># rpm --import http:\/\/mirror.centos.org\/centos\/7\/os\/x86_64\/RPM-GPG-KEY-CentOS-7<\/code><\/p>\n<p><strong>NOTE:<\/strong><\/p>\n<p>to bypass errors like:<\/p>\n<p><em>Downloading failed: invalid data in .treeinfo: No section: &#8216;checksums&#8217;<\/em><\/p>\n<p>append CentOS Mirror under mirrorlist:<\/p>\n<p><code>mkdir -pv \/var\/tmp\/system-upgrade\/base\/ \/var\/tmp\/system-upgrade\/extras\/ \/var\/tmp\/system-upgrade\/updates\/<\/code><\/p>\n<p><code>echo http:\/\/mirror.centos.org\/centos\/7\/os\/x86_64\/ &gt;&gt; \/var\/tmp\/system-upgrade\/base\/mirrorlist.txt<br \/>\necho http:\/\/mirror.centos.org\/centos\/7\/extras\/x86_64\/ &gt;&gt; \/var\/tmp\/system-upgrade\/extras\/mirrorlist.txt<br \/>\necho http:\/\/mirror.centos.org\/centos\/7\/updates\/x86_64\/ &gt;&gt; \/var\/tmp\/system-upgrade\/updates\/mirrorlist.txt<\/code><\/p>\n<p><strong>PRE-UPGRADE<\/strong><\/p>\n<p>preupg is actually a python script!<\/p>\n<p><code># yes | preupg -v<br \/>\nPreupg tool doesn't do the actual upgrade.<br \/>\nPlease ensure you have backed up your system and\/or data in the event of a failed upgrade<br \/>\nthat would require a full re-install of the system from installation media.<br \/>\nDo you want to continue? y\/n<br \/>\nGathering logs used by preupgrade assistant:<br \/>\nAll installed packages : 01\/11 ...finished (time 00:00s)<br \/>\nAll changed files : 02\/11 ...finished (time 00:18s)<br \/>\nChanged config files : 03\/11 ...finished (time 00:00s)<br \/>\nAll users : 04\/11 ...finished (time 00:00s)<br \/>\nAll groups : 05\/11 ...finished (time 00:00s)<br \/>\nService statuses : 06\/11 ...finished (time 00:00s)<br \/>\nAll installed files : 07\/11 ...finished (time 00:01s)<br \/>\nAll local files : 08\/11 ...finished (time 00:01s)<br \/>\nAll executable files : 09\/11 ...finished (time 00:01s)<br \/>\nRedHat signed packages : 10\/11 ...finished (time 00:00s)<br \/>\nCentOS signed packages : 11\/11 ...finished (time 00:00s)<br \/>\nAssessment of the system, running checks \/ SCE scripts:<br \/>\n001\/096 ...done (Configuration Files to Review)<br \/>\n002\/096 ...done (File Lists for Manual Migration)<br \/>\n003\/096 ...done (Bacula Backup Software)<br \/>\n...<br \/>\n.\/result.html<br \/>\n\/bin\/tar: .: file changed as we read it<br \/>\nTarball with results is stored here \/root\/preupgrade-results\/preupg_results-180508202952.tar.gz .<br \/>\nThe latest assessment is stored in directory \/root\/preupgrade .<br \/>\nSummary information:<br \/>\nWe found some potential in-place upgrade risks.<br \/>\nRead the file \/root\/preupgrade\/result.html for more details.<br \/>\nUpload results to UI by command:<br \/>\ne.g. preupg -u http:\/\/127.0.0.1:8099\/submit\/ -r \/root\/preupgrade-results\/preupg_results-*.tar.gz .<br \/>\nthis must finish without any errors.<\/code><\/p>\n<p><strong>CENTOS UPGRADE TOOL<\/strong><\/p>\n<p>We need to find out what are the possible problems when upgrade:<\/p>\n<p><code># centos-upgrade-tool-cli --network=7 --instrepo=http:\/\/vault.centos.org\/7.0.1406\/os\/x86_64\/<\/code><\/p>\n<p>Then by force we can upgrade to it\u2019s latest version:<\/p>\n<p><code># centos-upgrade-tool-cli --force --network=7 --instrepo=http:\/\/vault.centos.org\/7.0.1406\/os\/x86_64\/ --cleanup-post<\/code><\/p>\n<p>Output:<br \/>\n<code><br \/>\nsetting up repos...<br \/>\nbase | 3.6 kB 00:00<br \/>\nbase\/primary_db | 4.9 MB 00:04<br \/>\ncentos-upgrade | 1.9 kB 00:00<br \/>\ncentos-upgrade\/primary_db | 14 kB 00:00<br \/>\ncmdline-instrepo | 3.6 kB 00:00<br \/>\ncmdline-instrepo\/primary_db | 4.9 MB 00:03<br \/>\nepel\/metalink | 14 kB 00:00<br \/>\nepel | 4.7 kB 00:00<br \/>\nepel | 4.7 kB 00:00<br \/>\nepel\/primary_db | 6.0 MB 00:04<br \/>\nextras | 3.6 kB 00:00<br \/>\nextras\/primary_db | 4.9 MB 00:04<br \/>\nmariadb | 2.9 kB 00:00<br \/>\nmariadb\/primary_db | 33 kB 00:00<br \/>\nremi-php56 | 2.9 kB 00:00<br \/>\nremi-php56\/primary_db | 229 kB 00:00<br \/>\nremi-safe | 2.9 kB 00:00<br \/>\nremi-safe\/primary_db | 950 kB 00:00<br \/>\nupdates | 3.6 kB 00:00<br \/>\nupdates\/primary_db | 4.9 MB 00:04<br \/>\n.treeinfo | 1.1 kB 00:00<br \/>\ngetting boot images...<br \/>\nvmlinuz-redhat-upgrade-tool | 4.7 MB 00:03<br \/>\ninitramfs-redhat-upgrade-tool.img | 32 MB 00:24<br \/>\nsetting up update...<br \/>\nfinding updates 100% [=========================================================]<br \/>\n(1\/323): MariaDB-10.2.14-centos6-x86_64-client.rpm | 48 MB 00:38<br \/>\n(2\/323): MariaDB-10.2.14-centos6-x86_64-common.rpm | 154 kB 00:00<br \/>\n(3\/323): MariaDB-10.2.14-centos6-x86_64-compat.rpm | 4.0 MB 00:03<br \/>\n(4\/323): MariaDB-10.2.14-centos6-x86_64-server.rpm | 109 MB 01:26<br \/>\n(5\/323): acl-2.2.51-12.el7.x86_64.rpm | 81 kB 00:00<br \/>\n(6\/323): apr-1.4.8-3.el7.x86_64.rpm | 103 kB 00:00<br \/>\n(7\/323): apr-util-1.5.2-6.el7.x86_64.rpm | 92 kB 00:00<br \/>\n(8\/323): apr-util-ldap-1.5.2-6.el7.x86_64.rpm | 19 kB 00:00<br \/>\n(9\/323): attr-2.4.46-12.el7.x86_64.rpm | 66 kB 00:00<br \/>\n...<br \/>\n(320\/323): yum-plugin-fastestmirror-1.1.31-24.el7.noarch.rpm | 28 kB 00:00<br \/>\n(321\/323): yum-utils-1.1.31-24.el7.noarch.rpm | 111 kB 00:00<br \/>\n(322\/323): zlib-1.2.7-13.el7.x86_64.rpm | 89 kB 00:00<br \/>\n(323\/323): zlib-devel-1.2.7-13.el7.x86_64.rpm | 49 kB 00:00<br \/>\ntesting upgrade transaction<br \/>\nrpm transaction 100% [=========================================================]<br \/>\nrpm install 100% [=============================================================]<br \/>\nsetting up system for upgrade<br \/>\nFinished. Reboot to start upgrade.<\/code><\/p>\n<p><strong>REBOOT<\/strong><\/p>\n<p>The upgrade procedure, will download all rpm packages to a directory and create a new grub entry. Then on reboot the system will try to upgrade the distribution release to it\u2019s latest version.<\/p>\n<p><code># reboot<\/code><\/p>\n<p>When this error appears :<\/p>\n<p><code>\/bin\/grep: error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory<\/code><\/p>\n<p>Run the following command:<\/p>\n<p><code>ln -s \/lib64\/libpcre.so.1 \/lib64\/libpcre.so.0<\/code><\/p>\n<p><strong>Disclaimer : Create a recent backup of the system. This is an unofficial , unsupported procedure !<\/strong><\/p>\n<p>After reboot you may need to upgrade bootloader into grub2, you can follow <a href=\"https:\/\/www.whplus.com\/blog\/2020\/07\/01\/manual-installation-of-grub2-boatloader.html\">this link<\/a><\/p>\n<p>source: http:\/\/fsfe.soup.io\/post\/651104763\/Evaggelos-Balaskas-System-Engineer-CentOS-Dist-Upgrade<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PRE TASKS There are some tasks you can do to prevent from unwanted results. Like: Disable selinux Remove unnecessary repositories Take a recent backup! CENTOS UPGRADE REPOSITORY Create a new centos repository: cat &gt; \/etc\/yum.repos.d\/centos-upgrade.repo &lt;&lt;EOF [centos-upgrade] name=centos-upgrade baseurl=https:\/\/buildlogs.centos.org\/centos\/6\/upg\/x86_64\/ enabled=1 gpgcheck=0 EOF INSTALL PRE-UPGRADE TOOL First install the openscap version from dev.centos.org: # yum -y\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.whplus.com\/blog\/2018\/11\/15\/upgrading-centos-6-to-centos-7.html\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-988","post","type-post","status-publish","format-standard","hentry","category-tutorial"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/988","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/comments?post=988"}],"version-history":[{"count":10,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/988\/revisions"}],"predecessor-version":[{"id":1253,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/posts\/988\/revisions\/1253"}],"wp:attachment":[{"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/media?parent=988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/categories?post=988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whplus.com\/blog\/wp-json\/wp\/v2\/tags?post=988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}