How to make Debian package install dependencies? - linux

I want to make a simple Debian package to install a simple tool that depends on Qt4 libs.
In control file I have defined that it depends on Qt4 libs however, by the time I'm testing the package it says that the dependency could not be met.
Question:
How can I make Debian trigger apt to install the dependencies as well?
Can't find that the documentation however I know that apt-get does that.

If you want to avoid creating a local APT repository, you can do:
dpkg -i mypackage.deb
apt-get install --fix-missing
If you do want to create a local repository, you can use reprepro for this.

If you install it via dpkg it won't work because dkpg doesn't know where to find additional dependencies. You could do it via apt-get if you build your own repo, but it's kind of time-consuming the first time (it's not difficult, just something "new" the first time that needs some time to be learnt).
On the other hand, and the solution you are probably looking for is gdebi (you may need to install it: apt-get install gdebi-core). It's a tool that checks the dependencies for a package and calls apt-get to fetch and install them, and then calls dpkg to install your package.

Per #textshell in this answer:
starting with apt 1.1 (available in Xenial (16.04), stretch) apt install also allows local files:
sudo apt install ./foo-1.2.3.deb
So much simpler and cleaner.
See the release
announcment
This will also install dependencies, just like a normal apt install or apt-get install.

If you're creating the Debian package, you specify its dependencies in the debian/ directory control files; I believe debian/control takes Depends: directives for that purpose.
I don't know the details too clearly, myself, but there are instructions at http://www.debian.org/doc/manuals/maint-guide/ ; in particular, http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#control seems to be the right place to start looking.

One way would be to create a local package repository on your computer and add it to /etc/apt/sources.list. Then you could install the package from your local repository with apt-get and have the dependencies resolved automatically.
There's probably an easier way to do it, but I don't know what that would be.

Related

RPM package requirements in a special order

I am facing the problem, that I need to install two other RPM's in a special order before installing myRPM.
In detail in my RPM I install some config files for sudo and ldap. So, I need these packages to be installed first Requires(pre). Although the pre required package sudo has a required file in /usr/bin/.
This file will be installed with the ldap package.
So, I need the ldap package to be installed first, then sudo and at least myRPM.
My spec file has:
Requires(pre): myldap_rpm sudo
But yum is not going to install the package because sudo needs ldap first. Yum seems to check the dependencies of the pre-required sudo package before installing myldap_rpm
Is there any chance to resolve this???
Thanks a lot in advance for sharing your ideas and knowledge.
requires(pre) is a scriptlet dependency. This means that dependency (eg sudo) is only required to run the %pre script. When your package is installed sudo can then safely be uninstalled. This is not what you want here.
Afaik you cannot change the dependencies of other packages. You can tell what your package depends on, and those dependencies will be installed before your package, but you cannot insert a myldap_rpm dependency to sudo.
Probably you don't need to reinstall sudo though, probably it would suffice to run some kind of "reload" or "configuration" step after the installation of myldap_rpm.

Ubuntu Linux - Install Packages from Local Repository

We (my workplace) have an embedded product based around an NVIDIA TK1 which is running a custom build of Ubuntu for ARM. As part of the setup routine for our product, we have a custom script which downloads a large number of packages and archives from the web, extracts and installs them.
Ideally what we are looking to do is to pre-download these packages and archives into a "local" repository so that our product uses known versions which work with our application. Auto-updating of packages is disabled and the end product will rarely have access to the internet anyway, we just want to ensure that the versions of packages used remains the same for EVERY product shipped.
As an example, here are parts of the update script:
sudo apt-get install -y linux-firmware
sudo apt-get install -y '.*libxcb.*' libxrender-dev libxi-dev libfontconfig1-dev libudev-dev libx11-dev libx11-xcb-dev libext-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
sudo apt-get install -y gcc-4.9 g++-4.9
sudo apt-get install -y ros-indigo-desktop
# This one is shortened as its a long URL
wget cuda-repo-l4t-r21.1-6-5-prod_6.5-14_armhf.deb
sudo dpk -i cuda-repo-l4t-r21.1-6-5-prod_6.5-14_armhf.deb
Obviously, a large number of the packages will have a lot of dependencies so if there is a way of downloading ALL required packages and ALL required dependencies into a local package repository and change my scripts so they are installed from there, that would the ideal.
I'm unsure as which way would be the best way to approach this.
I have had suggestions of installing all packages onto a base product then "cloning" the file system and pushing it onto other modules however I don't really know the pros/cons of doing this.
UPDATE
Ok, so I've since found a large number of packages in the /var/cache/apt/archives/ folder which seem to all relate to what is installed from our script.
Is it feasible/safe to install ALL of these packages using sudo dpkg -i *.deb?
A good thing would be to use some kind of debootstrap to build a custom image and then flash it on the devices.
To cache the apt-get there is apt-cacher. I haven't tried, but its cache can be freezed.
For the local repositories - reprepro.

gcc-4.7 with Debian 8 Jessie

I use debian 8 Jessie, which has only gcc-4.9 available in the repositories. I tried to install gcc-4.7 in two ways without success.
First try
I tried installing gcc manually by downloading the file gcc-4.7.0.tar.gz
But when I install the dependency libraries (apt-get install Libmpc-dev libmpfr-dev libgmp-dev gcc-multilib)
the Debian installs, without asking gcc-4.9 and the compatible libraries with gcc-4.9.
I try run make for manual installation, but errors occur and it is not possible to install manually.
Second Try
I tried adding PPA repositories with gcc-4.7, in the file /etc/apt/sourc.list
Add-apt-repository ppa: ubuntu-toolchain-r / test as it teaches in this Link: https://askubuntu.com/questions/193513/problem-adding-a-ppa-to-install-gcc-4-7
When try apt-get install gcc-4.7 you are prompted to install several Dependencies ... when requesting to install the dependencies, the Below.
Root # vmhp110deb8: / home / user1 # apt-get install gcc-4.7 gcc-4.7-base
Reading package lists ... Done
Building dependency tree
Reading state information ... Done
Note, by selecting 'gcc-4.7-base' for regex 'gcc-4.7'
Package gcc-4.7-base is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
Is available from another source
E: Package 'gcc-4.7-base' has no installation candidate
Root # vmhp110deb8: / home / user1 # add-apt-repository ppa: ubuntu-toolchain-r / test
I tried to find a repository that has gcc-4.7-base, but then it asks Installation of other dependencies, and informs that it has not found
Libraries are Obsolete, etc.
Attempt not yet tested
Another idea that i had is download the Debian 7 Wheezy DVD (which I think Which has gcc-4.7 and all dependencies) and add as repository, For debian to find all dependencies of gcc.4.7 on DVD. But this idea i not have tested yet.
Could anyone help me with how I could install gcc 4.7 on debian 8?
As you can read here
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=765379
gcc-4.7 is not included in Debian Jessie
Maybe you can try this
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.7
EDIT : You already tries this. I didnt notice.
Try this manual:
http://charette.no-ip.com:81/programming/2011-12-24_GCCv47/
I hope this helps to you :)

Linux: How to install certain old version of a software via apt-get

I am trying to install the same versions of Apache, MySQL and PHP in my Linux PC (Raspberry Debian) as installed in my remote public server.
For instance, I'd like to install the last legacy release of the 2.2 branch, Apache/2.2.31.
apt-cache showpkg apache2
Output:
Package: apache2
Versions:
2.4.10-10+deb8u4 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_jessie_main_binary-armhf_Packages)
But there isn't any information about the 2.2.31 version, neither in "Reverse Provides" section. I can do it by compiling from the sources, but it takes a lot of time. And I tried to find a reliable PPA or a reliable sources for deb packages, without any success.
How can I do it?
If APT tracks the specific version you are looking for, (like Kyle said) then it's pretty easy.
sudo apt-get install <pkg_name>=<pkg_version>
or
sudo apt-get -t=<target_version> <pkg_name>
To see which packages are tracked, run
apt-cache showpkg <package_name>
Unfortunately though, if a particular version is not managed by the APT, then you are out of luck using APT. It might be managed by some of the other package managers out there.
Ref. How can I downgrade a package via apt-get?
If you have the version number, or the target release, apt-get supports choosing a particular version or target release. More details can be found on manual page of apt-get. It can also be accessed from a terminal by typing man apt-get.
sudo apt-get install <package-name>=<package-version-number>
or
sudo apt-get -t=<target release> install <package-name>

Downloading 'Yum groupinstall "development tools"'?

I've looked all over and build essentials are all I see that was replaced by Development tools. When I type the command I receive "no such command".
What is the alternative to this?
apt-get build-dep package-i-want-to-build to get everything you need to build package - often the easiest way to get the dev tools is to pick a sufficiently complicated package like pidgin and run this
or
apt-get install build-essential to just get a compiler
Ubuntu doesn't use yum. You still want to use the apt instructions.
Debian, Ubuntu, Mint, etc. have APT package manager, not YUM. In these OSes you generally need to do following to install basic development tools, like C and C++ compilers, binutils, etc:
sudo apt install build-essential

Resources