User Tools

Site Tools


etc:10-lpm-on-xubuntu

Install LPM on a Xubuntu System

In order to build and install lpm on an Xubuntu System, proceed as follows:

Needed packages

In order to retrieve and build the current lpm source code, you will need to first install the following packages:

  • gcc: the gnu C compiler
  • make: gnu make
  • flex: flex
  • libssl-dev: openssl development
  • zlib1g-dev: zlib development
  • libarchive-dev: libarchive development
  • libcurl4-openssl-dev: curl development (optional, only for lpc-http backend)
  • libfltk1.3-dev: fltk development, for fltk gui
  • yad: yad, gui dialogs, for fltk gui
  • libfl-dev: flex library

All these can easily be installed in a terminal with:

sudo apt-get install $PACKAGE_NAME

Retrieve source code

The source code can be obtained via git the following way:

git clone http://git.decentral.ch/lpm.git
cd lpm/src
git clone http://git.decentral.ch/libstuff.git stuff

Building lpm

In order to prepare the source code to build, there is a configure script. It is not based on autotools, but just a shell script. Apart from telling it the install locations, an admin group has to be specified, whose members are allowed to install and update packages. The setuid program /usr/sbin/plpm will then check for membership of this group. plpm is used by the gui to perform any privileged actions, as the gui itself does run with regular user rights. Future versions might use polkit for this.

In order to setup lpm for installling to standard locations and require users of the gui to be in group adm, call configure (in lpm/src) as follows:

./configure --prefix=/usr --sysconfdir=/etc --datadir=/var --lpm-pgroup=adm

If no pgroup is specified, wheel will be used, but as this group does not exist under xubuntu, adm or sudo are the best choices.

lpm can then be built by calling:

make

Before actually installing all the programs and scripts, you might want to check what would be installed, like this:

make DESTDIR=`pwd`/lpm-dest install
find lpm-dest

If you think this will not break your system, you can then install lpm by:

sudo make install

In order to build the fltk-based gui, just go to the subdir fltk and type:

make
sudo make install

Of course, the above DESTDIR check can be done here, too.

Initializing the lpm package repository

After having installed the programs, you then have to initialize lpm's repository. Furthermore, as lpm only allows packages signed by trusted package creators to be installed, you also have to setup yourself as a trused package creator.

First, initialize lpm's local package repository as root, by the following command:

lpm-adm -B -o dist_name=Xubuntu,dist_vers=22.04,lpc_backend=lpc-dirs.so

This will initialize the repository under /var/lib/lpm, set the distro name and version to Xubuntu 22.04 and tell lpm to use the directory-based package catalogue to search for new packages and updates to installed packages.

The next step then is to setup your package signing certificate and key and export it for registering in lpm.

As the user who will create packages (not root!), call

lpk-gen -K

You will then be asked for your name and email address, and a password to protect the private key. This key and certificate will then be used to sign any packages by lpk-gen, and would then also ask you for the key's password everytime. If you don't want to enter your password for every package generation (which you probably want), unlock your key as follows:

cd ~/.lpm
mv lpk-gen.key lpk-gen.enc
openssl rsa -in lpk-gen.enc -out lpk-gen.key

This will then prompt you once for the key's password and then store the key unencrypted.

To export your certificate for registration in lpm, call

lpk-gen -X

This will then export the certificate as a file in the local directory, and tell you the name of the file, e.g. $CERTHASH.crt . You can then register it in lpm by calling:

sudo lpm-key -A $CERTHASH.crt

Setting up the sample wnb packages

In order to test the functionality of lpm, the subdirectory “wnb” under src/lpm contains a couple of simple example package definitions that will only install some harmless shell scripts under /opt/wnb. In order to use them, you first have to register the wnb directory as your package catalogue.

For this, find out the full path of the directory and then, as root, type:

echo /full/path/of/the/wnb/directory> /etc/lpc-dirs.conf

You can then leave root and go back to the direcory, and create the packages by typing:

./genlpk.sh

This will produce some output and then should have created some some packages with the suffix .lpk

If eveything is fine, you can then list the available packages for installation by calling:

lpm -S

In order to then install the package “beer” with all its dependencies, call

sudo lpm -I beer

You can then also check the gui (xlpm), which should show you the same stuff.

In order to create newer versions of the package (so you can check the update functionality), just edit the corresponding $PACKAGE.defs file, increase the version number and call ./genlpk.sh again.

etc/10-lpm-on-xubuntu.txt · Last modified: by wikiadmin