How to update my system on CentOS/RHEL using yum or dnf?
Jun 13, 2025 am 12:29 AMTo update the CentOS or RHEL system, you must first confirm whether you are using yum or dnf package manager. 7 version uses yum, 8 and above; 1. By entering yum --version or dnf --version, you can view the current command support status; 2. When updating the entire system, execute sudo [yum or dnf] update -y, and make sure that third-party sources such as EPEL are enabled to obtain more updates; 3. If you only want to update specific software packages, such as nginx, you can use sudo [yum/dnf] update package name to selectively upgrade; 4. Whether to restart after update depends on the specific situation. If the kernel, glibc or key services are updated, it is recommended to restart. You can check whether the kernel version matches through rpm -q kernel. Although the update is simple, it should be operated with caution according to the environment to avoid affecting production services.
Updating the CentOS or RHEL system is not complicated. The key is to know which command to use (yum or dnf) and what common issues you need to pay attention to when updating. Different versions of the system may use different package managers by default. For example, the older CentOS 7 and RHEL 7 use yum
by default, while CentOS 8 and RHEL 8 use dnf
by default.
Here are some practical perspectives to explain how to operate:
1. Check whether the current system is using yum or dnf
Not all versions are common, first figure out which command you are using:
- If you are using CentOS/RHEL 7 : Basically it is
yum
- If you are using CentOS 8 / RHEL 8 : the default is
dnf
You can directly enter:
yum --version
or
dnf --version
If the command is not found, it means that the system does not have that tool installed. Generally speaking, there are no two at the same time, but if you are in a container or under a minimum installation environment, you may need to install it manually.
2. Steps to update the entire system
Whether using yum
or dnf
, the process of updating the entire system is basically the same:
sudo [yum or dnf] update -y
Note: Some systems may not enable EPEL sources or other third-party sources by default. At this time, you will find that some software packages cannot be updated. Consider enabling these sources before performing updates.
For example, if you want to update some extra packages on RHEL, you may need to enable EPEL first:
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
Then run dnf update
and you will find more updateable content.
3. Methods to update only specific packages
Sometimes you don't want to update it in full, just want to upgrade a certain software package, such as nginx
or openssh
, you can use:
sudo [yum/dnf] update package name
for example:
sudo dnf update nginx
This method is suitable for situations where you only want to update a certain service in production environment, and avoid compatibility issues caused by other package updates.
4. Should I restart after the update?
This problem is easy for many people to ignore. Not every update requires a restart, but the following situations are recommended to restart the system:
- The kernel has been updated (kernel)
- Some core libraries are replaced (such as glibc)
- Security patches involve running services
You can check whether these contents are included by checking the update log, or use the following command to see if the kernel has been updated recently:
rpm -q kernel
If you find that the current kernel version is different from the latest installation, it is time to restart.
Basically that's it. Although it is simple to update the system, you should also pay attention to the environment version, package source and whether it needs to be restarted. Don't update it in full at the beginning, especially on production servers.
The above is the detailed content of How to update my system on CentOS/RHEL using yum or dnf?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Currently, Microsoft has pushed the preview version of the win11 system to users. Many users want to download and use it, but they don’t know how long it will take. They are afraid that it will take too long to update and they will not be able to work and study normally. Let’s follow the editor’s instructions. Let’s take a look at the introduction of the time required to upgrade win10 to win11 system. How long does it take to upgrade Win10 to Win11? Answer: About 10 minutes. The specific situation depends on the computer configuration. 1. If we include all steps such as version selection, installation settings, etc., it will take 10-15 minutes. 2. Because before installing win11, we need to select multiple settings such as system version, installation disk, regional language, network, keyboard, etc. 3. After the setting is completed, the system will enter the automatic installation process. At this time, you only need to wait.

Generally speaking, there will be no problems after the win10 system is updated! But among so many win10 system users, there are always some exceptions! Recently, many friends have reported that their win10 system computers have a black screen problem after updating! Today, the editor will bring you the solution to the problem of black screen and unresponsiveness after win10 update. Let’s take a look at it together. Solution to the black screen after win10 system update: Operation steps: 1. Restart the computer and enter the BIOS; Enter the BIOS method: After restarting the computer, continuously press the "Del" key in the lower right corner of the keyboard to enter. Generally, the "F2" key is used in notebooks. (If the F2 key cannot be entered, you can consult the manufacturer on how to enter the BIOS). After entering the BIOS, normally

It is recommended to update the ios14.6.1 system because: iOS 14.6.1 is Apple’s latest operating system version, which fixes some known vulnerabilities and problems and improves the stability and security of the system.

According to news on February 24, Samsung recently began to push the first system update to the Galaxy S24 series mobile phones of the National Bank. This update is the latest version in the world and has more camera optimizations than the XB5 version pushed in South Korea. It is recommended that users of the Samsung Galaxy S24 series in China upgrade this version, because this update solves some important problems with the new machine. According to the official update content, the updated version number is S9210ZCU1AXBA/S9210CHC1AXBA/S9210ZCU1AXBA, the file size is about 587MB, and the security patch level is October 1, 2023. Updates include: adding a screen brightness control option through which users can adjust the brightness of the screen; the camera has been optimized

Win11 sometimes keeps popping up the system update interface, which makes us feel very irritated, and every update takes up memory. So how should we permanently turn off system updates? Let’s take a look. Win11 permanently shuts down system updates: 1. We can hold down "win+r" to open the run interface, and then enter "regedit" to open the registration edit form. 2. Then open HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows according to the following path. 3. Then right-click the windows folder, then open "New", "Item" and name it "windowsupdate"

When our computer was upgraded and installed with the win10 operating system, some friends had a prompt on their computer that the current network card did not support the win10 system when they were surfing the Internet. For this kind of problem, the editor thinks that it is probably because there is a problem with the network card driver of our computer. You can try to update or reinstall the driver. It can also be operated using third-party software. Let’s take a look at the specific steps to see how the editor did it~ How to solve the problem that the network card does not support the win10 system 1. Right-click the computer and select “Properties”. 2. Select "Device Manager". 3. Click "Network Adapter". First uninstall the network card driver whose original model is incorrect or does not display the model. After the uninstallation is complete, rescan to detect hardware changes. After completion, there will be a network in the unrecognized devices.

What should I do if there is a system update error in Win11? Microsoft has been pushing patches for the win11 system, so what should you do if you encounter an error in the update system? Below, the editor will bring you a method to solve the problem of win11 system update. If you are curious about how to operate, please continue reading! Methods to solve win11 system update errors: 1. Uninstall the latest update Press the Windows + key, then select Windows Update from the left navigation bar, and then select Update History. Scroll down until you come across the Uninstall Updates button and click on it. Click on the first update in the MicrosoftWindows list and click Uninstall. 2. Use third-party tools Restor

Many friends may encounter various errors when updating the win10 system on their computers. Today I will tell you about the solution to the win10 system update error 0x800f081f. Let’s take a look. 1. Right-click "This PC" and select "Manage". 2. After entering Computer Management, click "Services and Applications" on the left side and click "Services". 3. Find windowsUpdate, click it, and select "Properties". 4. After entering the properties interface, select Manual in the startup type. Click OK to exit settings. 5. Right-click: windowsUpdate and select: Start. The above is the detailed solution to the win10 system update error. You can follow the above
