Xubuntu

Глава 10. Управление пакетами в оффлайн-режиме

Содержание

Обновление репозиториев
Установка пакета
Обновление пакетов

Существует инструмент apt-offline, помогающий поддерживать систему в актуальном состоянии даже при отсутствии интернет-соединения с помощью второго, подключённого к Интернету компьютера. Этот второй компьютер может работать под управлением Xubuntu, другой разновидности Ubuntu, или Debian. Доступен графический интерфейс apt-offline-gui. В данном документе рассматривается вариант с использованием командной строки.

Throughout this chapter directions to use a directory on a USB flashdrive are given, the naming and path to this directory is for you to decide beforehand.

[Предупреждение]

A few specific packages are not built to handle the disconnected environment, due to them running download scripts during the installation or upgrade process. Some packages that routinely exhibit this behavior are flashplugin-installer, nautilus-dropbox, and ttf-mscorefonts-installer. There is no workaround for installation packages that themselves make downloads.

[Примечание]

Желательно избегать использования флага -y при обновлении, чтобы иметь последний шанс просмотреть обновления на наличие упомянутых выше проблем.

[Примечание]

При использовании apt-offline могут появиться некоторые ошибки, выделенные красным текстом, о невозможности загрузить файлы, относящиеся к переводам. Их можно без вреда проигнорировать.

Обновление репозиториев

После вставки USB-носителя и открытия терминала можно использовать apt-offline для генерации запроса на обновление сведений о репозиториях программного обеспечения. Это позволит компьютеру увидеть, имеются ли в наличии какие-либо исправления ошибок, обновления безопасности или новые приложения.

На компьютере без Интернета наберите: apt-offline set --update apt-offline.sig

После выполнения команды, скопируйте apt-offline.sig на USB-носитель и перенесите на другой компьютер. С помощью apt-offline на этом компьютере используйте данный файл, чтобы загрузить то, что нужно для обновления на не подключённом к Интернету компьютере. Перейдите в каталог на флешке, содержащий apt-offline.sig, наберите apt-offline get --bundle bundle.zip apt-offline.sig. После завершения извлеките USB-носитель и верните его на компьютер без Интернета.

На компьютере без Интернета снова подключите USB-носитель. Перейдите на нём в каталог, содержащий два файла и наберите: sudo apt-offline install bundle.zip. После завершения работы команды ваши репозитории будут обновлены.

Установка пакета

You can use apt-offline to download a package to install. This action can also be combined with updating the software repositories. In a disconnected environment, using opportunities to connect efficiently is key.

In this example, we assume you want to install a new program package. Throughout this we'll refer to this as PACKAGENAME though in normal use you will want to enter just the package name. Fairly frequently, installing a package will require you to install dependencies. apt-offline handles the dependency resolution for you. To start this process open a terminal window, plug in a USB flash drive, and navigate to the directory. From that directory run sudo apt-offline set --install-packages $PACKAGENAME --update apt-offline.sigto start the process

When complete, copy apt-offline.sig to your USB flash drive and take it to another computer. With apt-offline on that computer, use that file to download what your disconnected computer needs to update and install PACKAGENAME. Navigate to the directory on the flash drive containing apt-offline.sig, run sudo apt-offline get --bundle bundle.zip apt-offline.sig. The output will show an attempt to download repository updates as well as PACKAGENAME and any dependencies your system requires. Remove the USB flash drive when complete and take it back to the disconnected computer.

At the disconnected computer, insert the USB flash drive. Navigate to the directory on the flash drive containing the two files then enter: sudo apt-offline install bundle.zip. Once it completes your repositories will be updated. Once that completes, you can then install PACKAGENAME by then entering: sudo apt-get install PACKAGENAME.

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

Upgrading packages requires 2 stages: updating repositories and then the download and upgrade as required.

Вначале обновите репозитории, следуя инструкциям в Обновление репозиториев

Clear the directory on USB flash drive that you have used previously. In a fresh terminal window, navigate to the directory on the USB flash drive you intend to work from. Since we never want to lose the opportunity to refresh the disconnected machine's view of the repositories, we can build the command to not only look for upgrade packages but also to update repositories. Enter apt-offline set --update --upgrade apt-offline.sig

Once done, copy apt-offline.sig to your USB flash drive and take it to another computer. With apt-offline on that computer, you use that file to download what your disconnected computer needs to upgrade itself. Navigate to the directory on the flash drive containing apt-offline.sig, run sudo apt-offline get --bundle bundle.zip apt-offline.sig. The output will show an attempt to download repository updates as well as any upgrades and dependencies required by your system. Once done, remove the USB flash drive and take it back to the disconnected computer.

На компьютере без подключения к Интернету вставьте USB-носитель, перейдите в каталог, содержащий два файла и наберите sudo apt-offline install bundle.zip. После завершения работы этой команды репозитории будут обновлены и вы сможете установить обновления командой: sudo apt-get upgrade.