Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

How to setup a FPC and Lazarus Ubuntu repository

English · Français · Português · Slovenčina · Русский · 日本語

(Ubuntu only)

Beware downloaders!

If you only want to download Lazarus, then go to our Ubuntu repository.

This page describes how to setup a repository yourself, it's not meant for normal users.

What is a repository?

A ubuntu repository is a directory. It can be stored on the lokal disk, or on a webserver or on a ftp server. To use it, you add its path into your /etc/apt/sources.list and setup a pgp key. Then you can simply install lazarus with your favourite package gui (e.g. synaptic) and fpc, fpc-src and lazarus will be downloaded, installed and updated automatically.

Who needs it?

Administrators who wants to install FPC+Lazarus on a pool of computers. Like in school. Or newbies who just want to quickly test it.

The directory structure

Let's assume you want create a repository available via the apache webserver. Then you need to setup a directory like /var/www/lazarus that is public readable and only writable by root.

Create a sub directory for each target you want to support:

bash
mkdir -p /var/www/lazarus/dists/lazarus-testing/universe/binary-i386
mkdir -p /var/www/lazarus/dists/lazarus-testing/universe/binary-amd64

The debs

Put the fpc, fpc-src and lazarus deb files into it.

Creating the deb files yourself

You can create the debs with the scripts in tools/install/ of the lazarus sources.

Install development packages

bash
sudo apt-get install libgtk2.0-dev libgtk1.2-dev libgdk-pixbuf-dev libgpmg1-dev fakeroot libncurses5-dev

Either the deb files from the official site or the tar.gz. e.g.:

bash
sudo apt-get install fp-compiler
bash
svn co http://svn.freepascal.org/svn/fpc/trunk fpc
bash
svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus

Build new deb

bash
cd lazarus/tools/install
bash
sudo ./create_fpc_deb.sh fpc /path/to/the/sources/of/fpc/
bash
sudo dpkg -i fpc_2.2.5-090517_i386.deb
bash
./create_fpc_deb.sh fpc-src /path/to/the/sources/of/fpc/
bash
./create_lazarus_deb.sh append-revision

or a lazarus using gtk1:

bash
./create_lazarus_deb.sh gtk1 append-revision
bash
sudo dpkg -i fpc-src_2.2.5-090517_i386.deb lazarus_0.9.27.20004-0_i386.deb

Replace the deb files in the repository

Now you have 3 deb files.

You can install them directly, but first un-install the build version

bash
dpkg -r fp-compiler fp-units-rtl fp-compiler
bash
cp fpc_2.3.1-070726_i386.deb fpc-src_2.3.1-070726_i386.deb lazarus_0.9.23.11636-0_i386.deb \
/var/www/lazarus/dists/lazarus-testing/universe/binary-i386/

PGP Key

You need to sign the debs with a PGP key, so that the target systems can be sure, that no evil-doer replaced the files.

Creating a PGP key

You can use tools like seahorse or thunderbird to create the PGP key.

Upload the key to a public key server

In order to share the key you can upload the key to a public key server.

Remember the key ID

You need the key ID later. The key ID is shown in seahorse. But you can see it also via:

bash
gpg --list-keys

Updating repository files

Put the following script into /var/www/lazarus, edit it for your needs and run it:

bash
#!/usr/bin/env bash

set -x

GPGHome=/home/gaertner/.gnupg/
MainDir=dists/lazarus-testing

for Arch in i386 amd64; do
  Dir=$MainDir/universe/binary-$Arch

  # create index
  apt-ftparchive packages $Dir > $Dir/Packages
  cat $Dir/Packages | gzip -9c > $Dir/Packages.gz
  cat $Dir/Packages | bzip2 > $Dir/Packages.bz2
done

# create Release file
rm -f $MainDir/Release*
Date=`date`
echo "Origin: Lazarus" >> $MainDir/Release
echo "Label: Lazarus" >> $MainDir/Release
echo "Suite: unstable" >> $MainDir/Release
echo "Codename: lazarus-testing" >> $MainDir/Release
echo "Version: 1.0" >> $MainDir/Release
echo "Date: $Date" >> $MainDir/Release
echo "Architectures: amd64 i386" >> $MainDir/Release
echo "Components: universe" >> $MainDir/Release
echo "Description: Lazarus testing 1.0" >> $MainDir/Release

apt-ftparchive release $MainDir >> $MainDir/Release

# sign Release file
gpg --sign --homedir=$GPGHome -ba -o $MainDir/Release.gpg $MainDir/Release

# end.

This will create index files Packages, Packages.bz2 and Packages.gz. And it will create the Release file containing the checksums of the deb packages and sign it (Release.gpg).

Adding the repository to a client

IMPORTANT: If you only came here to download lazarus for ubuntu/debian then use the stable repository Ubuntu repository. The repository below is an unstable, testing repository.

The following steps must be done on each computer, you want to use your repository.

Add the key

Download the key from the public key server:

bash
gpg --keyserver hkp://pgp.mit.edu:11371 --recv-keys 3A5B1204

The 3A5B1204 should be replaced with your key id. Check the output, that you got the right key.

Add it to the apt system:

bash
gpg --export 3A5B1204 | sudo apt-key add -

You can see the list of apt keys with:

bash
sudo apt-key list

Add the repository

You can use synaptic for this or edit the /etc/apt/sources.list directly. Add the line:

bash
deb http://progprak.scale.uni-koeln.de/lazarus/ lazarus-testing universe

Replace the http path with your own.

Install Lazarus

For example:

bash
sudo apt-get update
sudo apt-get install lazarus

From the Free Pascal wiki, page "How to setup a FPC and Lazarus Ubuntu repository", as it stood on 2015-01-06 after a change by Jwdietrich, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .