Solve Ubuntu error E: Unable to locate package yum [yum is the installation command of Centos, it is not recommended to install in Ubuntu, use apt-get in Ubuntu]

For mirror download, domain name resolution, and time synchronization, please click Alibaba Cloud Open Source Mirror Site

Straight to the point, Ubuntu’s package management tool is apt-get, so there is no need to install yum. If you want to install other packages, you need to use the apt-get command.

# Here take the locate command as an example
sudo apt-get install mlocate

The following is the whole process of problem solving.

1. Error E: Unable to locate package yum

? I need to use the locate command when learning Linux commands, but the locate command is not installed in the Ubuntu system. According to the instructions of the barrage, I used the following command.

# yum install locate
sudo yum install mlocate
sudo updatedb
locate -h

? Then there will always be an error message that yum does not exist. I wonder why this broken server needs anything. Looking at it now, it is really a bit silly. Since there is no yum, just install it. So the problem in the question appeared, which is really a show operation.

Figure 1. yum install locate failed

Figure 2. Sao operation of installing yum with apt-get

2. Modify sources.list

Adhering to the mentality of seeking knowledge, I searched for relevant error messages, and the answer I got was update and various update upgrades.

# Including but not limited to the following update methods
sudo apt-get update
sudo apt-get upgrade
sudo apt update

? It really bothers me that the most useful method is useless. What is the problem? After I skimmed through countless articles of the same, found the solution.

# Modify the configuration file of apt-get source
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak #backup
sudo vim /etc/apt/sources.list #Modify
sudo apt-get update #update list

Here are some available images

Alibaba Cloud Source

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse

Here is some operation help for vim

Shift + I to edit the document
Esc to exit editing
:q! close document
:wq! Save document and close

Figure 3. The modified sources.list

After the modification is completed, execute apt-get install yum again, and report an error about the lack of dependent libraries again. This problem is much easier to handle, just install it directly.

Figure 4. Installation final problem – missing dependent libraries

# Installation of dependent libraries
sudo apt-get install python-sqlitecachec
sudo apt-get install python-urlgrabber
sudo apt-get install python-libxml2
sudo apt-get install python-rpm
sudo apt-get install python-sqlite
sudo apt-get install python-urlgrabber

There should be only so many needed, and then install the others.

Figure 5. This is the final yum installation successful display

Finally installed yum to verify whether it is available.

yum

Figure 6. yum available

3. Realize that the problem is not that complicated

Finally got yum done, I thought it could stop now.

Figure 7. Errors related to repos, it should be very troublesome to solve

I made a mistake again. I don’t understand it very well if I haven’t used yum, but it should be a very troublesome problem, so I have to go around again. Later, I discovered a little common sense of Linux.

Linux systems are basically divided into two categories:

1 RedHat series: Redhat, Centos, Fedora, etc.

2 Debian series: Debian, Ubuntu, etc.

RedHat Series:

1 The common installation package format is rpm package, the command to install rpm package is “rpm -parameter”

2 package management tool yum

3 Support tar package

Debian series:

1 The common installation package format is deb package, the command to install deb package is “dpkg -parameter”

2 package management tool apt-get

3 Support tar package

So the final solution to the problem is to install mlocate with apt-get.

# apt-get install mlocate
sudo apt-get install mlocate

Figure 8. Final success

Is it over here?

# Uninstall yum
sudo apt-get remove yum

Figure 9. Cruel abandonment

Summary: Ubuntu using apt-get is enough. If the installation requires yum, there is no solution to the repos error. Mistakes in the future will be solved later.

This article is transferred from: https://blog.csdn.net/SH_ke/art

Solve Ubuntu error E: Unable to locate package yum bzdww

The knowledge points of the article match the official knowledge files, and you can further learn relevant knowledge CS introductory skill tree Linux advancedAdded 31536 users and are learning the system