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

@geekpi
This commit is contained in:
wxy
2014-07-14 21:18:00 +08:00
parent f524f5a007
commit dbe1718917

View File

@@ -1,6 +1,6 @@
在Ubuntu下使用“Reprepro”工具在Sourceforge.net中创建".deb"包仓库
在Ubuntu下如何创建远程".deb"包仓库
================================================================================
**Reprepro**是一款小巧的命令行工具来方便地创建并管理**.deb**仓库。今天我们会战士如何使用reprepro简单地创建一个Debian包仓库并使用**rsync**上传到Sourceforge.net。
**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)
@@ -10,11 +10,11 @@
$ sudo apt-get install reprepro gnupg
现在你需要使用hnupg生成一个gpg key这里使用下面的命令。
现在你需要使用gnupg生成一个gpg key这里使用下面的命令。
$ gpg --gen-key
它会询问你一些问题比如你想要哪种key、key的有效期、如果你不知道如何回答只需点击**Enter** 来选择默认选项(建议)
它会询问你一些问题比如你想要哪种key、key的有效期、如果你不知道如何回答只需点击**回车** 来选择默认选项(建议)
当然,它会询问你用户名和密码,在脑海中记住这些,因为我们会在之后需要它。
@@ -85,7 +85,7 @@
### 步骤 2: 创建一个包仓库并导出key ###
我们现在要开始创建仓库,首先你需要创建一些文件夹,我们的仓库会在**/var/www/apt**目录,让我们先创建这些目录。
我们现在要开始创建仓库,首先你需要创建一些文件夹,我们的仓库会在**/var/www/apt**目录,让我们先创建这些目录。
$ sudo su
# cd /var/www
@@ -98,7 +98,7 @@
# gpg --armor --export username yourmail@mail.com >> /var/www/apt/key/deb.gpg.key
注意用你之前步骤中输入的用户名代替username用你的email代替yourmail@mail.com。
注意用你之前步骤中输入的用户名代替username用你的email代替上面的yourmail@mail.com。
我们需要在**/var/www/apt/conf**创建一个文件“**distributions**”。
@@ -106,14 +106,14 @@
加入下面这几行到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)
Origin: (你的名字)
Label: (库的名字)
Suite: (stable unstable)
Codename: (发布的代码名,比如 trusty)
Version: (发布的版本,比如 14.04)
Architectures: (软件包所支持的架构, 比如 i386 amd64)
Components: (包含的部件,比如 main restricted universe multiverse)
Description: (描述)
SignWith: yes
接下来我们会创建仓库树,运行这些命令:
@@ -137,7 +137,7 @@
### 步骤 3: 在新创建的仓库中加入包 ###
现在准备你的**.deb**包来加入到仓库中。进入 **/var/www/apt**目录,你每次要加包的时候都不得不这么做。
现在准备你的**.deb**包来加入到仓库中。进入 **/var/www/apt**目录,你每次要加包的时候都必须这么做。
# cd /var/www/apt
# reprepro --ask-passphrase -Vb . includedeb Trusty /home/ravisaive/packages.deb
@@ -159,7 +159,7 @@
Please enter passphrase:
Successfully created './dists/Trusty/InRelease.new'
你的包已经加入了仓库,要移除它:
你的包已经加入了仓库,如果要移除它的话采用如下命令
# reprepro --ask-passphrase -Vb /var/www/apt remove trusty package.deb
@@ -167,13 +167,15 @@
### 步骤 4: 上传仓库到Sourceforge.net ###
要上传仓库到**Sourceforge.net**,你当然需要一个活跃账号与一个活跃项目,让我假设你想要上传仓库到**http://sourceforge.net/projects/myfoo/testrepository**这里的myfoo是项目名UNIX名称不是URL不是标题testrepository是你想要上传文件到这上面的目录这里我们会使用[rsync 命令][1]
要上传仓库到**Sourceforge.net**,你当然需要一个可用的账号与一个可用的项目,让我假设你想要上传仓库到**http://sourceforge.net/projects/myfoo/testrepository**这里的myfoo是项目名UNIX上的名称不是URL不是标题testrepository是你想要上传文件到这上面的目录这里我们会使用[rsync 命令][1]LCTT译注当然你也可以上传到其它的支持Http/Rsync的服务器上以提供远程软件库的服务。
# rsync -avP -e ssh /var/www/apt/ username@frs.sourceforge.net:/home/frs/project/myfoo/testrepository/
**注意**用你在sourceforge.net上的用户名代替username用你的项目的UNIX类型名称代替myfoo用你想要存储的文件夹代替testrepository。
**注意**用你在sourceforge.net上的用户名代替username用你的项目的UNIX名称代替myfoo用你想要存储的文件夹代替testrepository。
现在你的仓库上传到了**http://sourceforge.net/projects/myfoo/testrepository**要把它加入到已安装的系统首先你需要导入仓库key它会在**/var/www/apt/key/deb.gpg.key**但是这是一个本地路径并且你仓库的用户不能添加到他们的系统中这就是为什么我们要导入来自sourceforge.net的key的原因
现在你的仓库包括设置和key等等上传到了**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 -
@@ -194,7 +196,7 @@
via: http://www.tecmint.com/create-deb-pacakge-repository-in-ubuntu/
译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID)
译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出