1 安裝打包須要的軟件環境html
sudo apt-get install packaging-dev reprepro gnupgnginx
2生成key並上傳
(1)建立gpg key
gpg --gen-key
選擇rsa
4096
email
其餘填入對應信息
(2)上傳key server
pub 2048R/AA08D2A8 2014-03-25apache
密鑰指紋 = 5EAC 8E2F 5507 E388 E316 3AD9 F894 2D76 AA08 D2A8ubuntu
uid zhangxin (openyoudao) <justzx2011@gmail.com>ui
sub 2048R/8A54FE05 2014-03-25url
其中AA08D2A8是生成的keyrest
將key的公共部分上傳到key server,這樣全世界的開發者就能夠根據你的key來識別你的信息和文件:code
gpg --send-keys --keyserver keyserver.ubuntu.com <KEY ID> orm
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: yesserver
---
兩個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