How to improve the speed of Linux installation software? Configure DNF/YUM domestic download source for CentOS8

CentOS Linux has always had a discordant question: How do Python2 and Python3 coexist?

Before CentOS Linux 8, the default Python version of the system was 2.x. Installing a 3.x still has no status as a step-mother. A little carelessness is either not easy to use here or there. The most exaggerated is to manually upgrade Python2.6 to 2.7, YUM directly hangs.

If you want to configure to run the command "python" to directly execute the 3.x version, there are a bunch of files that need to be changed. The unfortunate news is that YUM is written in Python 2.x, while DNF is written in Python 3.x. In this case, CentOS Linux 8 changes the default Python version to 3.x, and the corresponding package manager is changed from YUM to DNF. So the default RPM package management tool of CentOS Linux 8 has changed from YUM to DNF. Fortunately, all the installation package configuration files have not been changed, and they are not much different from the YUM era at that time, so switching to DNF will not be too uncomfortable.

Why do you want to say this, because DNF is used when installing the software (YUM command also exists, but it is just a link to DNF, Tristone Note). The following changes can be understood as changing the DNF configuration file from downloading foreign software by default to downloading software on domestic servers by default.

What is DNF? Why replace YUM?

DNF is the next generation package management tool on Linux, and it replaces YUM. DNF uses libsolv created and maintained by SUSE for dependency resolution, while YUM, which uses public APIs to resolve dependencies, is relatively more difficult to maintain. The YUM code has 56K lines but no relevant documentation, while the DNF code has only 29K lines and API documentation, so it is easy to build new features. Although DNF has a small amount of code, DNF supports more extensions, while YUM only supports Python extensions.

In general, DNF is written in Python3, which reduces memory usage, improves running speed, strengthens dependency analysis capabilities, and improves user experience. So replacing YUM is an inevitable result.

DNF source configuration file changed to domestic address#

Because the package management configuration file installed by the system is linked to a foreign server, we will download related files from a foreign server when we install software, upgrade the kernel and upgrade the software. Due to well-known reasons, the Internet speed of foreign servers is really not flattering, so we have to replace them with domestic servers, so that the speed of installing and upgrading software will be increased, reducing the time spent by maintenance personnel on waiting.

Because the Ali source files already contain the relevant content of AppStream, Base, centosplus, Extras and PowerTools, these files need to be renamed bak to prevent the system from executing.

cd /etc/yum.repos.d/
mv /etc/yum.repos.d/CentOS-AppStream.repo /etc/yum.repos.d/CentOS-AppStream.repo.bak
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
mv /etc/yum.repos.d/CentOS-centosplus.repo /etc/yum.repos.d/CentOS-centosplus.repo.bak
mv /etc/yum.repos.d/CentOS-Extras.repo /etc/yum.repos.d/CentOS-Extras.repo.bak
mv /etc/yum.repos.d/CentOS-PowerTools.repo /etc/yum.repos.d/CentOS-PowerTools.repo.bak

After making the above modifications, you can download the new domestic source files, and Ali's is recommended.

Because wget is not installed by default, we can use curl to execute the following commands:

curl -o CentOS-Base.repo http://Ali mirror URL/repo/Centos-8.repo

If you have wget, you can also execute the following command

wget -O CentOS-Base.repo http://Ali mirror URL/repo/Centos-8.repo

If wget is not installed, running this command will prompt "bash: wget: command not found", then use the curl command to execute it. Or you can install wget first. It's very simple, just the following command (provided that before changing the above file to ".bak", if it has been changed, change it back and execute the following command)

dnf -y install wget

Check if the installation is complete, execute the command

ls -l /etc/yum.repos.d/

You will see the following

Then execute the following command to check the content and confirm whether the change is successful

cat /etc/yum.repos.d/CentOS-Base.repo

If you see the following content, it means the upgrade was successful.

This completes the replacement of the local CentOS Linux 8 dnf installation source with a domestic source.

Run the following command to generate the following cache

dnf makecache

Execute the following command to upgrade all the packages to try to see how fast:

dnf -y update

If you are used to yum, you can also use this command "yum -y update". If you install CentOS Linux 8 over the network, there should be no software packages to be upgraded in the system. The prompt content is as follows:

Test the download speed of domestic servers#

By default, CentOS Linux 8 does not have unzip software installed in the minimal installation. Let's install one and try the speed.

First search for whether the system contains the unzip installation package:

dnf search unzip

Run the following command to install unzip:

dnf -y install unzip

The installation is almost completed in 1s, and the speed is fast.

Come here, what to go, leave a message~

** IT masters say | About copyright**

**For articles originally created by "IT Big Coffee (ID: itdakashuo)", please indicate the author, source and WeChat public account when reprinting. Please add WeChat for submission, submission, and reprint: ITDKS10 (Note: submission), Miss Jasmine will contact you in time! **

**Thank you for your enthusiastic support to the IT experts! **

Recommended Posts

How to improve the speed of Linux installation software? Configure DNF/YUM domestic download source for CentOS8
The software environment required for Centos7 installation
[Video] Teach you how to install the latest Linux version of QQ under Centos 8
How to configure NTP to join the NTP pool project in CentOS
How to verify successful installation of python
Modify the software default source to Tencent source
How does python improve the calculation speed
How to modify software source in Ubuntu 7.10
How to modify the hostname on CentOS 8