Skip to content

Instantly share code, notes, and snippets.

@apolloclark
Last active February 6, 2022 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apolloclark/1da5d6bc565443cca1f4e8bef24d6816 to your computer and use it in GitHub Desktop.
Save apolloclark/1da5d6bc565443cca1f4e8bef24d6816 to your computer and use it in GitHub Desktop.
Upgrade RHEL / CentOS / Amazon Linux 2 / Oracle Linux systems
#!/bin/bash
# fix for CentOS 6.x
# https://stackoverflow.com/questions/21396508/yumrepo-error-all-mirror-urls-are-not-using-ftp-https-or-file
# There is an issue with CentOS 6.3 not supporting the modern TLS 1.2, so use the archive.kernel.org
"[Errno 14] problem making ssl connection"
sed -i 's,<find>,<replacement>,g' /etc/yum.repos.d/CentOS-Base.repo
http://mirror.centos.org/centos/$releasever/
https://archive.kernel.org/centos-vault/6.3/
https://archive.kernel.org/centos-vault/centos/6/
http://vault.centos.org/$releasever/
https://vault.centos.org/centos/6/
https://vault.centos.org/centos/$releasever/
sed -i 's,https://archive.kernel.org/centos-vault/6.5/,https://archive.kernel.org/centos-vault/6.6/,g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's,https://archive.kernel.org/centos-vault/6.5/,https://archive.kernel.org/centos-vault/centos/6/,g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's,https://archive.kernel.org/centos-vault/centos/6/,https://archive.kernel.org/centos-vault/6.5/,g' /etc/yum.repos.d/CentOS-Base.repo
sed -i 's,https://archive.kernel.org/centos-vault/centos/6/,http://vault.centos.org/$releasever/,g' /etc/yum.repos.d/CentOS-Base.repo
shutdown -r now
--> Finished Dependency Resolution
Error: libX11 conflicts with libxcb
Error: Package: kernel-2.6.32-754.35.1.el6.x86_64 (updates)
Requires: dracut-kernel >= 004-408.el6
Installed: dracut-kernel-004-284.el6_3.1.noarch (@updates)
dracut-kernel = 004-284.el6_3.1
Available: dracut-kernel-004-283.el6.noarch (base)
dracut-kernel = 004-283.el6
Error: Package: python-libs-2.6.6-68.el6_10.x86_64 (updates)
Requires: libz.so.1(ZLIB_1.2.0)(64bit)
Error: Package: ca-certificates-2020.2.41-65.1.el6_10.noarch (updates)
Requires: p11-kit-trust >= 0.18.4-2
Error: Package: yum-3.2.29-81.el6.centos.0.1.noarch (updates)
Requires: python-urlgrabber >= 3.9.1-10
Installed: python-urlgrabber-3.9.1-8.el6.noarch (@anaconda-CentOS-201207061011.x86_64/6.3)
python-urlgrabber = 3.9.1-8.el6
You could try using --skip-broken to work around the problem
# list installed repos
yum repolist
# install EPEL
yum reinstall -y epel-release
# install the webtatic repo
# https://webtatic.com/projects/yum-repository/
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
# install the Remi repo, for PHP
# http://www.servermom.org/how-to-enable-remi-repo-on-centos-7-6-and-5/2790/
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# clean the repo cache, update everything
yum clean all && yum update -y --skip-broken
# yum cheatsheet
# https://access.redhat.com/sites/default/files/attachments/rh_yum_cheatsheet_1214_jcs_print-1.pdf
# check installed packages
yum list installed | grep -i '<package_name>'
# list installed packages, not from system, nor epel, nor anaconda (system installer)
yum list installed | grep -v '@base\|@updates\|@extras\|@epel\|@anaconda'
# list installed packages, that were installed manually
yum list installed | grep 'installed'
# get details about a package
yum info '<package_name>'
# remove package, and dependencies
yum remove -y '<package_name>'
# remove package by wildcard name
yum remove -y '<package_name>*'
# remove packages from a specific repo
yum remove -y $(yum list installed | grep '<repo_name>' | awk '{ print $1 }')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment