开发十年,就只剩下这套Java开发体系了 >>>
1 安装打包需要的软件环境
sudo apt-get install packaging-dev reprepro gnupg
2生成key并上传
(1)创建gpg key
gpg --gen-key
选择rsa
4096
email
其他填入对应信息
(2)上传key server
pub 2048R/AA08D2A8 2014-03-25
密钥指纹 = 5EAC 8E2F 5507 E388 E316 3AD9 F894 2D76 AA08 D2A8
uid zhangxin (openyoudao)
sub 2048R/8A54FE05 2014-03-25
其中AA08D2A8是生成的key
将key的公共部分上传到key server,这样全世界的开发者就可以根据你的key来识别你的信息和文件:
gpg --send-keys --keyserver keyserver.ubuntu.com
3创建本地仓库
搭建一个本地源,需要有索引文件Package.gz,目录pool下面放入软件包 ,生成release文件,对Release文件进行签名生成的Release.gpg
apt-install gnupg-agent
(1)创建包仓库导出key
#cd /var/www/html
#mkdir paasinsight
#mkdir -p paasinsight/conf
#gpg --armor --export zhifanzhao@test.com >> /var/www/html/paasinsight/public.key
注
查看秘钥信息
gpg --list-keys
导出公钥
gpg --armor --export email(比如dmwan_0926@126.com) >email.gpg.key
添加到信任列表
apt-key add email.gpg.key
# vi /var/www/html/paasinsight/conf/distributions //文件关于Release 载入的基本信息
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
---
两个distribution实例:
Origin: ubuntu-Mike
Label: ubuntu-Mike
Suite: precise
Codename: precise
Version: 12.04
Architectures: amd64 i386
Components: main restricted multiverse universe
Description: private main deb repository for precise
SignWith: default
Origin: ubuntu-Mike
Label: ubuntu-Mike
Suite: trusty
Codename: trusty
Version: 14.04
Architectures: amd64 i386
Components: main restricted multiverse universe
Description: private main deb repository for trusty
SignWith: default
# vi /var/www/html/paasinsight/conf/options //reprepro --options命令的集合
verbose
basedir .
ask-passphrase
distdir /var/www/html/paasinsight/dists //dist文件的输出位置
outdir /var/www/html/paasinsight //pool输出的位置
(2)创建仓库目录树
# reprepro --ask-passphrase -Vb /var/www/html/paasinsight export
(3)软件发布与移除
将自己打好的包添加到仓库(发布)
# reprepro -b .(conf的路径) -C main includedeb precise(trusty) /home/mr-zhao/test/dante_1.3.2-1_amd64.deb //pool中就能找到这个包了
移除软件包
# reprepro remove precise dante
4通过apache/nginx 发布
server {
listen 80(80);
server_name _;
root /var/www/html;
autoindex on;
}
5 添加source.list
deb http://yoururl trusty main univers
#yoururl要指到dists目录前
6 客户端需要添加key验证
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FA04D393774BAC4D
