Update 20140625 Create A '.deb Pacakge Repository' at Sourceforge.net Using 'Reprepro' Tool in Ubuntu.md

This commit is contained in:
geekpi 2014-06-26 10:42:20 +08:00
parent 88595f119c
commit c200c96ef2

View File

@ -1,26 +1,22 @@
Translating-----------geekpi
Create A “.deb Pacakge Repository” at Sourceforge.net Using “Reprepro” Tool in Ubuntu
在Ubuntu下使用“Reprepro”工具在Sourceforge.net中创建".deb"包仓库
================================================================================
**Reprepro** is a small command-line tool to create and manage **.deb** repositories easily, Today well be showing how to create a Debian package repositories easily using reprepro and how to upload it to Sourceforge.net using **rsync** command.
**Reprepro**是一款小巧的命令行工具来方便地创建并管理**.deb**仓库。今天我们会战士如何人使用reprepro简单地创建一个Debian包仓库并使用**rsync**上传到Sourceforge.net。
![Create Deb Package Repository](http://www.tecmint.com/wp-content/uploads/2014/06/Create-Debian-Package-Repository1.png)
### Step 1: Install Reprepro and Generate Key ###
### 步骤 1: 安装Reprepro并生成key ###
First, install all the necessary packages, using the following apt-get command.
首先安装所有需要的包使用下面的apt-get命令。
$ sudo apt-get install reprepro gnupg
Now you need to generate a gpg key using gnupg, to do this, apply this command.
现在你需要使用hnupg生成一个gpg key这里使用下面的命令。
$ gpg --gen-key
It will ask you some questions, like the kind of the key you want, how long the key should be valid, if you dont know what to answer, just click **Enter** for the default options (recommended).
它会询问你一些问题比如你想要哪种key、key的有效期、如果你不知道如何回答只需点击**Enter** 来选择默认选项(建议)
Of course, it will ask you for a username and a password, keep those in mind, because we will need them later.
当然,它会询问你用户名和密码,在脑海中记住这些,因为我们会在之后需要它。
gpg (GnuPG) 1.4.14; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
@ -75,11 +71,11 @@ Of course, it will ask you for a username and a password, keep those in mind, be
uid Ravi Saive (tecmint) <tecmint.com@gmail.com>
sub 2048R/7EF2F750 2014-06-24
Now your key will be generated, to Check if so, run this command as a root privileges.
现在你的key已经生成了要检查一下用root权限运行这条命令。
$ sudo gpg --list-keys
#### Sample Output ####
#### 示例输出 ####
/home/ravisaive/.gnupg/pubring.gpg
----------------------------------
@ -87,9 +83,9 @@ Now your key will be generated, to Check if so, run this command as a root privi
uid ravisaive (tecmint) <tecmint.com@gmail.com>
sub 2048R/7EF2F750 2014-06-24
### Step 2: Create a Package Repository and Export Key ###
### 步骤 2: 创建一个包仓库并导出key ###
Well start the work now to create the repository, first you have to create some folders, our repository will be in **/var/www/apt** directory, so lets create some folders.
我们现在要开始创建仓库,首先你需要创建一些文件夹,我们的仓库会在**/var/www/apt**目录,让我们先创建这些目录。
$ sudo su
# cd /var/www
@ -98,17 +94,17 @@ Well start the work now to create the repository, first you have to create so
# mkdir -p ./apt/conf
# mkdir -p ./apt/key
You have now to export the key you created to the repository folder, run.
你现在需要将key导出到仓库文件夹运行
# gpg --armor --export username yourmail@mail.com >> /var/www/apt/key/deb.gpg.key
Note: Replace username with the username you entered in above step, and yourmail@mail.com with your email.
注意用你之前步骤中输入的用户名代替username用你的email代替yourmail@mail.com。
We need to create a file called “**distributions**” inside **/var/www/apt/conf**.
我们需要在**/var/www/apt/conf**创建一个文件“**distributions**”。
# touch /var/www/apt/conf/distributions
Add these following lines to the distributions file and save the file.
加入下面这几行到distributions这个文件中并保存。
Origin: (yourname)
Label: (name of repository)
@ -120,11 +116,11 @@ Add these following lines to the distributions file and save the file.
Description: (Some information about the repository)
SignWith: yes
Next, Well have to create the repository tree, to do this, run those commands.
接下来我们会创建仓库树,运行这些命令:
# reprepro --ask-passphrase -Vb /var/www/apt export
#### Sample Output ####
#### 示例输出 ####
Created directory "/var/www/apt/db"
Exporting Trusty...
@ -139,16 +135,16 @@ Next, Well have to create the repository tree, to do this, run those commands
Please enter passphrase:
Successfully created '/var/www/apt/dists/Trusty/InRelease.new'
### Step 3: Add Packages to Newly Created Repository ###
### 步骤 3: 在新创建的仓库中加入包 ###
Now prepare your **.deb** packages to be added to the repository. Go to the **/var/www/apt** directory, you have to do this each time you want to add packages.
现在准备你的**.deb**包来加入到仓库中。进入 **/var/www/apt**目录,你每次要加包的时候都不得不这么做。
# cd /var/www/apt
# reprepro --ask-passphrase -Vb . includedeb Trusty /home/ravisaive/packages.deb
**Note**: Replace **trusty** with the codename you entered for the repository in the distributions file, and replace **/home/username/package.deb** with the path to the package, you will be asked for the passphrase to enter.
**注意**:用你在distributions文件中输入的仓库代号来代替**trusty** ,并且用包的路径替换**/home/username/package.deb**,你会被要求输入密码。
#### Sample Output ####
#### 示例输出####
/home/ravisaive/packages.deb : component guessed as 'universe'
Created directory "./pool"
@ -163,41 +159,42 @@ Now prepare your **.deb** packages to be added to the repository. Go to the **/v
Please enter passphrase:
Successfully created './dists/Trusty/InRelease.new'
Your package is added to the repository, to remove it.
你的包已经加入了仓库,要移除它:
# reprepro --ask-passphrase -Vb /var/www/apt remove trusty package.deb
And of course, you need to modify the command with your package name and the repository codename.
当然你需要用你的包名与仓库代号来修改命令。
### Step 4: Upload Repository to Sourceforge.net ###
### 步骤 4: 上传仓库到Sourceforge.net ###
To upload the repository to **Sourceforge.net**, you need to have a running account there of course, and a running project, lets assume that you want to upload the repository to **http://sourceforge.net/projects/myfoo/testrepository** where myfoo is your project name (UNIX name, not URL, not the Title), and testrepository is the folder where you want to upload the files into, We will do this using [rsync command][1].
要上传仓库到**Sourceforge.net**,你当然需要一个活跃账号与一个活跃项目,让我假设你想要上传仓库到**http://sourceforge.net/projects/myfoo/testrepository**这里的myfoo是项目名UNIX名称不是URL不是标题testrepository是你想要上传文件到这上面的目录这里我们会使用[rsync 命令][1]
# rsync -avP -e ssh /var/www/apt/ username@frs.sourceforge.net:/home/frs/project/myfoo/testrepository/
**Note**: Replace username with your username on sourceforge.net and myfoo with your project UNIX-name and testrepository with the folder you want to store the files in.
**注意**用你在sourceforge.net上的用户名代替username用你的项目的UNIX类型名称代替myfoo用你想要存储的文件夹代替testrepository。
Now thats your repository is uploaded to **http://sourceforge.net/projects/myfoo/testrepository**, to add it to your installed system, first you have to import the repository key, it will be in **/var/www/apt/key/deb.gpg.key**, but thats a local path and the users for your repository wont be able to add it to their systems, thats why well be importing the key from sourceforge.net.
现在你的仓库上传到了**http://sourceforge.net/projects/myfoo/testrepository**要把它加入到已安装的系统首先你需要导入仓库key它会在**/var/www/apt/key/deb.gpg.key**但是这是一个本地路径并且你仓库的用户不能添加到他们的系统中这就是为什么我们要导入来自sourceforge.net的key的原因。
$ sudo su
# wget -O - http://sourceforge.net/projects/myfoo/testrepository/apt/key/deb.gpg.key | apt-key add -
You can add the repository easily now to your system, open **/etc/apt/sources.list** and add this line.
你现在可以非常轻松地把仓库加入到系统中了,打开**/etc/apt/sources.list**,并加入下面这行:
deb http://sourceforge.net/projects/myfoo/testrepository/apt/key/deb.gpg.key trusty main
**Note**: Replace myfoo with your project UNIX-Name, trusty with your repository codename, testrepository with the folder you uploaded the files into, and main with repository components you added to the distributions file.
Next, run following to update the repositories list.
**Note**用你的项目的UNIX类型名称代替myfoo用你的仓库代码代替trusty用你上传存储的文件夹代替testrepository用你在distributionsj加入的仓库组件代替main。
接下来,运行下面的命令来更新仓库列表。
$ sudo apt-get update
**Congratulations**! Your repository is active! You can now install packages easily from it if you want.
**祝贺你**! 你的软件仓库已经激活了!你现在可以非常简单地在你需要的时候安装包了。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/create-deb-pacakge-repository-in-ubuntu/
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出