Managing Yum in cPanel
"Yum is an automatic updater and package installer/remover for rpm systems. It automatically computes dependencies and figures out what things should occur to install packages. It makes it easier to maintain groups of machines without having to manually update each one using rpm. Yum has a plugin interface for adding simple features. Yum can also be used from other python programs via its module interface." Source: [url=http://yum.baseurl.org/]yum - Trac
If you are seeking for specifics on how yum works in general, and perhaps are switching from a system that utilized apt-get or ports, I would recommend reading over [url=http://www.phy.duke.edu/~rgb/General/yum_HOWTO/yum_HOWTO/yum_HOWTO-1.html]Yum (Yellowdog Updater, Modified) HOWTO: Introduction as it contains extremely useful information on how it works and the core mechanics of it.
The reason for the creation of this blog post is due to the amount of reliance cPanel/WHM has on yum overall. Additionally, cPanel/WHM is actively moving toward being and RPM-based distribution. The end goal of this blog post is to help getting a basic understanding of managing yum and it"s packages (rpm) in the capacity that cPanel/WHM utilizes it.
The most common yum-cPanel related commands are:
yum check-update - Implemented so you could know if your machine had any updates that needed to be applied without running it interactively.
yum update - Updates all installed packages to the latest supported version.
yum clean metadata - Cleans up xml metadata that may have been cached.
yum clean all - Cleans all cached files from any repository that is enabled.
yum check - Checks the local rpmdb and produces information on any problems it finds.
/usr/local/cpanel/scripts/rpmup2 - Replicates the same behavior as running a "yum update"
/usr/local/cpanel/scripts/sysup - Updates software dependencies required by cPanel
/usr/local/cpanel/scripts/safeyum - upcp utilizes this script to ensure there is a sane version of yum installed and handles errors properly.
/usr/local/cpanel/scripts/checkyum - Ran during upcp to exclude specific packages from being updated/installed such as kernel* and then removes the exclude after the update completes.
The most common yum-cPanel related files are: /etc/checkyumdisable - Disables checkyum from running /var/cpanel/checkyum-keepkernel - Touching this file will preserve the kernel related exclusions.
The cPanel technical support team can help resolve a myriad of yum-related issues, however, to note specific instances where the scope of our support ends, we are usually hands-off with issues such as: [LIST]dependencies or issues revolving around Python
dependencies or issues revolving around OpenSSL
dependencies related to architecture (32->64) changes
This is because issues related to these types of software or architecture changes could be potentially disastrous if not handled appropriately by a server administrator and are not provided or maintained by cPanel.
The most commonly supported issues are usually related to issues with the yum repositories. Many customers and providers install 3rd party repositories which can sometimes cause conflicting packages. Simply disabling the additional repositories temporarily can usually resolve a number of issues, and this can be done in a few methods:
1. You can move all of the additional repositories from /etc/yum.repos.d into a different folder and then proceed with your yum-related command
2. You can use the yum command which excludes/disables additional repositories:
so that only the base and update repos are enabled. Common Issues
This is a very common issue we see in tickets and the solution to resolving it is rather simple. This usually indicates that the repository you are using for "base" in /etc/yum.repos.d/CentOS-Base.repo is invalid or perhaps even commented out. To fix this, simply modify the file:
then search for the following section:
You will see in this example both the mirrorlist and baseurl are commented out, simply removing the "#" on baseurl will resolve the above issue. If you happen to have an incorrect mirror or baseurl, you can find some defaults on
you can see here that we"re on x86_64 so we would want to remove the i686 package with:
You should then be able to proceed with your original yum transaction. [HR][/HR]
This error is typically associated with possible RPM database corruption which can be resolved with a few commands. Please keep in mind that while this normally resolves the issue, there is always the possibility for further corruption and should be taken at your own risk.
[HR][/HR]
This error is commonly seen on systems that are not registered or licensed with the RHN (RedHat Network) or CLN (CloudLinux Network). To resolve this issue you will typically need to register the system with either network and then re-run the command. You can find instructions on how to register with the RHN here: http://www.cloudlinux.com/docs/CLN_licenses.php]CloudLinux OS
The most common yum-cPanel related files are: /etc/checkyumdisable - Disables checkyum from running /var/cpanel/checkyum-keepkernel - Touching this file will preserve the kernel related exclusions.
The cPanel technical support team can help resolve a myriad of yum-related issues, however, to note specific instances where the scope of our support ends, we are usually hands-off with issues such as: [LIST]
yum --disablerepo=* --enablerepo=base update
so that only the base and update repos are enabled. Common Issues
Error: Cannot find a valid baseurl for repo: base
This is a very common issue we see in tickets and the solution to resolving it is rather simple. This usually indicates that the repository you are using for "base" in /etc/yum.repos.d/CentOS-Base.repo is invalid or perhaps even commented out. To fix this, simply modify the file:
vi /etc/yum.repos.d/CentOS-Base.repo
then search for the following section:
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
You will see in this example both the mirrorlist and baseurl are commented out, simply removing the "#" on baseurl will resolve the above issue. If you happen to have an incorrect mirror or baseurl, you can find some defaults on
uname -r
2.6.32-431.11.2.el6.x86_64
you can see here that we"re on x86_64 so we would want to remove the i686 package with:
yum remove sqlite-3.8.2-1.i686
You should then be able to proceed with your original yum transaction. [HR][/HR]
yum update
Loaded plugins: downloadonly, fastestmirror
Loading mirror speeds from cached hostfile
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 309, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 178, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 345, in doCommands
self._getTs(needTsRemove)
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 101, in _getTs
self._getTsInfo(remove_only)
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 112, in _getTsIn fo
pkgSack = self.pkgSack
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 661, in
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 501, in _getSack s
self.repos.populateSack(which=repos)
File "/usr/lib/python2.4/site-packages/yum/repos.py", line 232, in populateSac k
self.doSetup()
File "/usr/lib/python2.4/site-packages/yum/repos.py", line 79, in doSetup
self.ayum.plugins.run('postreposetup')
File "/usr/lib/python2.4/site-packages/yum/plugins.py", line 179, in run
func(conduitcls(self, self.base, conf, **kwargs))
File "/usr/lib/yum-plugins/fastestmirror.py", line 181, in postreposetup_hook
all_urls = FastestMirror(all_urls).get_mirrorlist()
File "/usr/lib/yum-plugins/fastestmirror.py", line 333, in get_mirrorlist
self._poll_mirrors()
File "/usr/lib/yum-plugins/fastestmirror.py", line 376, in _poll_mirrors
pollThread.start()
File "/usr/lib64/python2.4/threading.py", line 416, in start
_start_new_thread(self.__bootstrap, ())
thread.error: can't start new thread
This error is typically associated with possible RPM database corruption which can be resolved with a few commands. Please keep in mind that while this normally resolves the issue, there is always the possibility for further corruption and should be taken at your own risk.
yum clean all
mkdir /var/lib/rpm/backup
mv /var/lib/rpm/__db* /var/lib/rpm/backup
rpm -vv --rebuilddb
yum update
[HR][/HR]
# yum install screen
Loaded plugins: fastestmirror, rhnplugin
Profilename: test.test
IP:12.12.12.12 Not licensed
This system is not registered with CLN.
CLN support will be disabled.
Loading mirror speeds from cached hostfile
cl-mariadb-5.5 | 951 B 00:00
Setting up Install Process
No package screen available.
Error: Nothing to do
This error is commonly seen on systems that are not registered or licensed with the RHN (RedHat Network) or CLN (CloudLinux Network). To resolve this issue you will typically need to register the system with either network and then re-run the command. You can find instructions on how to register with the RHN here: http://www.cloudlinux.com/docs/CLN_licenses.php]CloudLinux OS
Please sign in to leave a comment.
Comments
0 comments