Install deb package from console. Downloading deb packages with dependencies for offline installation

Download them straight from the repositories of the online store Cydia... However, not everyone knows about an alternative way to install deb-extensions from the store (Saurik). Of course, you can only install tweaks on a jailbroken iPhone, iPad or iPod Touch.

In contact with

Why, then, do you need another method, you ask. Here's why. For example, if there is no constant access to the Wi-Fi network or the application itself Cydia refuses to start or does not work correctly.

The reason may be even more commonplace, in Cydia no repository has been added, in which the tweak is distributed for free, and a cured version of the extension in deb format has been circulating on the Internet for a long time.

All tweak installation packages have the extension " .deb“, Only such and not any other files can be installed in this way. Please note that sometimes extensions are packed into an archive and must be unzipped before installing. So, to install a deb package using a PC, you need any file manager or. Both programs are free and available for both Windows and OS X. The tweak file downloaded on the Internet * .deb is enough to transfer to the folder Cydia-Instalation or CydiaAppinstall (depending on the file manager). You do not need to search for it, each of the programs contains a separate link for this path in the file system access menu. Just in case, I will nevertheless say that the path to this folder is as follows:.
Several required deb packages can be copied into this folder at once. Please note that some tweaks are installed along with dependencies (other tweaks), without which they will not work. Sometimes the authors of the distribution of deb files attach them to the distribution or save them in the same archive, all of them must be installed along with the extension. After copying, just restart the iDevice, when you turn on the device, the tweak will be installed. There are times when the tweak does not work quite correctly; to fix the problem, it is enough to respring in any available way.
The second method of installing deb packages allows you to do without a computer altogether. In this case, you need to have the file manager installed on the device. By the way, this application is a vivid example of a deb application with a lot of dependencies during installation.
It is enough in Safari to click on the link to download the deb-file and the browser itself will offer to open it in iFile... By clicking on the tweak, you will see a pop-up menu with the function “ Install» (« Install"), She is responsible for installing the extension. After loading it is enough to make sure that the last line of the displayed text will be "O". This line notifies about errors while installing the tweak. In case of an error, you can act differently: copy the deb file along the path / var / root / Media / Cydia / AutoInstalland restart iDevice.

There are two types of installation files on iPhone / iPad - DEB and IPA. IPA are files of games and various programs from the iTunes AppStore. They are installed and downloaded in one click; such files can also be found and downloaded on the Internet.

Features of DEB installation

DEB - installation packages for tweaks and programs that can be downloaded from Cydia. If you download DEB files from Cydia, you will not see them again, these files will be deleted immediately after installing the program. But if you downloaded the DEB package on the Internet, then you need a manual installation. How to install DEB on iPad or iPhone? Four installation options will be described below.

The first way

How to install DEB on iPhone? The first method is through terminal installation. This is one of the most difficult options. A terminal must be installed on your phone - either MobileTerminal from Sidia or, alternatively, configured to access the iPhone from a computer. You need to copy the .deb file to your phone (/ var / mobile). Next, you need to enter the following in it (during typing, the characters will not appear, it's okay): su root alpine dpkg -i filename.deb. After each written line, press Enter. If the file is not installed, the terminal will inform you about it.

Second way

How to install DEB package on iPhone or iPad? The second method is to install via Cydia (if you have access to files via usb). You need to copy the DEB file to the following location: / var / root / media / Cydia / AutoInstall. If some folders are missing, then create them manually. Next, restart your phone. After launching the device, Cydia will install all files automatically.

Third way

How do I install DEB? The third method is through Cider (Cydia is required on the device). Run Cider on your computer (do not forget to first connect your phone to your computer), the first time you start the program, it creates all the required folders and files. In the Archives folder, copy the required DEB files. Then run Cider so that the program can see the files. Our DEB packages will be displayed on the "Synchronization" tab, you need to choose where to copy them - to the Cydia cache or to the AutoInstall folder. Cydia cache: after you have copied the file, you need to launch Sidia and in the search select the program that you want to install, then start the installation, and it will be installed immediately without downloading from the Internet. AutoInstall folder: you need to copy the file, restart your iPhone or iPad, and the program will be installed automatically during the restart.

Fourth way

How do I install DEB files? Method four - installation through the iFile program. This work is carried out on the phone or tablet itself. First you need to install the required iFile program on your device from Sidia. The next step is to download the DEB file to your phone or tablet. You can move the file using any method known and available to you. Move the file to any folder. After copying, open the DEB file and click the Install button. Wait for the installation to finish.

After installation, if necessary, you can reboot your device. The above answers were given to the question of how to install DEB files. Follow the instructions and you will succeed!

Packages usually contain blanks of configuration files, such as those located in / etc. Obviously, if the config in the package is updated, the user will lose his edited config. This problem can be easily solved by using folders like "config.d", the contents of which are included in the main config, replacing the duplicate options.
The DEBIAN / conffiles file provides a different solution to the problem: it contains a list of configuration files (one per line). If one of these files is updated in the current version of the package, then the user receives a warning about a conflict between the versions of the configs, and can choose: delete, replace, or do merge.
This situation is probably faced by every Linux user who delved into configs :) And legs grow from here.
Each line must have a full absolute path to each config. For instance:
/etc/supersh/init.conf
/etc/supersh/actions.conf
DEBIAN / dirs: list of folders to create
"A list of absolute paths to folders that are required by the program, but for some reason are not created." - says the official documentation. In practice, all the folders that are used by the program in one way or another are listed here: and where the binaries are located, and which are used by the program.
One per line. For instance:
/ var / log / supersh
/ var / lib / supersh
Useful for creating multiple empty folders.
DEBIAN / menu: create menu items
A tricky file for creating menu items. It never worked for me :) One gets the feeling that its content is used either in unusual window managers, or in some kind of console menu ... or was used earlier and was forgotten :)
Example:
? package (supersh): needs \u003d "text" section \u003d "Applications / Programming" title \u003d "(! LANG: Super Shell Script" command="/usr/bin/super.sh" !}
TODO: find out why you need it. This is written in man5 menufile, to be honest, I did not delve into it :)
UPD: Correct way to add menu item
The file / DEBIAN / menu creates something unknown and it is not clear where: the graphical menu items are still not created. Therefore, we will do it right :)
In / usr / share / applications we see a bunch of * .desktop files: these are the menu items. They are text files with syntax similar to an ini file. We open, learn, do the same and put the resulting * .desktop file in usr / share / applications /. The icon for it should be in usr / share / pixmaps.
After that, add the update-menus menu update command to the postinst script:
if ["$ 1" \u003d "configure"] && [-x "` which update-menus 2\u003e / dev / null` "]; then
update-menus
fi

Working with package installation scripts will be discussed below.
Thanks to Condorious for the tip :)

DEBIAN / md5sums: file checksums
Used to check the integrity of a package. An important file.
Filled in like this (cwd \u003d package root):
$ md5deep -r usr\u003e DEBIAN / md5sums
DEBIAN / watch: monitoring the site from where the program was downloaded
This function is useful if you maintain from several dozen packages, and it is difficult to keep track of all the updates.
The file contains instructions for the uscan and uupdate programs. Using this feature, you can keep track of the site from where the package sources were obtained, and ensure quality control of the distribution as a whole.
Example:
# Site Directory Pattern Version Script
ftp.obsession.se / gentoo gentoo - (. *) \\. tar \\ .gz debian uupdate

And another example for uscan (1):
version \u003d 3
madwimax.googlecode.com/files/madwimax-(.*)\\.tar\\.gz

DEBIAN / (preinst | postinst | prerm | postrm): installation scripts
In total, you can create up to four scripts in one package:

Please note that errors in these scripts are not logged in any way: nothing more interesting than the script return code is saved anywhere, and logging must be done manually! Users of one of my packages failed when installing on Linux Mint, and there was not even an opportunity to ask them for an error log (which is not there) to suggest the reason :)
I recommend using the following blank at the beginning of each script: it will save all errors that occur to syslog.
#! / bin / bash
set -e # fail on any error
set -u # treat unset variables as errors

# \u003d\u003d\u003d\u003d\u003d\u003d [Trap Errors] \u003d\u003d\u003d\u003d\u003d\u003d #
set -E # let shell functions inherit ERR trap

# Trap non-normal exit signals:
# 1 / HUP, 2 / INT, 3 / QUIT, 15 / TERM, ERR
trap err_handler 1 2 3 15 ERR
function err_handler (
local exit_status \u003d $ (1: - $?)
logger -s -p "syslog.err" -t "ootync.deb" "supersh.deb script" $ 0 "error code $ exit_status (line $ BASH_LINENO:" $ BASH_COMMAND ")"
exit $ exit_status
}

Your install script code ...

WARNING: the blank has not been tested extensively yet, check it again! I came across the impossibility of debugging quite recently :)

DEBIAN / templates: templates for dialogs
As already mentioned, in the DEBIAN / config script, you can ask the user questions: enter a line, select one of the options, tick, ... This is done by the "library" of bash debhelper functions of the debconf package, which is also capable of a lot of useful things. I do not consider them here :)
The DEBIAN / templates file contains data used in displaying dialog boxes (GUI or ncurses). The file contains blocks separated by an empty line. Each block defines the resources used in one particular dialog box.
The header for all types of dialogs is standard:
Template: supersh / template-name
Type: string
Default: Default-value
Description: Dialog-title
␣Dialog-text

Template - a unique (within one package) template identifier. If you need to call a specific dialog in the script, this name is used.
Type - the type of the template. The following types are defined: string, password, boolean, select, multiselect, text, note, error.
Default-value - the default value: the user can simply agree with it.
Description - as in the control file, it consists of two fields: a short description and a long text. The first is the title of the "window", the second is a more detailed description of what is required from the user. It is recommended not to use words like "enter", but immediately the essence: "Greeting the script", "Mount point", ...

A type Template description
string Prompt for a text string
password Password prompt.
There is no Default value for this type of template for obvious reasons :)
boolean Check mark :) Has a string value "true" or "false"
select The ability to choose one of several options.

Choices: yes, no, maybe
multiselect The ability to select several options with checkmarks.
The options are offered in an additional template attribute:
Choices: sex, drugs, rock-n-roll
text Displays text: some not very important information
note Displays text: important information
error Displays text: very important information, critical.

There is also no Default value for the text, note, error templates, since they only display information :)
Let's play with the following template:
Template: supersh / greeting
Type: string
Description: Welcome message
␣The message you wish the script to welcome you with.
Default: Greetings, my master!
Debconf and debhelper basics
These are only workable sketches. In the original, you can read about templates and working with them here: man 7 debconf-devel :)
To use templates in your DEBIAN / config configuration script, you must first enable the debhelper functions:
... / usr / share / debconf / confmodule. Also, this file must be included in the postinst script: otherwise the DEBIAN / config script will not be executed at all!
These features are available in the debconf package, don't forget to include it in dependencies!
A primitive use case. DEBIAN / config file
#! / bin / bash -e

# Connecting debconf commands

Case "$ 1" in
configure | reconfigure)
# Request


# Processing the response

greeting \u003d "$ RET"
echo "$ greeting"\u003e /etc/supersh/greeting.txt
;;
*)
echo "config called with unknown argument \\` $ 1 ""\u003e & 2
exit 1
;;
esac
# Request
db_input medium "supersh / greeting" || true # initialization
db_go || true # display the request to the screen

# Processing the response
db_get "supersh / greeting" # Get the value into the $ RET variable
greeting \u003d "$ RET"
echo "$ greeting"\u003e /etc/supersh/greeting.txt

There is already an unpleasant ambush here: note that the db_input function is passed the priority of the medium dialog. For debconf, you can set the minimum priority: dialogs with a priority below which are not displayed, but the default value (Default template) is taken! To prevent this EXACTLY from happening, we use the critical priority :) In addition, when installing from the GUI, the threshold for displaying questions is higher, and many of them are not displayed at all.
Possible priorities: low - default is always used, medium - default is usually fine, high - default is undesirable, critical - user attention is vital.
|| true is used to prevent the script from dying due to the "-e" switch passed to bash.
In this script, it is also recommended to use that blank to catch errors, otherwise you may have problems with the redistributable package when debugging :)
All the subtleties of using debconf (functions, methods, parameters, error codes) are described in a rather verbose mana: man debconf-devel.

Last but not least, when removing a package with the purge - debconf command, it must also purge the package information from its database. For example, it preserves the user's selection across db_input requests.
To clean up this data, you need to add the following to the postinst script:
if ["$ 1" \u003d\u003d "purge"] && [-e / usr / share / debconf / confmodule]; then
... / usr / share / debconf / confmodule
db_purge
fi

Putting together a package! :)

Hooray! All the necessary files have been created, they are in the necessary folders. Now it's time to build the package :)
The first thing to do is to recursively set all files in the root of the package to the user and group root: root (or others, if required). This is necessary then that the package files are packed into a tar.gz archive that preserves both the file permissions and the owner. Therefore, you need to execute:
$ sudo chown -R root: root.
However, this is not required. There is an excellent fakeroot command that, when creating an archive, will change the owner of the file with root.
In our example, the script must have an executable bit.
Then we go back to the folder so that the root folder of the package can be seen, and the package is created with a slight kick itself:
$ fakeroot dpkg-deb --build supersh
The created package must be renamed to match the naming order of * .deb packages:<имя пакета>_<версия>_<архитектура>.deb
$ mv supersh.deb supersh_1.0-1_all.deb
That's it, the package is ready!
Automatic package check
There is a lintian utility that allows you to check a package and identify common errors in its structure. This is done like this:
$ lintian supersh_1.0-1_all.deb
Installing the package
$ sudo dpkg -i supersh_1.0-1_all.deb

Create your own package repository

We now have our own package. When there are several of them, and even more so - with dependencies, it will turn out that it is much more convenient to quickly raise your own local micro-repository, and include it in the list of sources of the package manager :) Here I will describe a quick HowTo "how to create your own repository". It will be easy to develop the idea by reading the relevant documentation :)
First, let's install the helper:
$ sudo apt-get install reprepro
Description of the future repository
Repository Center - its description. The main thing in it is the list of components of the repository. We will create the "soft" and "games" components.
Select a folder for the future repository. All actions are performed from its root.
Create a conf / distributions file with the following content:
Description: my local repository
Origin: Ubuntu
Suite: testing
AlsoAcceptFor: unstable experimental
Codename: karmic
Version: 5.0
Architectures: i386 amd64 source
Components: soft games
UDebComponents: soft games

In our business of creating a simple repository, all fields do not play a fundamental role, and are used only to visually define "what is what" :)

Repository creation
The repository is described! Now let's generate a blank based on the description. The commands are executed in the root of the repository:
$ reprepro export
$ reprepro createsymlinks
And add the ready repository to /etc/apt/sources.list:
deb file: /// path / to / repo / karmic soft games
This repository can also be shared using a web server.
Package management in the repository
We put * .deb files in the root of the repository to add, and add them to the soft component of the karmic distribution:
reprepro -C soft includedeb karmic * .deb
now packages are available from package manager :)
Removing packages:
reprepro -C soft remove karmic supersh

Finish

The article covers materials for creating deb packages. The emphasis is placed on the moments for which there is no descriptive enough description on the web. I hope my attempt to present it in a simple and understandable way has not failed :)
Homework :)) - quite well documented things that are easy to find in man "s and articles:
  • Creating source packages that compile sources: using Zabbix as an example, habrauser spoke about this perfectly

How to work in Ubuntu.
Chapter 6: Package Management

Original: "Ubuntu Hacks: Chapter 6 - Package Management"
By Kyle Rankin, Jonathan Oxer, Bill Childers
Date of publication: June 2006
Translation: N. Romodanov
Date of transfer: September 2010

Use the command line capabilities to install individual .deb files in situations where other automated tools cannot be used.

Package management in Debian-based distributions is very powerful and saves a lot of wasted effort finding the latest packages and tracking down dependencies. The capabilities of automated tools such as apt-get, Synaptic and Adept are almost always sufficient for most users, and you should use them whenever possible. However, sometimes there are circumstances where you may need to directly install a package .deb.

Warning. Ubuntu uses automated package installers for a good reason. With their help, special protections are implemented to ensure that packages are compatible and that libraries are available if packages need them. If you install separate files .deb (especially those that are not packaged for a specific version of Ubuntu), you not only lose all of these benefits, you can also disable certain parts of the system due to incompatibility of libraries, overwrite files that other Ubuntu programs depend on, or add unique versions that make it difficult to update your system while it is in use. Before installing a separate package .debespecially if you're new to Ubuntu, please explore all other installation options, including using the universe and multiverse repositories [Hack # 60]. You have created your own "Ubuntu style" kernel If you are using the utility make-kpkg compiled your own kernel from source, you should end up with the package .deb, which will contain the kernel binary and files .deb for any additional module you might build (see Building Ubuntu Kernels for specific steps in this procedure [Hack # 78]). You have compiled your own package from the Ubuntu sources As with compiling the kernel, you compiled the Ubuntu source using the utility dpkgand you ended up with a separate file .debwhich you need to install manually. You want to revert to the old version of the program This situation may arise, in particular, if you are using the Ubuntu developer release. Sometimes the latest versions of developer releases have bugs. In this case, you may need to revert to a previous version of the package. One of the easiest ways to do this is to find an older version of the package. .deb (maybe in your local package cache at / var / cache / apt / archives /) and manually installing it. The program you want to install has a .deb extension, but it is not in the Ubuntu repositories Circumstances may arise where a package is missing from the Ubuntu repositories .debwhich you want to install as it is a newer package than the one offered by Ubuntu as you found a more general version of the file .deb, or a third party provided the file .deb for Ubuntu, but has not yet created its own package repository (for example, like the Opera Web in its current package).

prompt

If you find a program packaged in .deb format, then nine times out of ten there is a high probability that this program is already in one of the Ubuntu repositories. For details on additional repositories that are provided by Ubuntu and third parties, see "Changing the List of Package Repositories" [Hack # 60].

The program that you installed or updated was not completely installed due to the fact that there is another installed package that contains the same files In relatively rare cases, we have encountered situations where two packages use the same files and when one of them is updated, an error message is displayed indicating that an attempt is being made to overwrite files from the other package. In these cases, you need using the utility dpkg manually install this package using the --force option.

Installing the .deb file

Whenever, for whatever reason, you need to install the file .deb, you need to use the utility dpkg... Utility dpkg is the tool that Debian-based distributions use to install files .deb... (Even when you use automatic package management, it is actually behind the scenes in the system that you use dpkg). If you are familiar with the tool rpmused in distributions based on RPM packages, you will find that dpkg similar syntax. To install a regular file from the command line .deb, type the following:

[email protected]: ~ $ sudo dpkg -i packagename.deb

Replace packagename.deb with the filename .debwhich you want to install. If you have several files that you want to install at the same time, you can list them one by one on the command line

[email protected]: ~ $ sudo dpkg -i package1.deb package2.deb package3.deb

or use the wildcard [Hack # 13] to install all the .deb files that are in the current directory:

[email protected]: ~ $ sudo dpkg -i * .deb

Utility dpkg also has a recursive option (-R). If you have a directory full of deb files, you can install them like this:

[email protected]: ~ $ sudo dpkg -i -R / path / to / directory

and utility dpkg will recursively search and install all files .debthat are located in this directory and in all its subdirectories.

Sometimes when you install a package using the utility dpkg, the installation may fail because the package is marked as holdbecause it conflicts with another package, or it depends on other packages that are not installed, or the installation of a package tries to overwrite files belonging to another package, or for some other reason. IN dpkg there are a number of --force options you can use to ignore these issues and continue with the package installation.

Warning

The --force options are only for experts who are familiar with the package system .deb and with dependencies within the system. As a rule, the installation of packages stops for good reasons and if you are a beginner and you force the installation of a package anyway, the installation will most likely end up with a broken system for you. Therefore, use these parameters with caution.

For a complete list of --force options, type the following:

[email protected]: ~ $ dpkg --force-help

Some of the most useful options are:

Installing a package even if it is marked as hold.

Force-overwrite

Installing a package even if it might overwrite files from another package.

Print out a list of errors about missing dependencies and continue with the installation anyway.

Force-conflicts

Even if a package conflicts with another package, continue with the installation anyway.

So if you have a file .deb, which must be installed and which overwrites files from another package, and you have checked everything and decided that everything will be fine, then in order to continue, enter:

[email protected]: ~ $ sudo dpkg -i --force-overwrite packagename.deb

Removing a package

Sometimes you may need to manually remove an individual package. IN dpkg there are the -r and -P options for uninstalling the package and removing the package and cleaning up the configuration files, respectively. To remove a package, enter:

[email protected]: ~ $ sudo dpkg -r packagename

Please note that you do not specify the extension .deb the filename you may have installed before contains only the name of the package itself. When the -r option is specified, dpkg will search for and delete all files of this package, except for the configuration files, which will be left in case the program is installed again. If you want to clear the system of all files, including configuration files, use the -P option:

[email protected]: ~ $ sudo dpkg -P packagename

Third party software can be installed. For this, files with the .DEB extension are used. They are opened through the Application Center, terminal or utilities. The easiest way to do this is using the graphical interface. But users who have not worked in such an OS before will hardly be able to figure it out without instructions. On Ubuntu, installing a DEB package is slightly different from running EXE files on Windows.

For the utility to work without errors, it is better to download it from the Linux Application Center (CPU). This will give you the official software for sure. It will update itself. You can search for files on the developer's site of the program you need. Use unofficial sources as a last resort: for example, when your computer has no Internet access. Also manual DEB installation is relevant if you haven't found the utility in the CPU.

If the network is disabled on the computer, this is the only way to install drivers on it. Better to look for them on launchpad.net. Enter "Linux-Firmware" in the search bar. Next, choose your distribution and architecture.

A package needs the libraries it depends on to work. Other operating systems also have such objects. For example, on Windows, these are DLL files. When installing software from the Center, the missing add-ons will be installed automatically. And with third-party utilities, everything is not so simple. If there are no libraries, and the CPU has not loaded them, then they must be downloaded manually.

Graphical interface

The simplest thing is to install the DEB package through a graphical interface. It resembles Win Explorer. But there are still differences.


This is how you launch files through the Application Center. It often slows down and "incorrectly" opens utilities. Therefore it is better to use the console.

Terminal

Here's how to install DEB package on Ubuntu using console commands:


Other utilities

There are other utilities for downloading installers.

Gdebi

If you don't have it, download it through the terminal. Enter the command "sudo apt install gdebi". The service appears in the file context menu. It's easy to use:


You can also use the console "sudo gdebi [Path_to_directory] / [Package_name] .deb". The program will automatically download the linked libraries if the computer is connected to the Internet and they are in the repository.

Apt

This is how DEB installation on Ubuntu looks like through the Advanced Packaging Tool. It is suitable for local packages:

  1. Launch "Terminal".
  2. Go to the folder with the desired file "cd ~ / [Directory_name]". You can specify the full path in the command.
  3. And enter "sudo apt install ./ [Filename ].deb". The forward slash ("slash") means that you are referring to the current directory.
  4. Dependencies will be loaded automatically if available.

Now you know how to install DEB package on Linux Ubuntu. There are many ways. You can download programs using an intuitive interface or terminal. Additional libraries that the utility depends on must also be downloaded. As a result, you will deliver not one package, but several.