Sign in Join
Wiki copytemporary

How to setup a FPC and Lazarus Ubuntu repository: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: How to setup a FPC and Lazarus Ubuntu repository

OldNewLine
1+*(Ubuntu only)*
2+
3+## Beware downloaders!
4+
5+If you only want to download Lazarus, then go to our [[Lazarus release version for Ubuntu|Ubuntu repository]].
6+
7+This page describes how to setup a repository yourself, it's not meant for normal users.
8+
9+## What is a repository?
10+
11+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.
12+
13+## Who needs it?
14+
15+Administrators who wants to install FPC+Lazarus on a pool of computers. Like in school. Or newbies who just want to quickly test it.
16+
17+## The directory structure
18+
19+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.
20+
21+Create a sub directory for each target you want to support:
22+
23+``` bash
24+mkdir -p /var/www/lazarus/dists/lazarus-testing/universe/binary-i386
25+mkdir -p /var/www/lazarus/dists/lazarus-testing/universe/binary-amd64
26+```
27+
28+## The debs
29+
30+Put the fpc, fpc-src and lazarus deb files into it.
31+
32+### Creating the deb files yourself
33+
34+You can create the debs with the scripts in tools/install/ of the lazarus sources.
35+
36+#### Install development packages
37+
38+- install development packages:
39+
40+``` bash
41+sudo apt-get install libgtk2.0-dev libgtk1.2-dev libgdk-pixbuf-dev libgpmg1-dev fakeroot libncurses5-dev
42+```
43+
44+- Install the latest stable FPC. This is needed to build the new FPC and Lazarus:
45+
46+Either the deb files from the official site or the tar.gz. e.g.:
47+
48+``` bash
49+sudo apt-get install fp-compiler
50+```
51+
52+- Download the FPC sources. To get the current development version you can use the command below. To get a more stable version, see [[Installing Lazarus|Installing_Lazarus#FPC Sources]]:
53+
54+``` bash
55+svn co http://svn.freepascal.org/svn/fpc/trunk fpc
56+```
57+
58+- Download the lazarus sources:
59+
60+``` bash
61+svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus
62+```
63+
64+#### Build new deb
65+
66+- go into the lazarus install script directory:
67+
68+``` bash
69+cd lazarus/tools/install
70+```
71+
72+- build the fpc deb. The following script will build a single fpc deb using the date as version. As parameter you must specify the path of the FPC sources you downloaded above:
73+
74+``` bash
75+sudo ./create_fpc_deb.sh fpc /path/to/the/sources/of/fpc/
76+```
77+
78+- install the new fpc deb. This is needed to build the lazarus deb, which depends on the new fpc deb. Don't forget to uninstall first your old FPC.
79+
80+``` bash
81+sudo dpkg -i fpc_2.2.5-090517_i386.deb
82+```
83+
84+- build the fpc-src deb. This works pretty much the same as above (parameter fpc-src instead of fpc):
85+
86+``` bash
87+./create_fpc_deb.sh fpc-src /path/to/the/sources/of/fpc/
88+```
89+
90+- build the lazarus deb. You can either build a normal lazarus using gtk2:
91+
92+``` bash
93+./create_lazarus_deb.sh append-revision
94+```
95+
96+or a lazarus using gtk1:
97+
98+``` bash
99+./create_lazarus_deb.sh gtk1 append-revision
100+```
101+
102+- To test the lazarus package you can install the new fpc-src deb and the new lazarus deb with:
103+
104+``` bash
105+sudo dpkg -i fpc-src_2.2.5-090517_i386.deb lazarus_0.9.27.20004-0_i386.deb
106+```
107+
108+#### Replace the deb files in the repository
109+
110+Now you have 3 deb files.
111+
112+You can install them directly, but first un-install the build version
113+
114+- If you installed fp-compiler you will need to:
115+
116+``` bash
117+dpkg -r fp-compiler fp-units-rtl fp-compiler
118+```
119+
120+- Copy them to your repository:
121+
122+``` bash
123+cp fpc_2.3.1-070726_i386.deb fpc-src_2.3.1-070726_i386.deb lazarus_0.9.23.11636-0_i386.deb \
124+/var/www/lazarus/dists/lazarus-testing/universe/binary-i386/
125+```
126+
127+- Don't forget to remove the old ones.
128+
129+## PGP Key
130+
131+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.
132+
133+### Creating a PGP key
134+
135+You can use tools like seahorse or thunderbird to create the PGP key.
136+
137+- Install seahorse
138+- start seahorse
139+- Key \> Create new key
140+- A window popup up asking for the type. Choose *PGP Key*.
141+- Give a full name and an email adress and click *Create*.
142+- The passphrase is needed to encrypt the created files. This way no one can use the keys but you, even if they manage to steal your files. If you think, your files will never stolen or read by others you can leave them empty.
143+- Creating the keys will take some minutes
144+
145+### Upload the key to a public key server
146+
147+In order to share the key you can upload the key to a public key server.
148+
149+- start seahorse
150+- Edit \> Preferences \> Key servers \> Publish key to: choose a key server. For example: hkp://pgp.mit.edu:11371. Close the dialog.
151+- Remote \> Sync and publish key \> Sync.
152+
153+### Remember the key ID
154+
155+You need the key ID later. The key ID is shown in seahorse. But you can see it also via:
156+
157+``` bash
158+gpg --list-keys
159+```
160+
161+## Updating repository files
162+
163+Put the following script into /var/www/lazarus, edit it for your needs and run it:
164+
165+``` bash
166+#!/usr/bin/env bash
167+
168+set -x
169+
170+GPGHome=/home/gaertner/.gnupg/
171+MainDir=dists/lazarus-testing
172+
173+for Arch in i386 amd64; do
174+ Dir=$MainDir/universe/binary-$Arch
175+
176+ # create index
177+ apt-ftparchive packages $Dir > $Dir/Packages
178+ cat $Dir/Packages | gzip -9c > $Dir/Packages.gz
179+ cat $Dir/Packages | bzip2 > $Dir/Packages.bz2
180+done
181+
182+# create Release file
183+rm -f $MainDir/Release*
184+Date=`date`
185+echo "Origin: Lazarus" >> $MainDir/Release
186+echo "Label: Lazarus" >> $MainDir/Release
187+echo "Suite: unstable" >> $MainDir/Release
188+echo "Codename: lazarus-testing" >> $MainDir/Release
189+echo "Version: 1.0" >> $MainDir/Release
190+echo "Date: $Date" >> $MainDir/Release
191+echo "Architectures: amd64 i386" >> $MainDir/Release
192+echo "Components: universe" >> $MainDir/Release
193+echo "Description: Lazarus testing 1.0" >> $MainDir/Release
194+
195+apt-ftparchive release $MainDir >> $MainDir/Release
196+
197+# sign Release file
198+gpg --sign --homedir=$GPGHome -ba -o $MainDir/Release.gpg $MainDir/Release
199+
200+# end.
201+```
202+
203+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*).
204+
205+## Adding the repository to a client
206+
207+*IMPORTANT*: If you only came here to download lazarus for ubuntu/debian then use the stable repository [[Getting Lazarus|Ubuntu repository]]. The repository below is an unstable, testing repository.
208+
209+The following steps must be done on each computer, you want to use your repository.
210+
211+### Add the key
212+
213+Download the key from the public key server:
214+
215+``` bash
216+gpg --keyserver hkp://pgp.mit.edu:11371 --recv-keys 3A5B1204
217+```
218+
219+The 3A5B1204 should be replaced with your key id. Check the output, that you got the right key.
220+
221+Add it to the apt system:
222+
223+``` bash
224+gpg --export 3A5B1204 | sudo apt-key add -
225+```
226+
227+You can see the list of apt keys with:
228+
229+``` bash
230+sudo apt-key list
231+```
232+
233+### Add the repository
234+
235+You can use synaptic for this or edit the /etc/apt/sources.list directly. Add the line:
236+
237+``` bash
238+deb http://progprak.scale.uni-koeln.de/lazarus/ lazarus-testing universe
239+```
240+
241+Replace the http path with your own.
242+
243+## Install Lazarus
244+
245+For example:
246+
247+``` bash
248+sudo apt-get update
249+sudo apt-get install lazarus
250+```
251+
252+---
253+*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](/wiki-contact).*
254+Category: Ubuntu

Back to history