本文最后由 森林生灵 于 2020/07/03 23:32:28 编辑
软件源的创建
# 安装软件包 sudo apt install -y gnupg reprepro # 创建 GPG 密钥 gpg --full-gen # 列出系统中的 GPG 密钥 gpg --list-keys # 创建站点目录 mkdir -p /data/wwwroot/ppa/key /data/wwwroot/ppa/conf /data/wwwroot/ppa/deb # 导出 GPG 公钥 gpg --armor --export 9D22BF79E2549604 > /data/wwwroot/ppa/public/key/public.key # 配置文件 nano /data/wwwroot/ppa/conf/distributions Origin: (库的名字, 如 deepin) Label: (库的名字, 如 deepin) Suite: (stable 或 unstable) Codename: (发行版代号, 如 lanseyujie) Version: (发布版本, 如 15.9) Architectures: (软件包所支持的架构, 比如 i386 或 amd64) Components: (包含的部件, 如 main restricted universe multiverse contrib non-free) Description: (描述) SignWith: (GPG Key-ID) # 本站 distributions 配置 Origin: deepin Label: deepin Suite: unstable Codename: lanseyujie Version: 2019 Architectures: amd64 Components: main contrib non-free Description: Personal Package Archives SignWith: 9D22BF79E2549604 # 添加 deb 到 lanseyujie/main 源 reprepro --ask-passphrase -Vb /data/wwwroot/ppa --outdir /data/wwwroot/ppa/public/deepin -C main includedeb lanseyujie /data/wwwroot/ppa/deb/main/*.deb
Nginx 站点配置
server { listen 80; listen 443 ssl http2; server_name ppa.lanseyujie.com; ssl_certificate /etc/nginx/ssl/lanseyujie.com.cer; ssl_certificate_key /etc/nginx/ssl/lanseyujie.com.key; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5; ssl_prefer_server_ciphers on; ssl_session_timeout 10m; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_buffer_size 1400; ssl_stapling on; ssl_stapling_verify on; charset utf-8; access_log /var/log/nginx/access.log combined; root /data/wwwroot/ppa/public; index index.html index.htm; if ($ssl_protocol = "") { return 301 https://$host$request_uri; } # error_page 404 /404.html; location / { autoindex on; autoindex_exact_size on; autoindex_localtime on; } location ~ /\. { deny all; } }
站点目录
ppa ├── conf │ └── distributions ├── db │ ├── checksums.db │ ├── contents.cache.db │ ├── packages.db │ ├── references.db │ ├── release.caches.db │ └── version ├── deb │ ├── contrib │ ├── main │ └── non-free └── public ├── deepin │ ├── dists │ │ └── lanseyujie │ │ ├── contrib │ │ │ └── binary-amd64 │ │ │ ├── Packages │ │ │ ├── Packages.gz │ │ │ └── Release │ │ ├── InRelease │ │ ├── main │ │ │ └── binary-amd64 │ │ │ ├── Packages │ │ │ ├── Packages.gz │ │ │ └── Release │ │ ├── non-free │ │ │ └── binary-amd64 │ │ │ ├── Packages │ │ │ ├── Packages.gz │ │ │ └── Release │ │ ├── Release │ │ └── Release.gpg │ └── pool │ ├── main │ └── non-free └── key └── public.key
软件源的使用
# 添加源 echo "deb [arch=amd64] https://ppa.lanseyujie.com/deepin lanseyujie main contrib non-free" | sudo tee -a /etc/apt/sources.list # 添加公钥 wget -O - https://ppa.lanseyujie.com/key/public.key | sudo apt-key add - # 更新软件源 sudo apt update
参考文献
[1] https://manpages.debian.org/stretch/reprepro/reprepro.1.en.html
本文标题:使用 reprepro 搭建私有软件源
版权声明:本文使用「署名-非商业性使用-相同方式共享」创作共享协议,转载或使用请遵守署名协议。
相关文章
上一篇:Nginx 配置说明