- How can I check the available version of a package in the repositories?
- 7 Answers 7
- Additional benefits
- Pro tip
- 📦 Как проверить версию установленного пакета в Ubuntu/Debian
- Метод 1. Использование команды apt
- Метод 2: использование apt-cache
- Linux apt версия пакета
- NAME
- DESCRIPTION
- SYNOPSIS
- OPTIONS
- EXIT CODES
- EXAMPLES
- AUTHOR
- SEE ALSO
How can I check the available version of a package in the repositories?
How can I check the version of the available package in the Ubuntu repositories without installing it?
7 Answers 7
This gives you information of all available package versions.
alaa@aa-lu:~$ apt-cache policy vlc vlc: Installed: 2.0.8-0ubuntu0.13.04.1 Candidate: 2.0.8-0ubuntu0.13.04.1 Version table: *** 2.0.8-0ubuntu0.13.04.1 0 500 http://ae.archive.ubuntu.com/ubuntu/ raring-updates/universe i386 Packages 500 http://security.ubuntu.com/ubuntu/ raring-security/universe i386 Packages 100 /var/lib/dpkg/status 2.0.6-1 0 500 http://ae.archive.ubuntu.com/ubuntu/ raring/universe i386 Packages
- From the output, you can see that there are two versions available: 2.0.8-0ubuntu0.13.04.1 and 2.0.6-1 . It also tells you which repositories they are coming from.
- Installed: tells you the version you have installed. If you don’t have the package installed, you’ll see (none) .
- Candidate: is the version that will be installed if you use apt-get install vlc . If you want to install the other version, you would do apt-get install vlc=2.0.6-1 .
Go to packages.ubuntu.com, fill in the search form and get a nice view of the package including the version.
Additional benefits
- Will also list versions of packages for other versions of Ubuntu. Eg. if you want to know about the version of the package in Raring (13.04), but your system still has Precise (12.04), then this will provide a way to find it out.
- You don’t even need Ubuntu to be installed.
Biggest downside is that it won’t list the versions of other repositories you possible have installed, such as PPAs. You will then need the apt-cache policy approach as already posted.
Pro tip
Take the shortcut — just browse to http://packages.ubuntu.com/packagename and replace packagename with the name of the package you want to query.
It also gives information about all available package versions in the repositories. This command output had the syntax like this:
packageName | Version | Repository
apt-cache’s madison command attempts to mimic the output format and a subset of the functionality of the Debian archive management tool, madison. It displays available versions of a package in a tabular format. Unlike the original madison, it can only display information for the architecture for which APT has retrieved package lists (APT::Architecture).
$ apt-cache madison chromium-browser chromium-browser | 32.0.1700.102-0ubuntu0.13.10.1~20140128.970.1 | http://mirror.sov.uk.goscomb.net/ubuntu/ saucy-updates/universe amd64 Packages chromium-browser | 32.0.1700.102-0ubuntu0.13.10.1~20140128.970.1 | http://mirror.sov.uk.goscomb.net/ubuntu/ saucy-security/universe amd64 Packages chromium-browser | 29.0.1547.65-0ubuntu2 | http://mirror.sov.uk.goscomb.net/ubuntu/ saucy/universe amd64 Packages chromium-browser | 29.0.1547.65-0ubuntu2 | http://archive.ubuntu.com/ubuntu/ saucy/universe amd64 Packages chromium-browser | 29.0.1547.65-0ubuntu2 | http://mirror.sov.uk.goscomb.net/ubuntu/ saucy/universe Sources chromium-browser | 32.0.1700.102-0ubuntu0.13.10.1~20140128.970.1 | http://mirror.sov.uk.goscomb.net/ubuntu/ saucy-updates/universe Sources chromium-browser | 32.0.1700.102-0ubuntu0.13.10.1~20140128.970.1 | http://mirror.sov.uk.goscomb.net/ubuntu/ saucy-security/universe Sources chromium-browser | 29.0.1547.65-0ubuntu2 | http://archive.ubuntu.com/ubuntu/ saucy/universe Sources chromium-browser | 29.0.1547.65-0ubuntu2 | http://archive.ubuntu.com/ubuntu/ saucy/universe Sources
📦 Как проверить версию установленного пакета в Ubuntu/Debian
Как узнать версии пакетов, доступные в операционной системе Ubuntu/Debian Linux ?
В Linux все приложения распространяются в виде пакетов, которые представляют собой не что иное, как файлы, связанные с системой управления пакетами.
Это руководство покажет вам несколько команд, которые можно использовать для проверки версии пакета на машине Ubuntu/Debian Linux.
Системы Linux на основе Debian поставляются с двумя основными менеджерами пакетов:
- apt – Управление пакетами из репозиториев
- dpkg – Управление пакетами, загруженными в систему. Часто в формате .deb
- aptitude можно установить и использовать аналогично apt
Чтобы проверить версию установленного пакета на вашем сервере/настольном Ubuntu, используйте любой из методов, показанных в следующих разделах.
Прежде чем начать, обновите APT-индекс вашего пакета:
Метод 1. Использование команды apt
Команда apt имеет список параметров, который можно использовать для проверки версии пакета, установленного в системе Ubuntu или Debian.
Например, чтобы проверить версию пакета curl, установленную на моем сервере Ubuntu/Debian, я бы запустил:
$ apt list curl Listing. Done curl/focal-updates,focal-security,now 7.68.0-1ubuntu2.2 amd64 [installed,automatic] N: There is 1 additional version. Please use the '-a' switch to see it
Чтобы увидеть все версии пакета, доступные в репозитории, передайте параметр -a.
$ apt list curl -a Listing. Done curl/focal-updates,focal-security 7.68.0-1ubuntu2.5 amd64 [upgradable from: 7.68.0-1ubuntu2.2] curl/now 7.68.0-1ubuntu2.2 amd64 [installed,upgradable to: 7.68.0-1ubuntu2.5] curl/focal 7.68.0-1ubuntu2 amd64
$ apt show curl Package: curl Version: 7.68.0-1ubuntu2.5 Priority: optional Section: web Origin: Ubuntu Maintainer: Ubuntu Developers Original-Maintainer: Alessandro Ghedini Bugs: https://bugs.launchpad.net/ubuntu/+filebug Installed-Size: 411 kB Depends: libc6 (>= 2.17), libcurl4 (= 7.68.0-1ubuntu2.5), zlib1g (>= 1:1.1.4) Homepage: http://curl.haxx.se Task: server, cloud-image, ubuntu-budgie-desktop Download-Size: 161 kB APT-Sources: http://mirrors.digitalocean.com/ubuntu focal-updates/main amd64 Packages Description: command line tool for transferring data with URL syntax curl is a command line tool for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP. . curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos. ), file transfer resume, proxy tunneling and a busload of other useful tricks.
$ apt show docker-ce -a
Метод 2: использование apt-cache
$ apt-cache policy curl curl: Installed: 7.68.0-1ubuntu2.2 Candidate: 7.68.0-1ubuntu2.5 Version table: 7.68.0-1ubuntu2.5 500 500 http://mirrors.digitalocean.com/ubuntu focal-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages *** 7.68.0-1ubuntu2.2 100 100 /var/lib/dpkg/status 7.68.0-1ubuntu2 500 500 http://mirrors.digitalocean.com/ubuntu focal/main amd64 Packages $ apt-cache policy mariadb-server mariadb-server: Installed: (none) Candidate: 1:10.3.29-0ubuntu0.20.04.1 Version table: 1:10.3.29-0ubuntu0.20.04.1 500 500 http://mirrors.digitalocean.com/ubuntu focal-updates/universe amd64 Packages 500 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages 1:10.3.22-1ubuntu1 500 500 http://mirrors.digitalocean.com/ubuntu focal/universe amd64 Packages
Installed: 7.68.0-1ubuntu2.2 --> Show installed version
Если пакет не установлен, вы увидите none в качестве значения установленного ключа:
Linux apt версия пакета
NAME
apt-show-versions - Lists available package versions with distribution
DESCRIPTION
apt-show-versions parses the dpkg status file and the APT lists for the installed and available package versions and distribution and shows upgrade options within the specific distribution of the selected package. This is really useful if you have a mixed stable/testing environment and want to list all packages which are from testing and can be upgraded in testing. apt-show-versions uses caching for the status information of installed and available packages. If you run apt-show-versions as root the cache is updated as needed. If you run as non-root uses the newest available information, but can't update the cache. If you run as root with the option -i the cache is initialized or updated only.
SYNOPSIS
apt-show-versions [-h] [[-p] package name] [-a] [-b]
OPTIONS
If you don't give any options the status of all installed packages is printed. -p package, --package=package Print available and installed versions for specified package. You can also specify a package name without the option -p. If -p and a package name are missing, all installed packages are displayed. -r, --regex interpret package from option -p as a regex. -R, --regex-all like --regex, but also show matching packages which are not installed -u, --upgradeable Print only upgradeable packages -a, --allversions Print all available versions of the selected packages -b, --brief Print only package_name/distribution for upgradeable packages -v, --verbose Prints out messages about which Package files are parsed. -i, --initialize Initialize or update package cache only (as root). Do this every time when the status of the installed or available packages has changed. Initialization is done automatically on installation of the package and via a cron.daily job. -stf file, --status-file=file Use file as the dpkg status file instead of /var/lib/dpkg/status -ld directory, --list-dir=directory Use directory as path to apt's list files instead of /var/state/apt/lists/ or /var/lib/apt/lists/ -h, --help Prints out command-line help.
EXIT CODES
0 No error 1 Wrong usage 2 apt-show-versions has been called with exactly one package and upgradeable option set, but package is uptodate. As no output has been requested, this case gets signaled using the exit code. 255 Unspecified error
EXAMPLES
If you want to know for all your installed packages whether they are uptodate or upgradeable, use: apt-show-versions If you want to have a list of all upgradeable packages: apt-show-versions -u To get a list of all available versions of libc6: apt-show-versions -a -p libc6 To get information about several packages: apt-show-versions dpkg apt apt-show-versions -r ^texlive To upgrade all packages in testing: apt-get install `apt-show-versions -u -b | fgrep testing`
AUTHOR
SEE ALSO
© 2019 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.