Low Orbit Flux Logo 2 F

How to Install YUM on Ubuntu

How to Install YUM on Ubuntu

If you have found yourself on this page it is probably because you want to know how to install YUM on Ubuntu. I have heard people compare using YUM on Ubuntu to hammering nails with a screwdriver handle.

Short Answer: Bad idea, don’t do it!
Long Answer: You CAN install YUM on Ubuntu even though you shouldn’t. Keep reading to learn how…..

Background

YUM is a package management utility for Red Hat based systems such as RHEL or CentOS. It is used to manage RPM packages. Ubuntu has its own package management system. The equivalent tool for Ubuntu is apt. This is what you really should be using if you want to install or manage packages on Ubuntu.

  RHEL/CentOS Ubuntu / Debian
Package Type .rpm .deb
Low Level Package Manager Tool rpm dpkg
High Level Package Manager Tool yum apt

While theoretically possible, using YUM to install RPM packages on an Ubuntu system would be a really bad idea. Using two package manager would mean that neither package manager would be aware of what the other was doing. YUM wouldn’t take into account what has already been installed on the system. This could lead to files being overwritten. Files would be placed inconsistently across the system. It would lead to chaos.

How to Install YUM on Ubuntu - The Instructions

OK, so …. this was one of the more messed up things I’ve tested out on a Linux system. There were two different packages I found that could be installed. The fact that someone created this package and placed it in the Ubuntu repo in the first place indicates that it was created and place here intentionally for a purpose.

The first package I found was yum-utils. This seems to include yum and some of the tools that go along with it which allow for the creation of a repo. This is important.

Install yum-utils using apt:


sudo apt update -y
sudo apt install -y yum-utils

Test it out. It turns out that it doesn’t come with repositories configured so you won’t be able to find any packages at all.


yum search nginx
yum list all

You can create a test repo like this:


vi /etc/yum/repos.d/myrepo.repo

The repo definition will look like this:


[myrepo]
name=My extras packages for CentOS 7.4.1708
baseurl=http://mirror.centos.org/centos/7/os/x86_64/
enabled=1

Enable it like this:


sudo yum-config-manager --enable myrepo

Test it again.


yum search nginx
yum list all

It seemed to be working after this. We were able to install a package as a test. Once installed though, every command we ran would segfault. After this we gave up and destroyed the VM that we were installing this on.

A new VM

We cloned a new VM for a new test using just the yum package.

Here we go ahead and install the yum package using apt.


sudo apt update
sudo apt install yum

We tested this out again. As expected, it didn’t work since we didn’t have a repo setup.


yum search nginx
yum list all

We decided to setup another repo. This time it would be for NGINX.


sudo vi /etc/yum/repos.d/nginx.repo

The definition would look like this.


[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/7/os/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/7/os/x86_64/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

We attempted to enable the repo but it didn’t work out since we didn’t have the actual “yum-config-manager” tool installed. This apparently come with yum-utils but not with the regular yum package.


sudo yum-config-manager --enable nginx

We tested out removing the packages as well. This seemed to work OK except that it didn’t seem to want to remove the repo config dirs which isn’t such a huge issue.


sudo apt remove --auto-remove yum
sudo apt purge --auto-remove yum

References