How to setup a FPC and Lazarus Ubuntu repository/pt: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | ## O que é um repositório? | |
| 2 | 2 | ||
| 3 | 3 | Um repositório Ubuntu é um diretório. Ele pode ser guardado num disco local ou em um servidor Web ou FTP. 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. | |
| 4 | 4 | ||
| 5 | 5 | ## Who needs it? | |
| 6 | 6 | ||
| 7 | 7 | Administrators who wants to install FPC+Lazarus on a pool of computers. Like in school. Or newbies who just want to quickly test it. | |
| 8 | 8 | ||
| 9 | 9 | ## The directory structure | |
| 10 | 10 | ||
| 11 | 11 | 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. | |
| 12 | 12 | ||
| 13 | 13 | Create a sub directory for each target you want to support: | |
| 14 | 14 | ||
| 15 | - | ||
| 16 | - | ||
| 15 | + | ``` pascal | |
| 16 | + | mkdir -p /var/www/lazarus/dists/lazarus-testing/universe/binary-i386 | |
| 17 | + | mkdir -p /var/www/lazarus/dists/lazarus-testing/universe/binary-amd64 | |
| 18 | + | ``` | |
| 17 | 19 | ||
| 18 | 20 | ## The debs | |
| 19 | 21 | ||
| 20 | 22 | Put the fpc, fpc-src and lazarus deb files into it. | |
| 21 | 23 | ||
| 22 | 24 | ### Creating the deb files yourself | |
| 23 | 25 | ||
| 24 | 26 | You can create the debs with the scripts in tools/install/ of the lazarus sources. | |
| 25 | 27 | ||
| 26 | 28 | #### Install development packages | |
| 27 | 29 | ||
| 28 | 30 | - install development packages: | |
| 29 | 31 | ||
| 30 | - | ||
| 32 | + | ```text | |
| 33 | + | sudo apt-get install libgtk2.0-dev libgtk1.2-dev libgdk-pixbuf-dev libgpmg1-dev fakeroot libncurses5-dev | |
| 34 | + | ``` | |
| 31 | 35 | ||
| 32 | 36 | - Install the latest stable FPC. This is needed to build the new FPC and Lazarus: | |
| 33 | 37 | ||
| 34 | - | ||
| 38 | + | ```text | |
| 39 | + | Either the deb files from the official site or the tar.gz. | |
| 40 | + | ``` | |
| 35 | 41 | ||
| 36 | 42 | - 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]]: | |
| 37 | 43 | ||
| 38 | - | ||
| 44 | + | ```text | |
| 45 | + | svn co http://svn.freepascal.org/svn/fpc/trunk fpc | |
| 46 | + | ``` | |
| 39 | 47 | ||
| 40 | 48 | - Download the lazarus sources: | |
| 41 | 49 | ||
| 42 | - | ||
| 50 | + | ```text | |
| 51 | + | svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus | |
| 52 | + | ``` | |
| 43 | 53 | ||
| 44 | 54 | #### Build new deb | |
| 45 | 55 | ||
| 46 | 56 | - go into the lazarus install script directory: | |
| 47 | 57 | ||
| 48 | - | ||
| 58 | + | ```text | |
| 59 | + | cd lazarus/tools/install | |
| 60 | + | ``` | |
| 49 | 61 | ||
| 50 | 62 | - 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: | |
| 51 | 63 | ||
| 52 | - | ||
| 64 | + | ```text | |
| 65 | + | sudo ./create_fpc_deb.sh fpc /path/to/the/sources/of/fpc/ | |
| 66 | + | ``` | |
| 53 | 67 | ||
| 54 | 68 | - 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. | |
| 55 | 69 | ||
| 56 | - | ||
| 70 | + | ```text | |
| 71 | + | sudo dpkg -i fpc_2.3.1-070726_i386.deb | |
| 72 | + | ``` | |
| 57 | 73 | ||
| 58 | 74 | - build the fpc-src deb. This works pretty much the same as above: | |
| 59 | 75 | ||
| 60 | - | ||
| 76 | + | ```text | |
| 77 | + | ./create_fpc_deb.sh fpc-src /path/to/the/sources/of/fpc/ | |
| 78 | + | ``` | |
| 61 | 79 | ||
| 62 | 80 | - build the lazarus deb. You can either build a normal lazarus: | |
| 63 | 81 | ||
| 64 | - | ||
| 82 | + | ```text | |
| 83 | + | ./create_lazarus_deb.sh append-revision | |
| 84 | + | ``` | |
| 65 | 85 | ||
| 66 | 86 | or a lazarus using gtk2: | |
| 67 | 87 | ||
| 68 | - | ||
| 88 | + | ```text | |
| 89 | + | ./create_lazarus_deb.sh gtk2 append-revision | |
| 90 | + | ``` | |
| 69 | 91 | ||
| 70 | 92 | #### Replace the deb files in the repository | |
| 71 | 93 | ||
| 72 | 94 | - Now you have 3 deb files. Copy them to your repository: | |
| 73 | 95 | ||
| 74 | - | ||
| 75 | - | ||
| 96 | + | ``` pascal | |
| 97 | + | cp fpc_2.3.1-070726_i386.deb fpc-src_2.3.1-070726_i386.deb lazarus_0.9.23.11636-0_i386.deb \ | |
| 98 | + | /var/www/lazarus/dists/lazarus-testing/universe/binary-i386/ | |
| 99 | + | ``` | |
| 76 | 100 | ||
| 77 | 101 | - Don't forget to remove the old ones. | |
| 78 | 102 | ||
| 79 | 103 | ## PGP Key | |
| 80 | 104 | ||
| 81 | 105 | 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. | |
| 82 | 106 | ||
| 83 | 107 | ### Creating a PGP key | |
| 84 | 108 | ||
| 85 | 109 | You can use tools like seahorse or thunderbird to create the PGP key. | |
| 86 | 110 | ||
| 87 | 111 | - Install seahorse | |
| 88 | 112 | - start seahorse | |
| 89 | 113 | - Key \> Create new key | |
| 90 | 114 | - A window popup up asking for the type. Choose *PGP Key*. | |
| 91 | 115 | - Give a full name and an email adress and click *Create*. | |
| 92 | 116 | - 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. | |
| 93 | 117 | - Creating the keys will take some minutes | |
| 94 | 118 | ||
| 95 | 119 | ### Upload the key to a public key server | |
| 96 | 120 | ||
| 97 | 121 | In order to share the key you can upload the key to a public key server. | |
| 98 | 122 | ||
| 99 | 123 | - start seahorse | |
| 100 | 124 | - Edit \> Preferences \> Key servers \> Publish key to: choose a key server. For example: hkp://pgp.mit.edu:11371. Close the dialog. | |
| 101 | 125 | - Remote \> Sync and publish key \> Sync. | |
| 102 | 126 | ||
| 103 | 127 | ### Remember the key ID | |
| 104 | 128 | ||
| 105 | 129 | You need the key ID later. The key ID is shown in seahorse. But you can see it also via: | |
| 106 | 130 | ||
| 107 | - | ||
| 131 | + | ```text | |
| 132 | + | gpg --list-keys | |
| 133 | + | ``` | |
| 108 | 134 | ||
| 109 | 135 | ## Updating repository files | |
| 110 | 136 | ||
| 111 | 137 | Put the following script into /var/www/lazarus, edit it for your needs and run it: | |
| 112 | 138 | ||
| 113 | 139 | #!/usr/bin/env bash | |
| 114 | 140 | ||
| 115 | 141 | set -x | |
| 116 | 142 | ||
| 117 | 143 | GPGHome=/home/gaertner/.gnupg/ | |
| 118 | 144 | MainDir=dists/lazarus-testing | |
| 119 | 145 | ||
| 120 | 146 | for Arch in i386 amd64; do | |
| 121 | 147 | Dir=$MainDir/universe/binary-$Arch | |
| 122 | 148 | ||
| 123 | 149 | # create index | |
| 124 | 150 | apt-ftparchive packages $Dir > $Dir/Packages | |
| 125 | 151 | cat $Dir/Packages | gzip -9c > $Dir/Packages.gz | |
| 126 | 152 | cat $Dir/Packages | bzip2 > $Dir/Packages.bz2 | |
| 127 | 153 | done | |
| 128 | 154 | ||
| 129 | 155 | # create Release file | |
| 130 | 156 | rm -f $MainDir/Release* | |
| 131 | 157 | Date=`date` | |
| 132 | 158 | echo "Origin: Lazarus" >> $MainDir/Release | |
| 133 | 159 | echo "Label: Lazarus" >> $MainDir/Release | |
| 134 | 160 | echo "Suite: unstable" >> $MainDir/Release | |
| 135 | 161 | echo "Codename: lazarus-testing" >> $MainDir/Release | |
| 136 | 162 | echo "Version: 1.0" >> $MainDir/Release | |
| 137 | 163 | echo "Date: $Date" >> $MainDir/Release | |
| 138 | 164 | echo "Architectures: amd64 i386" >> $MainDir/Release | |
| 139 | 165 | echo "Components: universe" >> $MainDir/Release | |
| 140 | 166 | echo "Description: Lazarus testing 1.0" >> $MainDir/Release | |
| 141 | 167 | ||
| 142 | 168 | apt-ftparchive release $MainDir >> $MainDir/Release | |
| 143 | 169 | ||
| 144 | 170 | # sign Release file | |
| 145 | 171 | gpg --sign --homedir=$GPGHome -ba -o $MainDir/Release.gpg $MainDir/Release | |
| 146 | 172 | ||
| 147 | 173 | # end. | |
| 148 | 174 | ||
| 149 | 175 | 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*). | |
| 150 | 176 | ||
| 151 | 177 | ## Adding the repository to a client | |
| 152 | 178 | ||
| 153 | 179 | The following steps must be done on each computer, you want to use your repository. | |
| 154 | 180 | ||
| 155 | 181 | ### Add the key | |
| 156 | 182 | ||
| 157 | 183 | Download the key from the public key server: | |
| 158 | 184 | ||
| 159 | - | ||
| 185 | + | ```text | |
| 186 | + | gpg --keyserver hkp://pgp.mit.edu:11371 --recv-keys 3A5B1204 | |
| 187 | + | ``` | |
| 160 | 188 | ||
| 161 | 189 | The 3A5B1204 should be replaced with your key id. Check the output, that you got the right key. | |
| 162 | 190 | ||
| 163 | 191 | Add it to the apt system: | |
| 164 | 192 | ||
| 165 | - | ||
| 193 | + | ```text | |
| 194 | + | gpg --export 3A5B1204 | sudo apt-key add - | |
| 195 | + | ``` | |
| 166 | 196 | ||
| 167 | 197 | You can see the list of apt keys with: | |
| 168 | 198 | ||
| 169 | - | ||
| 199 | + | ```text | |
| 200 | + | sudo apt-key list | |
| 201 | + | ``` | |
| 170 | 202 | ||
| 171 | 203 | ### Add the repository | |
| 172 | 204 | ||
| 173 | 205 | You can use synaptic for this or edit the /etc/apt/sources.list directly. Add the line: | |
| 174 | 206 | ||
| 175 | - | ||
| 207 | + | ```text | |
| 208 | + | deb http://progprak.scale.uni-koeln.de/lazarus/ lazarus-testing universe | |
| 209 | + | ``` | |
| 176 | 210 | ||
| 177 | 211 | Replace the http path with your own. | |
| 178 | 212 | ||
| 179 | 213 | ## Install Lazarus | |
| 180 | 214 | ||
| 181 | 215 | For example: | |
| 182 | 216 | ||
| 183 | - | ||
| 184 | - | ||
| 217 | + | ```text | |
| 218 | + | sudo apt-get update | |
| 219 | + | sudo apt-get install lazarus | |
| 220 | + | ``` | |
| 185 | 221 | ||
| 186 | 222 | --- | |
| 187 | 223 | *From the Free Pascal wiki, page "How to setup a FPC and Lazarus Ubuntu repository/pt", as it stood on 2007-10-19 after a change by Antoniog, 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).* |
