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.
Key Takeaways
- Knowing about different package managers.
- Learning about how to upgrade a package in Linux.
- Learning about upgrading packages using GUI.
Requirements
- Must be a root user to avail of sudo privileges.
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.
Method 01: Upgrading 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:
Steps to Follow >
➊ Open the Ubuntu terminal.
➋ Update the packages before upgrading any package by running this command:
sudo apt update
After 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
- 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
- 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.
Method 02: Upgrading 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.
Method 03: Upgrading 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.
Method 04: Upgrading 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.
Method 05: Upgrading 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:
Steps to Follow >
➊ 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'
- 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.
Method 06: Upgrading 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.
Steps to Follow >
➊ 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.
Method 07: Upgrading 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:
Steps to Follow >
➊ 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.
Method 08: Upgrading 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:
Steps to Follow >
➊ Open the Ubuntu terminal.
➋ Uninstall the old version package by writing the following code:
sudo apt remove google-chrome-stable
- 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
- 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
- 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
- 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
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 eight 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!