Paghimo Usa ka .deb Package Repository sa Sourceforge.net Gamit ang Reprepro Tool sa Ubuntu


Ang Reprepro usa ka gamay nga himan sa command-line aron makamugna ug makadumala sa .deb nga mga repository nga dali, Karon ipakita namon kung giunsa paghimo ang usa ka Debian package repository nga dali gamit ang reprepro ug kung giunsa i-upload kini sa Sourceforge.net gamit ang rsync nga sugo.

Lakang 1: I-install ang Reprepro ug Paghimo Key

Una, i-install ang tanan nga gikinahanglan nga mga pakete, gamit ang mosunod nga apt-get command.

$ sudo apt-get install reprepro gnupg

Karon kinahanglan ka nga maghimo usa ka gpg key gamit ang gnupg, aron mahimo kini, gamita kini nga mando.

$ gpg --gen-key

Mangutana kini kanimo og pipila ka mga pangutana, sama sa matang sa yawe nga imong gusto, kung unsa ka dugay ang yawe kinahanglan nga balido, kung wala ka mahibal-an kung unsa ang itubag, i-klik lang ang Enter alang sa default nga mga kapilian (girekomendar ).

Siyempre, kini mangayo kanimo alang sa usa ka username ug usa ka password, ibutang kini sa hunahuna, tungod kay kinahanglan namon kini sa ulahi.

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

Karon ang imong yawe mabuhat, aron masusi kung mao, padagana kini nga mando ingon usa ka pribilehiyo sa gamut.

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

Lakang 2: Paghimo og Package Repository ug Export Key

Atong sugdan ang trabaho karon sa paghimo sa repositoryo, una kinahanglan ka maghimo ug pipila ka mga folder, ang atong repository anaa sa /var/www/apt direktoryo, busa maghimo ta ug pipila ka mga folder.

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

Kinahanglan nimong i-export ang yawe nga imong gihimo sa folder sa repository, pagdagan.

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

Pahinumdom: Ilisan ang username sa username nga imong gisulod sa ibabaw nga lakang, ug [email  sa imong email.

Kinahanglan namong maghimo ug file nga gitawag og \distributions” sulod sa /var/www/apt/conf.

# touch /var/www/apt/conf/distributions

Idugang kining mosunod nga mga linya sa distributions file ug i-save ang 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

Sunod, Kinahanglan namon nga buhaton ang punoan sa repository, aron mahimo kini, pagdagan ang mga mando.

# reprepro --ask-passphrase -Vb /var/www/apt export
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'

Lakang 3: Idugang ang mga Pakete sa Bag-ong Nabuhat nga Repository

Karon andama ang imong .deb nga mga pakete nga idugang sa repositoryo. Adto sa /var/www/apt nga direktoryo, kinahanglan nimong buhaton kini sa matag higayon nga gusto nimong idugang ang mga pakete.

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

Pahinumdom: Ilisan ang trusty sa codename nga imong gisulod para sa repository sa distributions file, ug pulihan ang /home/username/package.deb sa dalan paingon sa package, imong pangutan-on nga mosulod ang passphrase.

/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'

Ang imong package gidugang sa repository, aron makuha kini.

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

Ug siyempre, kinahanglan nimo nga usbon ang command gamit ang imong package name ug ang repository codename.

Lakang 4: Pag-upload sa Repository sa Sourceforge.net

Aron ma-upload ang repository sa Sourceforge.net, kinahanglan nga adunay usa ka running account didto siyempre, ug usa ka running project, ibutang nato nga gusto nimo i-upload ang repository sa http://sourceforge .net/projects/myfoo/testrepositorydiin myfoo ang imong project name (UNIX name, dili URL, dili ang Titulo), ug testrepository mao ang folder diin gusto nimong i-upload ang mga file, Buhaton namo kini gamit ang rsync sugo.

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

Pahinumdom: Ilisan ang username sa imong username sa sourceforge.net ug myfoo sa imong proyekto nga UNIX-ngalan ug testrepository sa folder nga gusto nimong tipigan sa mga file.

Karon nga ang imong repository kay gi-upload na sa http://sourceforge.net/projects/myfoo/testrepository, para idugang kini sa imong na-install nga sistema, una kinahanglan nimo nga i-import ang repository key, kini anaa sa < b>/var/www/apt/key/deb.gpg.key, apan kana usa ka lokal nga agianan ug ang mga tiggamit alang sa imong repository dili makadugang niini sa ilang mga sistema, mao nga kita pag-import sa yawe gikan sa sourceforge.net.

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

Mahimo nimong idugang ang repository nga dali karon sa imong sistema, ablihi ang /etc/apt/sources.list ug idugang kini nga linya.

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

Pahinumdom: Ilisan ang myfoo sa imong proyekto nga UNIX-Name, kasaligan sa imong repository codename, testrepository sa folder diin imong gi-upload ang mga file, ug nag-una sa repository nga mga component nga imong gidugang sa distributions file.

Sunod, pagdagan sa pagsunod aron ma-update ang lista sa mga repositoryo.

$ sudo apt-get update

Pahalipay! Aktibo ang imong repository! Mahimo nimong i-install ang mga pakete nga dali gikan niini kung gusto nimo.