Debian upgrade or update a single package using apt-get
Iam a new Debian Linux server sysadmin. I need to upgrade or update a single package using apt-get command or apt command. How do I update a specific package in Debian Linux server hosted in the cloud data center? How do I upgrade a single package using apt-get?
Introduction: By default when you run either ‘apt-get upgrade’ or ‘apt upgrade’, Debian Linux will update all installed packages. However, in some cases, you may want to upgrade a specific package only such as Apache or Nginx on a Debian Linux. It is also possible to blacklist upgrading packages on Debian Linux. As a Debian Linux sysadmin, you have full control over package management.
Introduction: By default when you run either ‘apt-get upgrade’ or ‘apt upgrade’, Debian Linux will update all installed packages. However, in some cases, you may want to upgrade a specific package only such as Apache or Nginx on a Debian Linux. It is also possible to blacklist upgrading packages on Debian Linux. As a Debian Linux sysadmin, you have full control over package management.
Advertisements
How to Debian upgrade or update a single package
The procedure to update a a specific package on Debian:
- Open the Terminal application by visiting menus in the GUI
- Update package index by running sudo apt update command
- Now only update nginx package by running sudo apt install nginx command.
- If nginx package already installed it will try to update to the latest version. If you do not want to install new packages; when used in conjunction with install, only-upgrade will install upgrades for already installed packages only and ignore requests to install new packages. Try sudo apt --only-upgrade install nginx
Let us see all commands in details for Debian Linux 6.x/7.x/8.x/9.x server.
How to upgrade a single package using apt-get?
As usual you need to fetch an updated index from the Internet:
Sample outputs:
$ sudo apt-get update
Sample outputs:
You need to use following format with the apt-get command:
Let us try to upgrade apache2 web server:
If apache2 package is already installed it will try to update to latest version:
$ sudo apt-get --only-upgrade install Package
$ sudo apt-get install Package
Let us try to upgrade apache2 web server:
$ sudo apt-get install apache2
If apache2 package is already installed it will try to update to latest version:
Reading package lists... Done Building dependency tree Reading state information... Done apache2 is already the newest version (2.4.25-3+deb9u5). 0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
However, the following will not install a new nginx package if not installed:
In this following example, apache2 is installed and I am requesting update. However, nginx package not installed on a Debian and I am still requesting an update for it:
$ sudo apt-get --only-upgrade install apache2
In this following example, apache2 is installed and I am requesting update. However, nginx package not installed on a Debian and I am still requesting an update for it:
$ sudo apt-get install apache2
$ sudo apt-get --only-upgrade install nginx
Conclusion
You learned how to update a specific package on Debian Linux based system or server. Please note that you need to pass the --only-upgrade to the apt command when you only want that single package upgrade provided that it is installed. See apt man page here for more info.
Комментарии
Отправить комментарий