Upgrading packages is essential to keep your system up-to-date and avail all the new features of the software packages. When you upgrade a package, it ensures your software security, fixes bugs, and makes it more healthy and stable. Therefore, if you want to have a smooth performance of your software packages, upgrade the obsolete packages regularly to the newest versions by using different package managers like apt, apt-get, dnf, yum, rpm, etc. In this article, I will walk you through the 8 easy methods to upgrade a package in Linux (Debian-based and Red-hat-based distributions). Let’s dive into the main procedure.
8 Easy Methods to Upgrade a Package in Linux
There are various package management tools that manage packages as install, remove, upgrade, and so on. If you are a Debian-based distro user, you can use apt, apt-get to upgrade packages. Moreover, yum, dnf, and rpm are the popular package managers to upgrade packages in Red-hat-based Linux. GUI can also be used to upgrade packages. So to know the detailed steps of each method, stick to this article.
1. Upgrade a Package Using “apt”
When you upgrade a package with apt, it will automatically download the newest version of the package and install it to replace the older version. Hence, you don’t need to manually download the new version and install it again by removing the old one. You can easily do that just by following some steps mentioned below:
- Open the Ubuntu terminal.
- Update the packages before upgrading any package by running this command:
sudo apt update
EXPLANATIONAfter writing the Ubuntu password, the installed packages will be updated automatically.
- You can now check all the upgradable packages in your Linux system by writing the following code:
apt list --upgradable
EXPLANATION- list: Lists all the upgradable packages.
- – -upgradable: Displays the upgradable packages.
Now you can upgrade your desired package to the latest version. Here, I will upgrade the Google Chrome package.
- Write the command to upgrade the Google Chrome package to the latest version using apt:
sudo apt upgrade google-chrome-stable
EXPLANATION- list: Lists all the upgradable packages.
- upgrade: Upgrades packages to the latest versions.
- google-chrome-stable: Package name.
The upgrading of the Google Chrome package has started.Type ‘y’ in the place to continue the process. After typing the ‘y’, the Google Chrome package has been upgraded to its newer version. Additionally, you can also run an apt full upgrade to upgrade any packages by completely removing the old version.
2. Upgrade a Package Using “apt-get” in Linux
apt-get is a straightforward package manager that can be used to upgrade packages in Debian-based Linux distros such as Ubuntu, Kali Linux, and Linux Mint. Here, I am using the Ubuntu distro to show you the full process of upgrading a package with apt-get.
And, there is a significant difference between apt-get update and apt-get upgrade. To know the differences click apt-get update vs upgrade article. Moreover, to get the full view of upgrading a package check sudo apt-get upgrade.
3. Upgrade a Package Using “Yum”
Yum refers to the Yellowdog Updater Modified, a front-end package manager used in Red-hat-based Linux distros like CestOS, RHEL, and Fedora, etc. to manage packages. The ‘yum update’ command can be used to update the installed packages before upgrading the package. The update command basically downloads the package but doesn’t install it. However, the upgrade command with yum is able to install the newest version of any package. In yum update vs upgrade article, I have explained the step-by-step process of upgrading a package with yum.
4. Upgrade a Package Using “dnf”
You can upgrade a package with dnf easily which is dandified yum containing additional features. It is more up-to-date than yum. Overall, this high-level manager is better than yum. Updating can also be achieved with the dnf. The overview of this method is explained in the article called dnf update vs upgrade. By reading this article you will also know about the difference between update and upgrade.
5. Upgrade a Package Using “RPM” in Linux
It stands for Red-hat Package Manager which has the potential to upgrade a package. Primarily, red-hat-based distros use it to operate packages. However, it is as powerful as In order to do that, check the steps below:
- Open the Red-hat terminal.
- Write this command to upgrade Google Chrome with rpm:
sudo rpm -Uvh 'google-chrome-stable_current_x86_64(1).rpm'
EXPLANATION- rpm: A Red-hat package manager to manage packages in Red-hat-based Linux.
- U: Command option to upgrade packages to the newer versions.
- v: Command option to show verbose output.
- h: Command option to show the hash marks representing the action of the progress of the RPM upgrade.
- ‘google-chrome-stable_current_x86_64(1).rpm’: Google Chrome rpm package.
In this picture, you can see the Google Chrome package is upgrading from version google-chrome-stable-104.0.5112.7 to version google-chrome-stable-116.0.5845.1 by removing the old version.
6. Upgrade a Package Using Ubuntu Software Center
Upgrading an old package version to a newer one can be done with a graphical user interface-based method. Some people find it difficult to understand the command line. No worries, follow the exact procedure stated below to get your task done:
- Open the ‘Ubuntu Software Center’.
- Go to the ‘Updates’ tab to see all the upgradable packages.
- Then click the ‘Update’ button to upgrade your desired software. Here, I am updating ‘Firefox’.After clicking the update button, an authentication will come up like the following picture.
- Now, to authenticate, type your Ubuntu password and click the ‘Authenticate’ option.
After that, the upgraded version of Firefox will be installed in your Linux distro.
7. Upgrade a Package Using Software Updater
Software Updater automatically finds the updated version of any package and then upgrades the old package to a new version. It is a very simple and straightforward method. Therefore, to use this method, follow the steps provided below:
- Open the Ubuntu distro and Go to the ‘Activities’ menu.
- Search the ‘Software Updater’.After finding the ‘Software Updater’, click it.It will automatically check the updates and upgrade the old version software to a new one.
8. Upgrade a Package Manually in Linux
To update a package manually, you have to do a lot of tasks. First of all, you need to remove the old version software package and then download the latest version of that package. Then install it to avail all the modern features. To accomplish this task successfully, follow the steps:
- Open the Ubuntu terminal.
- Uninstall the old version package by writing the following code:
sudo apt remove google-chrome-stable
EXPLANATION- remove: Removes packages in Linux.
As soon as you write ‘y’, the old version Google Chrome package which is google-chrome-stable (75.0.3770.80-1) will be removed from your Linux system.
- Now, download the newer version of Google Chrome Package by writing the following code:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
EXPLANATION- wget: Command used to download software, documents, and websites from the internet.
- https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm: Google Chrome version 116.0.5845.179-2 download link.
Now you have the .rpm file of the Google Chrome package.
- Convert the .rpm file to a .deb file using this command:
sudo alien -d google-chrome-stable_current_x86_64.rpm
EXPLANATION- alien: Converts packages from one form to another in Linux.
- -d: Converts any file format to a .deb file format.
- google-chrome-stable_current_x86_64.rpm: rpm package of Google Chrome.
- After generating the .deb format, install it with the next command:
sudo dpkg -i google-chrome-stable_116.0.5845.179-2_amd64.deb
EXPLANATION- dpkg: Manages packages in Debian-based Linux distro.
- -i: Command option used to install packages.
- google-chrome-stable_116.0.5845.179-2_amd64.deb: .deb file of the google chrome chrome package.
Finally, you have the latest version of Google Chrome software.
Comparative Analysis of Methods to Upgrade a Package in Linux
I have explored 8 practical methods here to upgrade packages in Linux. However, you don’t need all of them, choose one according to your preferences. Go through this table to pick your best possible method.
Methods | Pros | Cons |
---|---|---|
Method 1 |
|
|
Method 2 |
|
|
Method 3 |
|
|
Method 4 |
|
|
Method 5 |
|
|
Method 6 |
|
|
Method 7 |
|
|
Method 8 |
|
|
I believe this table guides you in finding your best pick. If you are a Debian-based distro user go for method 1 or if you use Red-hat-based Linux, go for method 4. Moreover, if you feel comfortable using a GUI-based approach, pick method 6. Lastly, choose method 8 to upgrade the package manually in Linux.
No Such File or Directory Error While Upgrading a Package With “rpm”
Before upgrading any package with rpm, you have to write the rpm file name, not only the package name. If you write the package name only. It will show an error like the following image.You can notice the error in this image. To overcome this error write the exact name of the rpm file of the Google Chrome package which is google-chrome-stable_current_x86_64(1).rpm.Now it shows no error. Moreover, write the package name inside a single quote ‘rpm package’ to avoid further errors.
Conclusion
I hope this article helps you find 8 different ways to upgrade the old version packages to their modern versions. It is always great to use an updated version software package as it shows better performance and potential than the old one. Moreover, updated version packages have some extra benefits. So to use the best of one software package, upgrading the package is crucial. Here, I have explained several strategies to do this. Check the steps and perform them properly. Good Luck!
People Also Ask
How to upgrade a package in Linux?
To upgrade a package in Linux using apt, first run sudo apt update
to get the recent information about the packages. Then write sudo apt upgrade <package_name>
to upgrade the specific package to its latest version.
How to upgrade all packages in Debian?
To upgrade all packages in Debian based Linux, first update the package list using the sudo apt update
command. Then run sudo apt upgrade
to upgrade all packages to their latest versions available in the repositories.
How to upgrade a single package using yum?
To upgrade a single package using the yum
package manager, use the sudo yum upgrade <package_name>
command.
What is the command to install a package in Linux?
To install a package in a Linux Debian-based distro, run the command sudo apt install <package_name>
. Use the command sudo yum install <package_name>
to install packages in Red-hat-based Linux.
How to find command package in Linux?
The dedicated terminal commands apt-search
and apt show
assist in finding and displaying the details of the available packages in Linux.
How do I uninstall apt install?
Write this command to uninstall a package with apt: sudo apt remove <package name>
.
<< Go Back to Package Management in Linux | Learn Linux Basics
FUNDAMENTALS A Complete Guide for Beginners