Upgrade one package linux

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 .

Читайте также:  Gnome графическую оболочку linux

There are two possible ways I can think of:

    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.
  • Источник

    Update a Single Package With apt Command in Ubuntu and Debian

    How do you update your Ubuntu system in the command line? You use the apt update (to refresh the package cache) and apt upgrade commands.

    sudo apt update && sudo apt upgrade

    It updates all the installed apt packages that can be upgraded at once. This includes the Linux kernel version, too.

    This seems like a good thing, especially for desktop users. That may not be the case for Ubuntu server users where you have crucial web services running.

    If you want to be selective about the updates and only want to upgrade a single package, use this command:

    sudo apt install --only-upgrade package_name

    Let’s see it in a bit more detail.

    Upgrade single package using apt command

    The first step is to update the local package repository cache so that your system knows about the availability of new package versions.

    This is optional. Check if the package you want to upgrade is in the list of upgradable packages.

    If the desired package has a new version available, you can choose to upgrade only this single package with this command:

    sudo apt install --only-upgrade package_name

    If you run the apt install command on an already installed package, it will be upgraded to the next available version.

    But if the package is not installed already, the apt command will also install it.

    This is why the —only-upgrade part is necessary. With that option, the apt command will only upgrade an already installed package. It will not install the package if it is not already installed.

    Читайте также:  Linux get vendor id

    Not the best-suited example for Ubuntu server users, but you can still see how I upgraded only one of the seven upgradable packages in the below screenshot.

    update single package ubuntu

    Upgrade selected packages only

    If you want to upgrade a selected few packages, you don’t have to update them one by one. Just provide the package names with the command mentioned earlier.

    sudo apt install --only-upgrade package1 package2 package3

    Upgrade selected packages in Ubuntu

    Conclusion

    When you are faced with a situation where you have to upgrade selected packages, you can use the apt install command with –only-upgrade option.

    Источник

    Как обновить один пакет в 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.

    Читайте также:  Установка аппаратных часов linux

    Создайте скрипт в /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.

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

    Источник

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