웹사이트 검색

Ubuntu의 "Reprepro" 도구를 사용하여 Sourceforge.net에서 ".deb 패키지 저장소" 생성


Reprepro.deb 저장소를 쉽게 만들고 관리할 수 있는 작은 명령줄 도구입니다. 오늘 우리는 reprepro를 사용하여 데비안 패키지 저장소를 쉽게 만드는 방법과 방법을 보여 드리겠습니다. rsync 명령을 사용하여 Sourceforge.net에 업로드하세요.

1단계: Reprepro 설치 및 키 생성

먼저 다음 apt-get 명령을 사용하여 필요한 모든 패키지를 설치하십시오.

sudo apt-get install reprepro gnupg

이제 gnupg를 사용하여 gpg 키를 생성해야 합니다. 이를 수행하려면 다음 명령을 적용하세요.

gpg --gen-key

원하는 키 종류, 키 유효 기간 등 몇 가지 질문을 할 것입니다. 무엇을 대답해야 할지 모르는 경우 기본 옵션에서 Enter를 클릭하세요(권장). ).

물론 사용자 이름과 비밀번호를 묻는 메시지가 표시됩니다. 나중에 필요하므로 염두에 두십시오.

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

이제 키가 생성됩니다. 그렇다면 확인하려면 루트 권한으로 이 명령을 실행하세요.

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

2단계: 패키지 저장소 및 내보내기 키 생성

이제 저장소를 생성하는 작업을 시작하겠습니다. 먼저 일부 폴더를 생성해야 합니다. 저장소는 /var/www/apt 디렉터리에 있으므로 일부 폴더를 생성해 보겠습니다.

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

이제 생성한 키를 리포지토리 폴더로 내보내고 실행해야 합니다.

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

참고: 사용자 이름을 위 단계에서 입력한 사용자 이름으로 바꾸고 [email 를 이메일로 바꾸세요.

/var/www/apt/conf 내에 “distributions”라는 파일을 생성해야 합니다.

touch /var/www/apt/conf/distributions

배포 파일에 다음 줄을 추가하고 파일을 저장합니다.

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

다음으로 저장소 트리를 생성해야 합니다. 이를 위해 해당 명령을 실행합니다.

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'

3단계: 새로 생성된 리포지토리에 패키지 추가

이제 저장소에 추가할 .deb 패키지를 준비하세요. /var/www/apt 디렉토리로 이동하세요. 패키지를 추가할 때마다 이 작업을 수행해야 합니다.

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

참고: trusty를 배포 파일의 저장소에 입력한 코드명으로 바꾸고 /home/username/package를 바꾸세요. .deb에 패키지 경로를 입력하면 암호를 입력하라는 메시지가 표시됩니다.

샘플 출력
/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'

패키지가 저장소에 추가되어 제거됩니다.

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

물론 패키지 이름과 저장소 코드명으로 명령을 수정해야 합니다.

4단계: Sourceforge.net에 리포지토리 업로드

저장소를 Sourceforge.net에 업로드하려면 물론 거기에 실행 중인 계정이 있어야 하며, 실행 중인 프로젝트가 있어야 합니다. 저장소를 http://sourceforge에 업로드한다고 가정해 보겠습니다. .net/projects/myfoo/testrepository 여기서 myfoo는 프로젝트 이름(UNIX 이름, URL, 제목 아님)이고 testrepository는 파일을 업로드하려는 폴더입니다. rsync를 사용하여 이 작업을 수행합니다. 명령.

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

참고: username을 sourceforge.net의 사용자 이름으로 바꾸고 myfoo를 프로젝트 UNIX 이름으로 바꾸고 testrepository를 파일을 저장하려는 폴더로 바꾸세요.

이제 저장소가 http://sourceforge.net/projects/myfoo/testrepository에 업로드되었습니다. 이를 설치된 시스템에 추가하려면 먼저 저장소 키를 가져와야 합니다. < b>/var/www/apt/key/deb.gpg.key이지만 이는 로컬 경로이고 저장소 사용자는 해당 경로를 시스템에 추가할 수 없습니다. sourceforge.net에서 키를 가져옵니다.

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

이제 시스템에 저장소를 쉽게 추가하고 /etc/apt/sources.list를 열고 다음 줄을 추가할 수 있습니다.

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

참고: myfoo를 프로젝트 UNIX 이름으로, trusty를 저장소 코드명으로, testrepository를 파일을 업로드한 폴더로, main을 추가한 저장소 구성 요소로 바꾸세요. 배포판 파일.

다음으로, 다음을 실행하여 리포지토리 목록을 업데이트하세요.

sudo apt-get update

축하합니다! 저장소가 활성화되었습니다! 이제 원하는 경우 패키지를 쉽게 설치할 수 있습니다.