Outils pour utilisateurs

Outils du site


tech:depot_debian_apt_repository

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tech:depot_debian_apt_repository [2025/06/02 17:15] Jean-Baptistetech:depot_debian_apt_repository [2026/06/17 11:01] (Version actuelle) Jean-Baptiste
Ligne 1: Ligne 1:
 +<!DOCTYPE markdown>
 +{{tag>Brouillon apt deb Repo}}
 +
 +# Dépôt Debian APT repository
 +
 +Voir :
 +* [[Notes debmirror]]
 +* http://doc.ubuntu-fr.org/tutoriel/comment_creer_depot
 +
 +Voir aussi :
 +* aptly
 +
 +~~~bash
 +wget -c http://www.gostcrypt.org/download/1.0/linux/Gostcrypt_1.0.deb
 +mv Gostcrypt_1.0.deb gostcrypt.deb
 +wget -c http://ftp.fr.debian.org/debian/pool/main/w/wxwidgets2.8/libwxgtk2.8-dev_2.8.12.1-12_amd64.deb
 +wget -c https://github.com/adobe/brackets/releases/download/release-1.5/Brackets.Release.1.5.64-bit.deb
 +wget -c ftp://ftp.mondorescue.org/debian/8/mondo_3.2.1-1_amd64.deb
 +wget -c http://ftp.fr.debian.org/debian/pool/non-free/a/afio/afio_2.5.1.20130626+gite266635-1_amd64.deb
 +wget -c http://ftp.fr.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-linux-nonfree_0.44~bpo8+1_all.deb
 +wget -c http://ftp.fr.debian.org/debian/pool/main/p/pdfedit/pdfedit_0.4.5-1_amd64.deb
 +~~~
 +
 +Modification d'un paquet .deb
 +~~~bash
 +wget -c http://www.gostcrypt.org/download/1.0/linux/Gostcrypt_1.0.deb
 +rm tmp* -rf
 +mkdir tmp
 +cd tmp/
 +ar x ../Gostcrypt_1.0.deb 
 +ls -l
 +mkdir DEBIAN 
 +cd DEBIAN/
 +tar xzvf ../control.tar.gz 
 +ls
 +rm ../control.tar.gz 
 +vim control 
 +cd ..
 +ls
 +cd ..
 +mv Gostcrypt_1.0.deb ..
 +dpkg-deb --build  tmp/
 +~~~
 +
 +
 +## Comment créer un dépôt de paquets
 +
 +Réf : 
 +* http://doc.ubuntu-fr.org/tutoriel/comment_creer_depot
 +* https://wiki.debian.org/SettingUpSignedAptRepositoryWithReprepro
 +
 +~~~bash
 +apt-get install reprepro
 +~~~
 +
 +~~~bash
 +mkdir apt
 +cd apt
 +mkdir conf
 +mkdir incoming
 +~~~
 +
 +`conf/distributions`
 +~~~ini
 +Origin: Acme
 +Label: Acme
 +Suite: stable
 +Codename: jessie
 +Version: 8.2
 +Architectures: amd64
 +Components: main
 +Description: Global Private Acme Repository
 +~~~
 +
 +Placer les fichiers .deb dans le dossier incoming
 +
 +`reprepro -Vb . includedeb (distribution) incoming/(nom_du_paquet)`
 +
 +Exemple :
 +~~~bash
 +reprepro -Vb . includedeb jessie incoming/atop
 +~~~
 +
 +`/etc/nginx/sites-available/repo`
 +~~~nginx
 +server {
 +        listen 80 ;
 +        server_name apt.acme.fr ;
 +
 +        root /var/www/apt ;
 +
 +        autoindex on;
 +        charset utf-8;
 +}
 +~~~
 +
 +
 +## Faire un Dépôt partiel (partial Debian mirror) qui contiendra l'ensemble des paquets nécessaires
 +
 +Voir 
 +* https://www.debian-administration.org/article/286/Setting_up_your_own_APT_repository_with_upload_support
 +* https://blog.sileht.net/create-a-smart-debian-repository-with-reprepro.html
 +
 +Voir équivalent pour RPM RedHat [[creation_d_un_depot_redhat_rpm_pour_yum]]
 +##  Add Packages in local Debian repository
 +
 +
 +Exemple 
 +
 +Pour que GPG ne nous demande pas mille fois la paraphrase
 +~~~bash
 +eval $(gpg-agent --daemon)
 +~~~
 +
 +Et
 +~~~bash
 +apt-get install paquet
 +cd /var/www/apt/incoming/
 +for paq in $(dpkg -l | grep ^ii | awk '{print $2}') ; do apt-get download $paq ; done
 +cd ..
 +for deb in incoming/*.deb ; do reprepro -Vb . includedeb jessie $deb ; done
 +~~~
 +
 +`add_packages.sh`
 +~~~bash
 +#! /bin/bash
 +
 +set -o nounset
 +WD=$(dirname $(realpath $0))
 +
 +pushd . > /dev/null
 +
 +cd /var/www/apt/incoming/
 +for paq in $(cat $WD/packages_list.txt) $(dpkg -l | grep ^ii | awk '{print $2}' | egrep -v "$(cat $WD/packages_list_ignored.txt  |tr "\n" "|" | sed -e 's/|$//')" )
 +do 
 +        apt-get download $paq # > /dev/null
 +done
 +
 +
 +cd /var/www/apt/
 +for deb in incoming/*.deb
 +do 
 +        reprepro -Vb . includedeb jessie $deb # >/dev/null
 +done
 +
 +popd > /dev/nul
 +~~~
 +
 +
 +## Créer un paquet Debian
 +
 +https://www.debian.org/doc/manuals/packaging-tutorial/packaging-tutorial.fr.pdf
 +
 +## Signer les paquets
 +
 +Sur le serveur repo
 +
 +1) Générer une clef
 +
 +Export de la clef publique
 +~~~bash
 +gpg --list-key
 +gpg --export -a 0x3E4DC2000A8903CF > /var/www/apt/conf/0x3E4DC2000A8903CF.asc
 +~~~
 +
 +`conf/distributions`
 +~~~
 +SignWith: 0x3E4DC2000A8903CF
 +~~~
 +
 +~~~bash
 +reprepro --ask-passphrase export
 +~~~
 +
 +Sur un client
 +~~~bash
 +wget http://repo.local/conf/0x3E4DC2000A8903CF.asc
 +apt-key add 0x3E4DC2000A8903CF.asc
 +
 +#curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3E4DC2000A8903CF" | sudo apt-key add
 +~~~
 +
 +Autre exemple :
 +Add GPG key
 +~~~bash
 +curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
 +~~~
 +
 +`-f` : Fail silently on server errors
 +
 +`-s` : Silent or quiet mode. Don't show progress meter or error messages
 +
 +`-S` : When used with -s, --silent, it makes curl show an error message if it fails
 +
 +`-L` : If the server reports that the requested page has moved to a different location, this option will make curl redo the request on  the  new place.
 +
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki