I installed a program by getting its source code, and then running `sudo make install`; how to make `apt-get` know about it?
I installed program (call it, for example,progA
) by building it from source code, and then finally calling sudo make install
and sudo ldconfig
.
However, it seems apt-get
hasn't gotten the memo, because when installing progB
, which depends on progA
, apt-get
recommends I also install progA
. Why is this, and what could I do?
TL;DR checkinstall
is your friend ;)
sudo apt-get install checkinstall
After a installation with sudo make install
your package manager knows absolutely nothing about this installation. But it knows all about a package with the same name in the Ubuntu repositories or in a PPA.
Use sudo checkinstall
instead of sudo make install
and use a higher version as the version in the repository to be sure, that your package manager accepts this version as correct dependency for ProgB
.
Further information:
checkinstall
is really nifty, since it follows what the make install
command would do, in order to figure out how to build a package.
This means that if you install a program using make install
, but then want to repent for your sins, all you have to do is sudo checkinstall -D make install
, and that command will:
follow
make install
to figure out what it doescopy-cat
make install
, except in *.deb package forminstall from the package (exactly as
make install
would have, given point 1)) except also letapt-get
know about it, and thus overwrite all the files exactly wheremake install
would have put them as long as you choose YES to include the files put bymake install
in the home directory in the package as well -- a couple of options during thecheckinstall
process will let you choose (obviously though, the choice is there so you can exercise it on a case-to-case basis)
Bonus: you can also remove a package (call it progA
again) installed using make install
that odes not have make uninstall
support by following the checkinstall
process outlined so far, and then simply doing:
dpkg -r progA
Three options:
create a fake package for
progA
: How to fake a package version installed? (there is an extensive example for TeXlive).create a package for
progA
, easier if it has acheckinstall
option: How to trick apt dependencies?Build also
progB
from sources.
I'd recommend using uupdate
from devscripts
and build the package like the original was build before.
Install required packages
$ sudo apt-get install build-essential devscripts
Download the the old package from official repository (will use MediaWiki
as example) and the new tar-ball from upstream.
$ mkdir ~/Downloads/mediawiki
$ cd ~/Downloads/mediawiki
$ apt-get source mediawiki
$ wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.0.tar.gz
Run uupdate
to create a new source folder from the upstream tar-ball and the old debian/control
$ cd mediawiki-1.19.14+dfsg # depends on your Ubuntu version
$ uupdate ../mediawiki-1.26.0.tar.gz 1.26.0
$ cd ../mediawiki-1.26.0
Now you should check if you need to make changes to debian/control
etc files. If you're done you can build the deb package and install it
$ dpkg-buildpackage -us -uc
$ cd ..
$ sudo dpkg -i *.deb