-
Notifications
You must be signed in to change notification settings - Fork 2
self hosting
炳 edited this page Nov 23, 2024
·
15 revisions
- clone 本 git 仓库,进入 git 仓库目录。
- 确认系统安装有 curl、jq,没有请使用 apt 安装。
- 运行
init_deb.py
初始化。
默认只新建 x86_64 表,需要其他架构请修改其中的SQL语句。 - 下载或用 Go 安装 github-downloader 和 merge-apt-repo
参见Debian 文档,这个仓库使用了扁平仓库格式(Flat Repository Format)。
- 将
run.sh
中 gpg 开头的两行注释。 - 创建定时任务,定时运行
run.sh
crontab 样例:0 11,15,19 * * * cd [THIS_DIR] && ./run.sh >> ./deb/status.txt
请根据实际情况进行修改。
echo "deb [trusted=yes] file:/path/to/debs ./" | sudo tee /etc/apt/sources.list.d/wcbing.list
- 创建一个无密码的 GPG 密钥对,导出 GPG 公钥文件待用。
- 创建定时任务,定时运行
run.sh
crontab 样例:0 11,15,19 * * * cd [THIS_DIR] && ./run.sh >> ./deb/status.txt
使用 Web 服务器将 deb
目录暴露出去即可。
实际使用中:
- 官网提供的下载链接一般是 CDN 链接,为提升下载速度、减轻自建源压力,建议将这些请求重定向到官网上。
- 部分国内软件下载链接有验证,单纯反代不可以,暂时从自建源下载。
- 国内下载 Github 上的文件时比较慢,可以使用一些 Github 下载加速服务进行代理。
假设你将本项目 clone 在了 /packages
,并将 repo 暴露在了 https://packages.wcbing.top/deb
(首页请自行设置)。
给出一个 nginx 配置参考:
split_clients "${remote_addr}" $ghp {
25% ghp.ci;
25% ghproxy.cc;
25% ghproxy.net;
25% gh-proxy.com;
}
server {
server_name packages.wcbing.top;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
charset 'utf-8';
location ~ /.*/(https:/github\.com.*) {
return 302 https://$ghp/$1;
}
location ~ /.*/(https?):/(.+/.*) {
return 302 $1://$2;
}
location / {
root /packages;
}
}
用户使用时参考该脚本导入配置,先将上一步提到生成的 GPG 公钥导入,再新建软件源配置文件。
请根据实际情况进行修改。