- 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
- 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
- Команда apt в Linux
- Обновление индекса пакета ( apt update )
- Обновление пакетов ( apt upgrade )
- Полное обновление ( apt full-upgrade )
- Установка пакетов ( apt install )
- Удаление пакетов ( apt remove )
- Удалить неиспользуемые пакеты ( apt autoremove )
- Листинг пакетов ( apt list )
- Поиск пакетов ( apt search )
- Информация о пакете ( apt show )
- Выводы
- Ubuntu 20.04 update installed packages for security
- Ubuntu 20.04 update installed packages for security
- Step 1 – Update package information
- Step 2 – Find out information about available Ubuntu security-related updates
- Step 3 – Install updates via apt command line for Ubuntu 20.04
- How do I update a single package on Ubuntu?
- How to exclude Ubuntu 20.04 LTS package from a update
- Step 4 – Reboot the Linux system
- Ubuntu Linux 20.04 LTS – Updating your system using GUI
- Conclusion
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
Источник
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
Источник
Команда 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 .
Не стесняйтесь оставлять комментарии, если у вас есть вопросы.
Источник
Ubuntu 20.04 update installed packages for security
Ubuntu 20.04 update installed packages for security
The procedure to install updates and security patches on Ubuntu:
- Open the terminal application.
- For remote server log in using the ssh command: ssh vivek @ your-ubuntu-server-ip .
- Run the command sudo apt update to refresh package database.
- Show information about available update/packages/pathces, run: sudo apt list —upgradable
- Apply security updates and patches for all installed apps, run: sudo apt upgrade
- Reboot the system if kernel was updated by typing sudo reboot command.
Step 1 – Update package information
First you need to download package information from all configured sources stored in /etc/apt/sources.list and /etc/apt/sources.list.d/ directory. Use the grep command/egrep command to list sources:
grep -i «^deb» /etc/apt/sources.list
Fetch package updates information using the apt command:
sudo apt update
Step 2 – Find out information about available Ubuntu security-related updates
It is a good idea to list out all updates available for the box. Hence, we run the following command:
sudo apt list —upgradable
outputs:
Want to see a list of the updates one screen at a time? Try the following command along with grep command/more command:
sudo apt list —upgradable | more
## see if nginx update released or not ##
sudo apt list —upgradable | grep -i nginx
We can also list all possible versions that we can install or update using the following syntax:
sudo apt list —all-versions —upgradable
Before you apply updates please note down Linux kernel version, run:
uname -mrs
Sample outputs:
It is also possible to create a list of all installed software as follow
dpkg —get-selections >
/packages-list-dd-mm-yyyy.txt
We can restore em if required later:
sudo dpkg —set-selections
See “Linux Get List of Installed Software for Reinstallation / Restore All the Software Programs” for more info.
Step 3 – Install updates via apt command line for Ubuntu 20.04
Fire up a terminal application or log in using ssh command. Run the apt command to upgrade all installed packages on Ubuntu Linux system:
sudo apt upgrade
When promoted as follows, type “ Y ” and press the [Enter] key to confirm operation of patching and applying updates on Ubuntu:
How do I update a single package on Ubuntu?
Say you only want to update nginx package, run:
sudo apt install package
sudo apt install nginx
sudo apt install bash
sudo yum update python3
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
How to exclude Ubuntu 20.04 LTS package from a update
Use the apt-mark command as follows to held back given package, which will prevent the package from being automatically installed, upgraded or removed from the system:
sudo apt-mark hold
Want to cancel a previously set hold on a package to allow all actions again? Pass the unhold option as follows:
sudo apt-mark unhold
We can use the following simple command to print a list of packages on hold in the same way as for the other show commands:
sudo apt-mark showhold
sudo apt-mark showhold | grep nginx
- 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 ➔
Step 4 – Reboot the Linux system
Did apt installed a new kernel? If so reboot the system, run:
sudo reboot
After reboot verify your Linux kernel version and list available updates, enter:
uname -mrs
sudo apt update
sudo apt list —upgradable
Ubuntu Linux 20.04 LTS – Updating your system using GUI
Conclusion
You learned how to install software update and patches on Ubuntu 20.04 systems. See Ubuntu apt command help page for more information.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник