Answer the question
In order to leave comments, you need to log in
How to build an installation package on Linux for Linux?
I wrote a program in python, it uses third-party libraries, I installed them through pip, how to make an installation package, so that the user would download this package from the link and install python with the required version, the program itself, the libraries for it, the icon appeared for programs?
Answer the question
In order to leave comments, you need to log in
0) It is advisable to pack everything in virtuelenv if you are using pip. Or use standard system packages.
1) Create a directory for your package, for example myservice-0.001
2) Throw all your sources into this directory, set the paths as you will have them on the target system
For example:
etc/systemd/system/myservice.service
opt/myservice/...
opt/.myservice-venv/...
usr/bin/myservice
[email protected]:~/xxx-2.40# cat DEBIAN/control
Package: xxx
Version: 2.40
Section: custom
Priority: optional
Architecture: all
Essential: no
Installed-Size: 171700
Maintainer: xxx.ru
Description: XXX DS system
Depends: samba, isc-dhcp-server, python-twisted, libdate-manip-perl, libio-socket-multicast-perl
Replaces: isc-dhcp-server, samba
Recommends: sudo, vim, nano
[email protected]:~/xxx-2.40# cat DEBIAN/postinst
#!/bin/sh
# postinst script for webpy-example
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
# source debconf library
. /usr/share/debconf/confmodule
case "$1" in
configure)
adduser --quiet --system --home /inbox xxx || echo "User xxx existed!"
usermod -p yyyy xxx
(echo new123; echo new123) | smbpasswd -as xxx
smbpasswd -e xxx
systemctl enable xxx
systemctl start xxx
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
db_stop
exit 0
Look, if you need direct full automation, PIP is not the most convenient option. You will have to switch to packages that are standard for the operating system (.deb, .rpm, ...).
In this case, even the Python packages themselves are best converted into standard packages. It's very easy to do this:
pip install stdeb
(example for django-haystack package)
/usr/local/bin/pypi-install django-haystack --release=2.6.1 --verbose=5 --keep
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question