Ricerca nel sito web

Crea un "repository di pacchetti .deb" su Sourceforge.net utilizzando lo strumento "Reprepro" in Ubuntu


Reprepro è un piccolo strumento da riga di comando per creare e gestire facilmente repository .deb. Oggi mostreremo come creare facilmente repository di pacchetti Debian utilizzando reprepro e come caricalo su Sourceforge.net utilizzando il comando rsync.

Passaggio 1: installare Reprepro e generare la chiave

Innanzitutto, installa tutti i pacchetti necessari, utilizzando il seguente comando apt-get.

sudo apt-get install reprepro gnupg

Ora devi generare una chiave gpg usando gnupg, per fare ciò applica questo comando.

gpg --gen-key

Ti farà alcune domande, come il tipo di chiave che desideri, per quanto tempo la chiave dovrebbe essere valida, se non sai cosa rispondere, fai semplicemente clic su Invio per le opzioni predefinite (consigliato ).

Naturalmente ti chiederà un nome utente e una password, tienili a mente, perché ci serviranno in seguito.

gpg (GnuPG) 1.4.14; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 
Requested keysize is 2048 bits
Please specify how long the key should be valid.
         0 = key does not expire
        = key expires in n days
      w = key expires in n weeks
      m = key expires in n months
      y = key expires in n years
Key is valid for? (0) 
Key does not expire at all
Is this correct? (y/N) Y

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <[email >"

Real name: ravisaive
Email address: [email 
Comment: tecmint
You selected this USER-ID:
    "Ravi Saive (tecmint) <[email >"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.

+++++
gpg: key 2EB446DD marked as ultimately trusted
public and secret key created and signed.

gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   2048R/2EB446DD 2014-06-24
      Key fingerprint = D222 B1C9 342E 5911 02B1  9147 3BD6 7918 2EB4 46DD
uid                  Ravi Saive (tecmint) <[email >
sub   2048R/7EF2F750 2014-06-24

Ora la tua chiave verrà generata, per verificare se è così, esegui questo comando come privilegi di root.

sudo gpg --list-keys
Uscita del campione
/home/ravisaive/.gnupg/pubring.gpg
----------------------------------
pub   2048R/2EB446DD 2014-06-24
uid                  ravisaive (tecmint) <[email >
sub   2048R/7EF2F750 2014-06-24

Passaggio 2: creare un repository di pacchetti e una chiave di esportazione

Inizieremo ora il lavoro per creare il repository, prima devi creare alcune cartelle, il nostro repository sarà nella directory /var/www/apt, quindi creiamo alcune cartelle.

sudo su
cd /var/www
mkdir apt
mkdir -p ./apt/incoming 
mkdir -p ./apt/conf
mkdir -p ./apt/key

Ora devi esportare la chiave che hai creato nella cartella del repository, eseguire.

gpg --armor --export username [email  >> /var/www/apt/key/deb.gpg.key

Nota: sostituisci nome utente con il nome utente inserito nel passaggio precedente e [email protetto] con il tuo indirizzo email.

Dobbiamo creare un file chiamato “distributions ” all'interno di /var/www/apt/conf.

touch /var/www/apt/conf/distributions

Aggiungi queste righe seguenti al file delle distribuzioni e salva il file.

Origin: (yourname)
Label: (name of repository)
Suite: (stable or unstable)
Codename: (the codename for the distribution you are using, like trusty)
Version: (the version for the distribution you are using, like 14.04)
Architectures: (the repository packages  architecture, like i386 or amd64)
Components: (main restricted universe multiverse)
Description: (Some information about the repository)
SignWith: yes

Successivamente, dovremo creare l'albero del repository, per fare ciò, eseguire quei comandi.

reprepro --ask-passphrase -Vb /var/www/apt export
Uscita del campione
Created directory "/var/www/apt/db"
Exporting Trusty...
Created directory "/var/www/apt/dists"
Created directory "/var/www/apt/dists/Trusty"
Created directory "/var/www/apt/dists/Trusty/universe"
Created directory "/var/www/apt/dists/Trusty/universe/binary-i386"
FF5097B479C8220C ravisaive (tecmint) <[email > needs a passphrase
Please enter passphrase:
Successfully created '/var/www/apt/dists/Trusty/Release.gpg.new'
FF5097B479C8220C ravisaive (tecmint) <[email > needs a passphrase
Please enter passphrase:
Successfully created '/var/www/apt/dists/Trusty/InRelease.new'

Passaggio 3: aggiungi pacchetti al repository appena creato

Ora prepara i tuoi pacchetti .deb da aggiungere al repository. Vai alla directory /var/www/apt, devi farlo ogni volta che vuoi aggiungere pacchetti.

cd /var/www/apt
reprepro --ask-passphrase -Vb . includedeb Trusty /home/ravisaive/packages.deb

Nota: sostituisci trusty con il nome in codice che hai inserito per il repository nel file delle distribuzioni e sostituisci /home/username/package .deb con il percorso del pacchetto, ti verrà chiesta la passphrase da inserire.

Uscita del campione
/home/ravisaive/packages.deb : component guessed as 'universe'
Created directory "./pool"
Created directory "./pool/universe"
Created directory "./pool/universe/o"
Created directory "./pool/universe/o/ojuba-personal-lock"
Exporting indices...
FF5097B479C8220C ravisaive (tecmint) <[email > needs a passphrase
Please enter passphrase:
Successfully created './dists/Trusty/Release.gpg.new'
FF5097B479C8220C ravisaive (tecmint) <[email > needs a passphrase
Please enter passphrase:
Successfully created './dists/Trusty/InRelease.new'

Il tuo pacchetto viene aggiunto al repository, per rimuoverlo.

reprepro --ask-passphrase -Vb /var/www/apt remove trusty  package.deb

E, naturalmente, devi modificare il comando con il nome del pacchetto e il nome in codice del repository.

Passaggio 4: carica il repository su Sourceforge.net

Per caricare il repository su Sourceforge.net, ovviamente devi avere un account in esecuzione lì e un progetto in esecuzione, supponiamo che tu voglia caricare il repository su http://sourceforge .net/projects/myfoo/testrepository dove myfoo è il nome del tuo progetto (nome UNIX, non URL, non titolo) e testrepository è la cartella in cui desideri caricare i file. Lo faremo utilizzando rsync comando.

rsync -avP -e ssh /var/www/apt/ [email :/home/frs/project/myfoo/testrepository/

Nota: sostituisci nome utente con il tuo nome utente su sourceforge.net e myfoo con il nome UNIX del tuo progetto e testrepository con la cartella in cui desideri archiviare i file.

Ora che il tuo repository è caricato su http://sourceforge.net/projects/myfoo/testrepository, per aggiungerlo al tuo sistema installato, devi prima importare la chiave del repository, sarà in < b>/var/www/apt/key/deb.gpg.key, ma questo è un percorso locale e gli utenti del tuo repository non saranno in grado di aggiungerlo ai loro sistemi, ecco perché saremo importando la chiave da sourceforge.net.

sudo su
wget -O - http://sourceforge.net/projects/myfoo/testrepository/apt/key/deb.gpg.key | apt-key add -

Ora puoi aggiungere facilmente il repository al tuo sistema, aprire /etc/apt/sources.list e aggiungere questa riga.

deb http://sourceforge.net/projects/myfoo/testrepository/apt/key/deb.gpg.key trusty main

Nota: sostituisci myfoo con il nome UNIX del tuo progetto, trusty con il nome in codice del repository, testrepository con la cartella in cui hai caricato i file e main con i componenti del repository che hai aggiunto il file delle distribuzioni.

Successivamente, esegui seguenti per aggiornare l'elenco dei repository.

sudo apt-get update

Congratulazioni! Il tuo repository è attivo! Ora puoi installare facilmente i pacchetti da esso, se lo desideri.