mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Update 20140625 Create A '.deb Pacakge Repository' at Sourceforge.net Using 'Reprepro' Tool in Ubuntu.md
This commit is contained in:
parent
88595f119c
commit
c200c96ef2
@ -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 we’ll 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 don’t 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 ###
|
||||
|
||||
We’ll 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 let’s create some folders.
|
||||
我们现在要开始创建仓库,首先你需要创建一些文件夹,我们的仓库会在**/var/www/apt**目录,让我们先创建这些目录。
|
||||
|
||||
$ sudo su
|
||||
# cd /var/www
|
||||
@ -98,17 +94,17 @@ We’ll 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, We’ll 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, We’ll 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, let’s 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 that’s a local path and the users for your repository won’t be able to add it to their systems, thats why we’ll 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/) 荣誉推出
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user