Linux update one package

How to upgrade a single package using apt-get?

How do I update a single package? As far as man apt-get says apt-get upgrade doesn’t take a package/list of packages as parameter:

upgrade upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list . Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.

7 Answers 7

You just need to do apt-get install —only-upgrade . This will upgrade only that single package, and only if it is installed.

If you wish to install the package if it doesn’t exist, or upgrade it if it does, you may leave out —only-upgrade .

apt-get install —only-upgrade will not install any new packages

@Pino It will, it makes sense to do so. What if the version you are upgrading to depends on a newer version of another package? You’re hosed if you don’t upgrade both. This is why install is the right command for this, even if it seems counter-intuitive.

Does this remove the «auto» mark? Sometimes when you install libraries specifically the package is marked as manually installed. I don’t like running ‘install’ on libraries for this reason.

I just tested, since all information is pretty vague; on Ubuntu 16.04 ( apt 1.0.1 ), upgrading a package using apt install does not affect the auto mark, whether —only-upgrade is supplied or not. Though of course using —only-upgrade makes sense if you don’t want to accidentally install something new. It will also upgrade any required dependencies.

In order to update a single package using the CLI:

sudo apt-get install --only-upgrade

e.g., sudo apt-get install —only-upgrade ack

Reading package lists. Done Building dependency tree Reading state information. Done Skipping **ack**, it is not installed and only upgrades are requested. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 

You should pass —only-upgrade to install subcommand, not directly to apt-get , then you’ll not have to append true .

There are two possible ways I can think of:

Читайте также:  Linux check ssh connection

    sudo apt-get install nameofpackage This will upgrade the package even if is already installed:

~$ sudo apt-get install emesene Reading package lists. Done Building dependency tree Reading state information. Done The following packages will be upgraded: emesene 1 upgraded, 0 newly installed, 0 to remove and 5 not upgraded. Need to get 1,486 kB of archives. After this operation, 696 kB disk space will be freed. Get:1 http://il.archive.ubuntu.com/ubuntu/ natty-updates/universe emesene all 2.11.4+dfsg-0ubuntu1 [1,486 kB] 

enter image description here

  • Using Synaptic Package Manager : Right click→Mark for upgrade: Note: Sometimes it may asks for additional packages or dependencies, it is normal.
  • Источник

    Как обновить один пакет в Ubuntu / Debian с помощью apt-get

    Как я могу обновить один пакет, используя apt-get в Ubuntu ?, Есть ли способ обновить один пакет, используя apt-get в Debian ?

    Наиболее распространенным способом обновления пакетов в Ubuntu / Debian является запуск команды sudo apt-get upgrade.

    Проблема заключается в том, что все установленные пакеты будут обновлены до последних версий, доступных в настроенных репозиториях Ubuntu.

    Что, если вы хотите обновить один пакет с помощью apt-get на машине с Ubuntu или Debian?

    Это актуально, если вы боитесь испортить пакеты из-за обновления всего.

    Обновите отдельный пакет в Ubuntu / Debian с помощью apt-get

    Чтобы обновить отдельный пакет с помощью apt-get в любой системе на основе Ubuntu / Debian, используйте синтаксис:

    sudo apt-get install --only-upgrade packagename

    Это будет работать для всех систем Ubuntu, Debian и Linux Mint.

    Замените packagename на имя пакета, который вы хотите обновить.

    Смотрите пример ниже, чтобы обновить Ubuntu-Keyring.

    $ sudo apt-get install --only-upgrade ubuntu-keyring Reading package lists… Done Building dependency tree Reading state information… Done The following packages will be upgraded: ubuntu-keyring 1 upgraded, 0 newly installed, 0 to remove and 190 not upgraded. Need to get 22.4 kB of archives. After this operation, 4,096 B of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 ubuntu-keyring all 2018.09.18.1~18.04.0 [22.4 kB] Fetched 22.4 kB in 1s (34.5 kB/s) (Reading database … 261497 files and directories currently installed.) Preparing to unpack …/ubuntu-keyring_2018.09.18.1~18.04.0_all.deb … Unpacking ubuntu-keyring (2018.09.18.1~18.04.0) over (2018.02.28) … Setting up ubuntu-keyring (2018.09.18.1~18.04.0) …

    Обновите несколько пакетов в Ubuntu / Debian / Linux Mint

    Чтобы обновить несколько пакетов, разделите их пробелом.

    sudo apt-get install --only-upgrade thunderbird cinnamon cinnamon-common

    Если вы хотите обновить все установленные пакеты, используйте команду:

    Обновите один пакет или несколько пакетов в Ubuntu с помощью скрипта

    Мы можем создать простой скрипт, который будет передавать имена пакетов в качестве аргументов каждый раз, когда вы хотите обновить отдельный пакет с помощью apt-get в системе Ubuntu или Debian.

    Создайте скрипт в /usr/local/bin/myupgrade с содержимым ниже.

    #!/bin/bash pakage_names="$@" [[ -z $pakage_names ]] && < echo "Usage: $(basename $0) package1 package 2 package.."; exit 1; ># Check if package is already installed for package in $; do if dpkg -s "$package" 2>/dev/null | grep -q Status.*installed; then echo "Attempting to upgrade $package" sudo apt-get --only-upgrade -y install $package else echo "Package $package is not installed, install it (y/n): " read selection if [[ $selection == "y" ]] || [[ $selection == "Y" ]]; then sudo apt-get -y install $package else echo "Okay!, next time" fi fi done 

    Дайте скрипту бит выполнения.

    sudo chmod +x /usr/local/bin/myupgrade

    Вы должны передать аргументы скрипту, чтобы обновить пакет.

    $ myupgrade Usage: myupgrade package1 package 2 package..

    Чтобы обновить один пакет, передайте один аргумент в конце

    $ myupgrade util-linux Attempting to upgrade util-linux [sudo] password for jmutai: Reading package lists… Done Building dependency tree Reading state information… Done Suggested packages: util-linux-locales The following packages will be upgraded: util-linux 1 upgraded, 0 newly installed, 0 to remove and 182 not upgraded. Need to get 902 kB of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 util-linux amd64 2.31.1-0.4ubuntu3.3 [902 kB] Fetched 902 kB in 2s (518 kB/s) (Reading database … 261497 files and directories currently installed.) Preparing to unpack …/util-linux_2.31.1-0.4ubuntu3.3_amd64.deb … Unpacking util-linux (2.31.1-0.4ubuntu3.3) over (2.31.1-0.4ubuntu3.2) … Setting up util-linux (2.31.1-0.4ubuntu3.3) … Processing triggers for mime-support (3.60ubuntu1) … Processing triggers for ureadahead (0.100.0-20) … Processing triggers for systemd (237-3ubuntu10.9) … Processing triggers for man-db (2.8.3-2ubuntu0.1) …

    Для нескольких пакетов укажите имена через пробел.

    $ myupgrade nplan openssl perl

    Если пакет еще не установлен, скрипт спросит вас, хотите ли вы установить его. Подтвердите нажатием «Y» или «y».

    $ myupgrade elinks Package elinks is not installed, install it (y/n) y Reading package lists… Done Building dependency tree Reading state information… Done The following additional packages will be installed: elinks-data libfsplib0 liblua5.1-0 libtre5 Suggested packages: elinks-doc tre-agrep The following NEW packages will be installed: elinks elinks-data libfsplib0 liblua5.1-0 libtre5 0 upgraded, 5 newly installed, 0 to remove and 169 not upgraded. Need to get 1,062 kB of archives. .

    Это конец нашего руководства о том, как обновить отдельный пакет с помощью apt-get в Ubuntu / Debian.

    Читайте также:  Linux scripts to run at startup

    Я надеюсь, что это было полезно, и спасибо за посещение.

    Источник

    Upgrade a Single package on Ubuntu

    Upgrade a Single package on Ubuntu

    Follow through this guide to learn how to upgrade a single package on Ubuntu.

    Upgrade a Single package on Ubuntu

    Ubuntu and other Debian derivatives provides commands such as apt upgrade for upgrading the system packages.

    According to APT man pages, man apt ;

    apt upgrade: is used to install available upgrades of all packages currently installed on the system from the sources configured via sources.list(5). New packages will be installed if required to satisfy dependencies, but existing packages will never be removed. If an upgrade for a package requires the removal of an installed package the upgrade for this package isn’t performed.

    So how can you upgrade a single package on Ubuntu?

    In order to install a package in Ubuntu, you would usually run the command;

    Where is the name of the package in question.

    So to upgrade a single package on Ubuntu, you would pass yet another option, —only-upgrade to the apt install command such that your command looks like;

    Note that the package ought to have already been installed.

    For example, let us list the packages that can be upgraded on my Ubuntu 20.04 system;

    Listing. Done firefox-locale-en/focal-updates,focal-security 85.0+build1-0ubuntu0.20.04.1 amd64 [upgradable from: 84.0.2+build1-0ubuntu0.20.04.1] firefox/focal-updates,focal-security 85.0+build1-0ubuntu0.20.04.1 amd64 [upgradable from: 84.0.2+build1-0ubuntu0.20.04.1] libmysqlclient21/focal-updates,focal-security 8.0.23-0ubuntu0.20.04.1 amd64 [upgradable from: 8.0.22-0ubuntu0.20.04.3] skypeforlinux/stable 8.68.0.100 amd64 [upgradable from: 8.67.0.96] ubuntu-drivers-common/focal-updates 1:0.8.6.4~0.20.04.1 amd64 [upgradable from: 1:0.8.6.3~0.20.04.2]

    As you can see, I have some packages that can be upgraded.

    NOTE: if i run apt upgrade, all these packages will be marked for upgrade;

    Reading package lists. Done Building dependency tree Reading state information. Done Calculating upgrade. Done The following package was automatically installed and is no longer required: libllvm10 Use 'sudo apt autoremove' to remove it. The following packages will be upgraded: firefox firefox-locale-en libmysqlclient21 skypeforlinux ubuntu-drivers-common 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 141 MB of archives. After this operation, 2,381 kB disk space will be freed. Do you want to continue? [Y/n]

    So if you want to upgrade a single package on Ubuntu, then you need to update the package cache;

    Читайте также:  Сколько всего дистрибутивов linux

    Then, upgrade a single package on Ubuntu using the apt install —only-upgrade command.

    For example, If i want to upgrade only skypeforlinux package as per my output of the list of upgradable packages;

    apt install --only-upgrade skypeforlinux
    Reading package lists. Done Building dependency tree Reading state information. Done The following package was automatically installed and is no longer required: libllvm10 Use 'sudo apt autoremove' to remove it. The following packages will be upgraded: skypeforlinux 1 upgraded, 0 newly installed, 0 to remove and 9 not upgraded. Need to get 83.1 MB of archives. After this operation, 2,857 kB disk space will be freed. Get:1 https://repo.skype.com/deb stable/main amd64 skypeforlinux amd64 8.68.0.100 [83.1 MB]

    And that is how you can upgrade a single package on Ubuntu.

    As a side note, if you want to install or upgrade a package and at the same time you need to remove packages that are no longer required, pass the —auto-remove option.

    apt install --only-upgrade skypeforlinux --auto-remove

    You would achieve the same y running the command;

    Further Reading

    Consult APT man pages for detailed information on using it.

    Источник

    Оцените статью
    Adblock
    detector