Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Build the CentOS 6 release package for earlier RPM database
yum install -y rpm-build
wget -c http://vault.centos.org/6.5/os/Source/SPackages/centos-release-6-5.el6.centos.11.1.src.rpm
rpm2cpio centos-release-6-5.el6.centos.11.1.src.rpm | cpio -idmv
mv centos-release*.tar.gz /usr/src/redhat/SOURCES
rpmbuild -bb centos-release.spec
# Install hash support (to unbreak yum)
yum install -y python-hashlib
# Remove things that break stuff
rpm -e kudzu
rpm -e cadaver
rpm -e ipsec-tools
rpm -e rpm -e nss_ldap.i386 nss_ldap.x86_64
# Fix RPM dependencies
wget -c http://mirror.centos.org/centos/6/os/x86_64/Packages/xz-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm \
http://mirror.centos.org/centos/6/os/x86_64/Packages/xz-libs-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm
rpm -Uvh xz-*
# Fix cpio
wget -c http://vault.centos.org/6.5/os/Source/SPackages/cpio-2.10-11.el6_3.src.rpm
rpm2cpio cpio-2.10-11.el6_3.src.rpm | cpio -idmv
mv cpio*.patch cpio.1 cpio-2.10.tar.bz2 /usr/src/redhat/SOURCES/
rpm -Uvh http://vault.centos.org/5.9/os/x86_64/CentOS/autoconf-2.59-12.noarch.rpm \
http://vault.centos.org/5.9/os/x86_64/CentOS/imake-1.0.2-3.x86_64.rpm \
http://vault.centos.org/5.9/os/x86_64/CentOS/texinfo-4.8-14.el5.x86_64.rpm \
http://vault.centos.org/5.9/os/x86_64/CentOS/automake-1.9.6-2.3.el5.noarch.rpm
# Patch to force reconfiguration
perl -pi -e 's/autoheader/autoreconf\; autoheader/g;' cpio.spec
rpmbuild -bb cpio.spec
rpm -Uvh /usr/src/redhat/RPMS/x86_64/cpio-2.10-11.el6.x86_64.rpm
# Fix glibc dependencies
wget -c http://mirror.centos.org/centos/6/os/x86_64/Packages/glibc-2.12-1.132.el6.x86_64.rpm \
http://mirror.centos.org/centos/6/os/x86_64/Packages/glibc-{common,devel,static,utils}-2.12-1.132.el6.x86_64.rpm \
http://mirror.centos.org/centos/6/os/x86_64/Packages/binutils-2.20.51.0.2-5.36.el6.x86_64.rpm \
http://mirror.centos.org/centos/6/os/x86_64/Packages/libcap-2.16-5.5.el6.x86_64.rpm \
http://mirror.centos.org/centos/6/os/x86_64/Packages/compat-libcap1-1.10-1.x86_64.rpm
rpm -Uvh xz-* glibc-* binutils-* libcap-* compat-* --nodeps --force
# Do base upgrade
yum update -y glibc* yum* rpm* python*
# Reinstate LDAP
yum install -y nss-pam-ldapd
# Full upgrade
yum upgrade -y
@amitblues1234
Copy link

amitblues1234 commented Dec 20, 2017

Anyone tried this?

My current virtual machine is having centos-release-5-10.el5.centos and this works fine for magento1 but as part of project need to work on magento2 which need centOS 6 or higher versions.

Can I execute this script? reply at earliest will be very helpful.

Thanks,
Amit

@endlesslight0
Copy link

endlesslight0 commented Apr 24, 2018

Doesn't work. Tried in test centos5.11 vm.

Loaded plugins: fastestmirror
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
--2018-04-24 17:56:25--  http://vault.centos.org/6.5/os/Source/SPackages/centos-release-6-5.el6.centos.11.1.src.rpm
Resolving vault.centos.org... 109.72.83.61, 2a00:f10:10b:13::10
Connecting to vault.centos.org|109.72.83.61|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19326 (19K) [application/x-rpm]
Saving to: `centos-release-6-5.el6.centos.11.1.src.rpm'

100%[==============================================================================================>] 19,326      --.-K/s   in 0.06s

2018-04-24 17:56:25 (334 KB/s) - `centos-release-6-5.el6.centos.11.1.src.rpm' saved [19326/19326]

centos-release-6-5.tar.gz
centos-release.spec
36 blocks
mv: cannot move `centos-release-6-5.tar.gz' to `/usr/src/redhat/SOURCES': No such file or directory
upgrade.sh: line 7: rpmbuild: command not found
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
error: package kudzu is not installed
error: package cadaver is not installed
error: package ipsec-tools is not installed
error: package nss_ldap.i386 is not installed
error: package nss_ldap.x86_64 is not installed
--2018-04-24 17:56:26--  http://mirror.centos.org/centos/6/os/x86_64/Packages/xz-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm
Resolving mirror.centos.org... 185.50.225.30, 2a02:2658:1056:0:222:19ff:fed6:7c9a
Connecting to mirror.centos.org|185.50.225.30|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-04-24 17:56:26 ERROR 404: Not Found.

--2018-04-24 17:56:26--  http://mirror.centos.org/centos/6/os/x86_64/Packages/xz-libs-4.999.9-0.3.beta.20091007git.el6.x86_64.rpm
Reusing existing connection to mirror.centos.org:80.
HTTP request sent, awaiting response... 404 Not Found
2018-04-24 17:56:26 ERROR 404: Not Found.

error: File not found by glob: xz-*
--2018-04-24 17:56:26--  http://vault.centos.org/6.5/os/Source/SPackages/cpio-2.10-11.el6_3.src.rpm
Resolving vault.centos.org... 88.208.217.170, 2a00:f10:10b:13::10
Connecting to vault.centos.org|88.208.217.170|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 980823 (958K) [application/x-rpm]
Saving to: `cpio-2.10-11.el6_3.src.rpm'

100%[==============================================================================================>] 980,823     1.89M/s   in 0.5s

2018-04-24 17:56:27 (1.89 MB/s) - `cpio-2.10-11.el6_3.src.rpm' saved [980823/980823]

cpio-2.10-longnames-split.patch
cpio-2.10-patternnamesigsegv.patch
cpio-2.10-rtapeliboverflow.patch
cpio-2.10-utimens.patch
cpio-2.10.tar.bz2
cpio-2.9-dev_number.patch
cpio-2.9-dir_perm.patch
cpio-2.9-exitCode.patch
cpio-2.9-rh.patch
cpio-2.9-sys_umask.patch
cpio-2.9.90-defaultremoteshell.patch
cpio.1
cpio.spec
1952 blocks
mv: target `/usr/src/redhat/SOURCES/' is not a directory
Retrieving http://vault.centos.org/5.9/os/x86_64/CentOS/autoconf-2.59-12.noarch.rpm
Retrieving http://vault.centos.org/5.9/os/x86_64/CentOS/imake-1.0.2-3.x86_64.rpm
Retrieving http://vault.centos.org/5.9/os/x86_64/CentOS/texinfo-4.8-14.el5.x86_64.rpm
Retrieving http://vault.centos.org/5.9/os/x86_64/CentOS/automake-1.9.6-2.3.el5.noarch.rpm
warning: /var/tmp/rpm-xfer.FyIk46: Header V3 DSA signature: NOKEY, key ID e8562897
error: Failed dependencies:
	m4 is needed by autoconf-2.59-12.noarch
upgrade.sh: line 33: rpmbuild: command not found
error: open of /usr/src/redhat/RPMS/x86_64/cpio-2.10-11.el6.x86_64.rpm failed: No such file or directory
--2018-04-24 17:56:30--  http://mirror.centos.org/centos/6/os/x86_64/Packages/glibc-2.12-1.132.el6.x86_64.rpm
Resolving mirror.centos.org... 77.247.178.5, 2001:49f0:d034:1::10
Connecting to mirror.centos.org|77.247.178.5|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-04-24 17:56:30 ERROR 404: Not Found.

--2018-04-24 17:56:30--  http://mirror.centos.org/centos/6/os/x86_64/Packages/glibc-common-2.12-1.132.el6.x86_64.rpm
Reusing existing connection to mirror.centos.org:80.
HTTP request sent, awaiting response... 404 Not Found
2018-04-24 17:56:30 ERROR 404: Not Found.

--2018-04-24 17:56:30--  http://mirror.centos.org/centos/6/os/x86_64/Packages/glibc-devel-2.12-1.132.el6.x86_64.rpm
Reusing existing connection to mirror.centos.org:80.
HTTP request sent, awaiting response... 404 Not Found
2018-04-24 17:56:30 ERROR 404: Not Found.

--2018-04-24 17:56:30--  http://mirror.centos.org/centos/6/os/x86_64/Packages/glibc-static-2.12-1.132.el6.x86_64.rpm
Reusing existing connection to mirror.centos.org:80.
HTTP request sent, awaiting response... 404 Not Found
2018-04-24 17:56:30 ERROR 404: Not Found.

--2018-04-24 17:56:30--  http://mirror.centos.org/centos/6/os/x86_64/Packages/glibc-utils-2.12-1.132.el6.x86_64.rpm
Reusing existing connection to mirror.centos.org:80.
HTTP request sent, awaiting response... 404 Not Found
2018-04-24 17:56:30 ERROR 404: Not Found.

--2018-04-24 17:56:30--  http://mirror.centos.org/centos/6/os/x86_64/Packages/binutils-2.20.51.0.2-5.36.el6.x86_64.rpm
Reusing existing connection to mirror.centos.org:80.
HTTP request sent, awaiting response... 404 Not Found
2018-04-24 17:56:30 ERROR 404: Not Found.

--2018-04-24 17:56:30--  http://mirror.centos.org/centos/6/os/x86_64/Packages/libcap-2.16-5.5.el6.x86_64.rpm
Reusing existing connection to mirror.centos.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 32448 (32K) [application/x-rpm]
Saving to: `libcap-2.16-5.5.el6.x86_64.rpm'

100%[==============================================================================================>] 32,448      --.-K/s   in 0.06s

2018-04-24 17:56:30 (575 KB/s) - `libcap-2.16-5.5.el6.x86_64.rpm' saved [32448/32448]

--2018-04-24 17:56:30--  http://mirror.centos.org/centos/6/os/x86_64/Packages/compat-libcap1-1.10-1.x86_64.rpm
Reusing existing connection to mirror.centos.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 17688 (17K) [application/x-rpm]
Saving to: `compat-libcap1-1.10-1.x86_64.rpm'

100%[==============================================================================================>] 17,688      --.-K/s   in 0.003s

2018-04-24 17:56:30 (6.60 MB/s) - `compat-libcap1-1.10-1.x86_64.rpm' saved [17688/17688]

FINISHED --2018-04-24 17:56:30--
Downloaded: 2 files, 49K in 0.06s (849 KB/s)
error: File not found by glob: xz-*
error: File not found by glob: glibc-*
error: File not found by glob: binutils-*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
 Eg. Invalid release/
removing mirrorlist with no valid mirrors: /var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base

@JakobEichler
Copy link

JakobEichler commented Oct 6, 2018

For me the update guide fails in line 42 with such an error when installing the packages:
unpacking of archive failed: cpio: Bad magic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment