- Check Debian/Ubuntu Linux package version using apt-get/aptitude command
- Method #1: Ubuntu Linux package version apt-cache command
- Method #2: Debian Linux package version using apt command
- Method #3: Check package version using aptitude command
- Method #4: Package simulation using aptitude or apt-get command
- A note about finding version of installed packages
- Ubuntu upgrade or update a single package using apt-get
- How to Ubuntu upgrade or update a single package
- How to upgrade a single package using apt-get?
- Examples
- Conclusion
- Команда apt в Linux
- Обновление индекса пакета ( apt update )
- Обновление пакетов ( apt upgrade )
- Полное обновление ( apt full-upgrade )
- Установка пакетов ( apt install )
- Удаление пакетов ( apt remove )
- Удалить неиспользуемые пакеты ( apt autoremove )
- Листинг пакетов ( apt list )
- Поиск пакетов ( apt search )
- Информация о пакете ( apt show )
- Выводы
- Debian upgrade or update a single package using apt-get
- How to Debian upgrade or update a single package
- How to upgrade a single package using apt-get?
- Conclusion
- Linux Update All Packages Command Using the CLI
- Linux Commands To Update All Packages
- update vs upgrade in Linux
- apt-get command example to update all packages on the Debian or Ubuntu Linux
- yum command example to update all packages on the RHEL/CentOS/Red Hat/Fedora Linux
- zypper command example to update all packages on the OpenSUSE/Suse Linux
- pacman command example to update all packages on the Arch Linux
- emerge command example to update all packages on the Gentoo Linux
- apk command for Alpine Linux
- Conclusion
Check Debian/Ubuntu Linux package version using apt-get/aptitude command
Method #1: Ubuntu Linux package version apt-cache command
The syntax is:
apt-cache policy
apt-cache madison
$ apt-cache policy nginx
OR
$ apt-cache madison nginx
Fig.01: apt-cache check package version on Debian/Ubuntu Linux
Method #2: Debian Linux package version using apt command
The syntax is
apt list
Sample outputs:
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
I have vim package # 7.4.963 version installed on my system.
Method #3: Check package version using aptitude command
The syntax is:
aptitude versions
aptitude versions
To find htop version you are about to install on Ubuntu server, enter:
$ aptitude versions htop
Sample outputs:
Method #4: Package simulation using aptitude or apt-get command
The syntax is as follows:
aptitude -V -s install
A note about finding version of installed packages
Use the following syntax:
apt-show-versions
dpkg -s
To see version of install package called vim, run:
$ apt-show-versions vim
vim:amd64/xenial 2:7.4.963-1ubuntu5 uptodate
vim:i386 not installed
OR
$ dpkg -s vim | grep -i version
Version: 2:7.4.963-1ubuntu5
Vim is an almost compatible version of the UNIX editor Vi.
This package contains a version of vim compiled with a rather
version of Vim. See the other vim-* packages if you need more
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
Ubuntu upgrade or update a single package using apt-get
How to Ubuntu upgrade or update a single package
The procedure to update a a specific package on Ubuntu:
- Open the Terminal application
- Fetch package index by running sudo apt update command
- Now only update apache2 package by running sudo apt install apache2 command.
- If apache2 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 apache2
Let us see all commands and examples in details.
How to upgrade a single package using apt-get?
As usual you need to fetch an updated index from the Internet:
$ sudo apt-get update
You need to use following format with the apt-get command/apt command:
$ sudo apt-get —only-upgrade install Package
$ sudo apt-get install Package
Let us try to upgrade nginx web server:
$ sudo apt-get install nginx
If nginx package is already installed it will try to update to latest version:
However, the following will not install a new nginx package if not installed:
$ sudo apt-get —only-upgrade install nginx
In this following example, htop is installed and I am requesting update. However, atop not installed and I am still requesting an update for it:
$ sudo apt-get install htop
$ sudo apt-get —only-upgrade install atop
Examples
First, download package information from all configured source:
$ sudo apt-get update
Run the to see availble updates:
$ sudo apt list —upgradable
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
We have 9 updates available but we are just going to update ppp package:
$ sudo apt-get —only-upgrade install ppp
## OR ##
$ sudo apt —only-upgrade install ppp
Conclusion
You learned how to update a specific package on Ubuntu Linux. 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/apt-get man page online here for more information or type the following man command:
$ man apt
$ man apt-get
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
Команда apt в Linux
apt — это утилита командной строки для установки, обновления, удаления и иного управления пакетами deb в Ubuntu, Debian и связанных дистрибутивах Linux. Он сочетает в себе наиболее часто используемые команды из инструментов apt-get и apt-cache с различными значениями по умолчанию некоторых параметров.
apt разработан для интерактивного использования. Предпочитайте использовать apt-get и apt-cache в своих сценариях оболочки, поскольку они обратно совместимы между различными версиями и имеют больше параметров и функций.
Большинство команд apt необходимо запускать от имени пользователя с привилегиями sudo .
Это руководство служит кратким справочником по командам apt .
Обновление индекса пакета ( apt update )
Индекс пакетов APT — это в основном база данных, в которой хранятся записи о доступных пакетах из репозиториев, включенных в вашей системе.
Чтобы обновить индекс пакета, выполните команду ниже. Это приведет к получению последних изменений из репозиториев APT:
Всегда обновляйте индекс пакета перед обновлением или установкой новых пакетов.
Обновление пакетов ( apt upgrade )
Регулярное обновление вашей системы Linux — один из наиболее важных аспектов общей безопасности системы.
Чтобы обновить установленные пакеты до последних версий, выполните:
Команда не обновляет пакеты, требующие удаления установленных пакетов.
Если вы хотите обновить один пакет, передайте имя пакета:
Полное обновление ( apt full-upgrade )
Разница между upgrade и full-upgrade заключается в том, что при последующем удаляются установленные пакеты, если это необходимо для обновления всей системы.
Будьте особенно осторожны при использовании этой команды.
Установка пакетов ( apt install )
Установить пакеты так же просто, как запустить следующую команду:
Если вы хотите установить несколько пакетов с помощью одной команды, укажите их в виде списка, разделенного пробелами:
Для установки локальных файлов deb укажите полный путь к файлу. В противном случае команда попытается получить и установить пакет из репозиториев APT.
Удаление пакетов ( apt remove )
Вы также можете указать несколько пакетов, разделенных пробелами:
Команда remove удалит указанные пакеты, но при этом могут остаться некоторые файлы конфигурации. Если вы хотите удалить пакет, включая все файлы конфигурации, используйте purge вместо remove :
Удалить неиспользуемые пакеты ( apt autoremove )
Каждый раз, когда в системе устанавливается новый пакет, который зависит от других пакетов, также будут установлены зависимости пакетов. Когда пакет будет удален, зависимости останутся в системе. Эти оставшиеся пакеты больше не используются ничем и могут быть удалены.
Чтобы удалить ненужные зависимости, используйте следующую команду:
Листинг пакетов ( apt list )
Команда list позволяет вывести список доступных, установленных и обновляемых пакетов.
Чтобы вывести список всех доступных пакетов, используйте следующую команду:
Команда напечатает список всех пакетов, включая информацию о версиях и архитектуре пакета. Чтобы узнать, установлен ли конкретный пакет, вы можете отфильтровать вывод с помощью команды grep .
Чтобы вывести список только установленных пакетов, введите:
Перед фактическим обновлением пакетов может быть полезно получить список обновляемых пакетов:
Поиск пакетов ( apt search )
Эта команда позволяет вам искать данный пакет в списке доступных пакетов:
В случае обнаружения команда вернет пакеты, имя которых соответствует поисковому запросу.
Информация о пакете ( apt show )
Информация о зависимостях пакетов, размере установки, источнике пакета и т. Д. Может быть полезна перед удалением или установкой нового пакета.
Чтобы получить информацию о данном пакете, используйте команду show :
Выводы
Умение управлять пакетами — важная часть системного администрирования Linux.
apt — это менеджер пакетов для дистрибутивов на основе Debian. Чтобы узнать больше о команде apt откройте терминал и введите man apt .
Не стесняйтесь оставлять комментарии, если у вас есть вопросы.
Источник
Debian upgrade or update a single package using apt-get
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:
$ sudo apt-get update
Sample outputs:
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
You need to use following format with the apt-get command:
$ 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:
However, the following will not install a new nginx package if not installed:
$ 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.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
Linux Update All Packages Command Using the CLI
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | None |
Est. reading time | 1m |
Linux Commands To Update All Packages
- Debian / Ubuntu / Mint Linux and friends try the apt-get command/apt command.
- CentOS / RHEL / Red Hat / Fedora Linux and friends try yum command.
- Suse / OpenSUSE Linux use the zypper command. We can also use graphical tool called YaST online update.
- Slackware Linux user try the slackpkg command.
- Arch Linux user try the pacman command.
- Gentoo Linux user try emerge command.
- Alpine Linux user must use apk command.
update vs upgrade in Linux
We use the update option to download package information from all configured sources such as the Internet. The upgrade option will install available upgrades of all packages currently installed on the system from the sources such as the Internet. New packages will be installed if required to satisfy dependencies, but existing packages will never be removed. If an upgrade for a package requires removing an installed package, the upgrade for this package isn’t performed. Hence, this is a safer option in all cases.
apt-get command example to update all packages on the Debian or Ubuntu Linux
Run:
$ sudo apt-get update
$ sudo apt-get upgrade
See apt-get command or apt command tutorial for more information.
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
yum command example to update all packages on the RHEL/CentOS/Red Hat/Fedora Linux
Execute the following command:
# yum update
See my yum command tutorial for more information.
zypper command example to update all packages on the OpenSUSE/Suse Linux
# zypper refresh
# zypper update
See our zypper command tutorial for more information.
See zypper Opensuse command tutorial or Novell SUSE Linux tutorial to update all package for more info.
pacman command example to update all packages on the Arch Linux
Arch Linux follows rolling distro model. Packages are updated frequently:
# pacman -Syu
OR
# pacman —sync —refresh —sysupgrade
See pacman package manager documentation for more information.
emerge command example to update all packages on the Gentoo Linux
We can use the emerge command as follows:
# emerge —sync
# emerge —update —deep —with-bdeps=y @world
See emerge package manager documentation for more information.
apk command for Alpine Linux
Update the terminal and then run the following apk command:
# apk update
# apk upgrade
Conclusion
You learned how to update all packages installed on various Linux distros using the CLI (command-line) options. This is useful for various reasons:
- Fixing security bugs
- Applying Linux kernel patches
- Getting an updated version of app
- Increasing performance and stability of Linux desktop or server
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник