Linux no install recommends

Как пользоваться apt

Пакетный менеджер Apt или Advanced Package Tool используется во множестве дистрибутивов, основанных на Debian или Ubuntu, а таких дистрибутивов сейчас очень много. Этот пакетный менеджер поддерживает все необходимые функции, вы можете устанавливать и удалять пакеты, обновлять то, что было уже установлено, искать пакеты, устанавливать их из файла или загружать без установки. При этом все зависимости будут разрешаться автоматически.

Утилита apt ничем не уступает пакетному менеджеру yum, используемому в RPM дистрибутивах, да, здесь все ещё не поддерживается частичное обновление пакетов, как в Zypper, но в целом всё выглядит очень неплохо. В этой статье мы подробно рассмотрим как пользоваться apt в Linux для решения задач работы с программами.

Синтаксис и опции apt

Синтаксис команды apt очень простой и похож на другие команды Linux:

$ apt опции команда параметры_команды

Опции указывают общее поведение утилиты, команда — действие, которое надо выполнить, а в параметрах команды обычно передается имя пакета, с которым следует работать, например, установить или удалить. Вот основные опции утилиты:

  • -v, —version — выводит версию утилиты;
  • -h, —help — выводит справку по использованию утилиты;
  • -y, —yes — автоматически отвечать «да» на все возникающие вопросы;
  • —assume-no — автоматически отвечать «нет» на все возникающие вопросы;
  • -d, —download-only — только скачать пакеты и больше ничего не делать;
  • -f, —fix-broken — исправить недостающие зависимости;
  • —no-download — ничего не загружать, использовать только пакеты из кэша;
  • -s, —simulate — режим симуляции, никакие операции не выполняются, только выводится информация на экран;
  • —allow-unauthenticated — позволяет установить пакеты, из репозиториев, для которых нет GPG подписи;
  • —no-install-recommends — не устанавливать рекомендованные пакеты, по умолчанию будут установлены;
  • -m, —ignore-missing — игнорировать пакеты, которые существует;
  • -q, —quiet — выводить минимум информации, не показывать прогресс бар;
  • -V, —verbose-versions — показывать полные версии обновленных пакетов;
  • —only-upgrade — не устанавливать новые пакеты, только обновлять;
  • —allow-downgrades — разрешить откатывать версию пакетов;
  • —reinstall — переустановить пакет если он уже установлен;

А теперь давайте пройдёмся по командам apt, которые вы можете использовать:

  • install — установить пакет;
  • remove — удалить пакет, конфигурационные файлы, которые были изменены в вашей системе удалены не будут;
  • purge — полностью удалить пакет, вместе со всеми его конфигурационными файлами;
  • autoremove — очистить ненужные пакеты;
  • autoclean — очистить кэш пакетов;
  • update — обновить списки пакетов из репозиториев;
  • upgrade — обновить версию пакета до последней, если пакет не указан будут обновлены все пакеты;
  • full-upgrade — полное обновление системы, включая удаление несовместимых или больше ненужных пакетов;
  • list — список установленных пакетов;
  • search — поиск пакетов;
  • show — посмотреть информацию о пакете;
  • download — скачать пакет в текущую папку;
  • edit-sources — открыть с настройками репозиториев в текстовом редакторе.
  • source — скачать исходный код пакета в текущую папку;
  • build-dep — установить зависимости необходимые для сборки выбранного пакета;
Читайте также:  Linux show all folders size

Дальше рассмотрим несколько примеров работы с apt, которые пригодятся как начинающим, так и более опытным пользователям.

Как пользоваться apt

1. Обновление пакетов

Сначала давайте обновим список пакетов apt из репозиториев. Репозитории находятся на удалённых серверах и когда утилита apt ищет пакет для установки, естественно, что она не обращается ко всем репозиториям подряд чтобы узнать где он находится. В системе уже есть сохранённых кэш информации о том, какие пакеты вообще есть и где их можно скачать. Для обновления этого кэша используйте команду update:

Во время загрузки URL репозиториев обозначаются специальными префиксами, вот что они означают:

  • Hit (Сущ) — список не изменился с момента предыдущей загрузки;
  • Ign (Игн) — репозиторий игнорируется, либо он слишком новый, либо произошла незначительная ошибка во время загрузки;
  • Get(Пол) — доступна новая версия и она будет загружена.

Когда кэш обновлен вы можете посмотреть для каких пакетов доступны обновления:

Аналогично можно посмотреть установленные пакеты apt:

sudo apt list —all-versions

Затем можно обновить все пакеты в системе:

Источник

apt-get command in Linux with Examples

The command-line tool `apt-get` is the most popular package management tool used in our Debian-based Linux operating system. This article provides an overview of `apt-get` and its basic syntax. It will include the most commonly used commands, their syntax, description, and examples. It also gives an explanation of the contrast to other Linux distributions such as CentOS and Fedora, which use different package managers, and Debian-based Linux distributions use APT (Advanced Packaging Tool).

What is apt-get?

apt-get is a command-line tool that helps in handling packages in Linux. Its main task is to retrieve the information and packages from the authenticated sources for installation, upgrade, and removal of packages along with their dependencies. Here APT stands for Advanced Packaging Tool. It is a Debian-based Linux operating system, for example, Ubuntu and Debian itself. It is an APT (Advance Packaging Tool) system. Which manages packages for Debian-based Linux distributions.

What is Debian-based Linux distributions?

A family of operating systems that are built on the Debian operating system. They use the same APT (Advance Packaging Tool) for package management system. Some of the most popular Debian-based Linux distributions have different features but come under the same underlying Debian system and package management tools are Linux Mint, Ubuntu and kali Linux.

Читайте также:  Linux пароли пользователей где хранятся

One must know when we talk about Red Hat-based distributions like CentOS and Fedora, they are Linux distributions but not Debian-based Linux distributions. Red Hat-based Linux distributions are often preferred for enterprise environments and servers, focusing on stability and security. Whereas Debian-based Linux distributions moreover focus on long-term support and stability.

Note: apt-get (package manager) is used in Debian-based Linux distributions but in Linux distributions like CentOS and Fedora uses different package manager.

APT-GET Command in Linux

Basic Syntax:

sudo apt-get [options] [command] [package(s)]

Breakdown of each component:

  • `sudo`: We will be using ‘sudo’ before every ‘apt-get’ command because ‘sudo’ in Linux system is used to execute command with the administrative privileges (root privileges). In the case of ‘apt-get’ which is used to manage software packages on Debian-based Linux systems, we need administrative privileges to install, remove, update and make other changes.
  • `apt-get`: The command itself.
  • `[options]`: This is an optional parameter in this we can use `-y` or `-s` for modifying the behavior of `apt-get` command. `-y` is for automatically answering “yes” and `-s` is for simulating a command without making any changes.
  • `[packages]`: In this we specify the package that we want to remove, upgrade or install. If we want to mention multiple packages at same time, specify them by separated spaces between them.

Most Used Commands[APT-GET]

You need to provide one of the commands below, if the -h option is not used.

sudo apt-get list [package_name]

Options Available in `apt-get`:

sudo apt-get build-dep [package_name]

“or”
sudo apt-get -b source [package_name]

sudo apt-get build-dep firefox

“or”
sudo apt-get -b source vlc

Note: apt-get command will return 0 for successful executions, and decimal 100 in case of errors.

Basic Queries Asked About `apt-get`:

1) Difference between apt-get remove and apt-get purge?

Both of `apt-get remove` and `apt-get purge` are used for similar purposes, that is to remove or uninstall the packages from our system. But still, they have a different use case.

`apt-get remove` this command only removes packages from system but leave behind their configuration files. (To see syntax, refer above context)

`apt-get purge` this command is also used to remove packages but in this case configuration files are also removed. (To see syntax, refer above context)

2)Difference between apt-get update and apt-get upgrade?

`apt-get update` This command is used to update packages rather than installing them, basically it is used to update local package index with the latest information from the configured source. Remember it does not install packages.

`apt-get upgrade` This command is used to upgrade the packages to the newest version available. Basically, it is used to upgrade and download the packages that are installed in our system.

Syntax for `apt-get update`:

sudo apt-get update

Syntax for `apt-get upgrade`:

In this we going to upgrade firefox, if it is already upgrade it will show firefox is already upgraded.

Читайте также:  Командная строка открыть файл linux

sudo apt-get upgrade

3)Not able to run `apt-get` in Red Hat Linux?

`apt-get` it is command used for package management but only in Debian-based Linux distributions like mint, Debian and ubuntu, whereas Red Hat Linux is a Linux distribution but does not come under Debian-based Linux distributions. Red Hat Enterprise Linux (RHEL), Fedora and CentOS all will not be able to use `apt-get` instead we can use `dnf` or `yum` package management tools. Just for basic example: we can use `sudo yum update` or `sudo dnf update`.

4)How to install packages using `apt-get` command?

In this we are going to install firefox package in our Debian-base Linux operating system (In this case we are executing this command in Ubuntu)

Syntax for `apt-get install`:

sudo apt-get install firefox

Источник

apt with –no-install-recommends

apt with --no-install-recommends

In this article, we cover –no-install-recommends option with apt. APT or Advanced Package Tool is a command-line interface for managing packages. With the help of the command-line tool apt, the user can install, remove, and upgrade packages.

You must have noticed while installing any package in Debian or Debian-based Linux distributions like Ubuntu it recommends certain packages which are installed as dependencies.

In certain circumstances, it would be advisable to install the recommended packages. The additional features provided by the recommended packages can be quite useful later. You previously had the experience of working with the package and then you chose not to install the recommended packages and find some features missing.

On the other hand, you understand that there are certain packages that you don’t require at all. But, they are installed as recommended packages and you have the option not to install them. That would optimize the installation process and saves precious disk space as well.

With apt, we get the option to either install or ignore the recommended package installation.

Note: Following operations require Administrative privileges. If you don’t have one then we advise you to contact your System Administrator for assistance.

apt with –no-install-recommends

If you don’t wish to install recommended packages then, use the following option with apt:

sudo apt install —no-install-recommends

If you wish to install recommended packages as dependencies then don’t use the –no-install-recommends option.

In conclusion, we have covered here how not to install recommended packages as dependencies with the apt command-line interface for managing packages.

Источник

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