Николай Николаевич Asked:2020-06-11 23:15:43 +0000 UTC2020-06-11 23:15:43 +0000 UTC 2020-06-11 23:15:43 +0000 UTC 如何在 Linux 上创建存储库? 772 我已经用我的程序编译了一个 deb 包,我需要以某种方式分发它。我需要用户能够使用一个命令安装我的程序,apt install如果我需要添加存储库,可能需要两个命令。我该怎么做? linux 2 个回答 Voted eri 2020-06-12T02:30:09Z2020-06-12T02:30:09Z apt-get install reprepro gnupg2 mkdir /var/www/debian mkdir /var/www/debian/conf touch /var/www/debian/conf/distributions editor /var/www/debian/conf/distributions 在那里我们写了存储库的描述 Codename: stable Suite: stable Version: 1.x Origin: Nikolaich Label: Nikolaich Description: Nikolaich Stable Repository Architectures: amd64 Components: main SignWith: default DebIndices: Packages Release . .gz .bz2 DscIndices: Sources Release . .gz .bz2 Contents: . .gz .bz2 更远 cd /var/www/debian gpg --gen-key gpg --armor --export > repokey.asc 会有一个key ID,比如4607CAF2F88913A6 把它添加到上面的文件中。 SignWith: 4607CAF2F88913A6 接下来,我们创建萝卜本身 cd /var/www/debian reprepro export reprepro createsymlinks 并填写包裹 reprepro --priority optional --section drivers includedeb stable /root/mysuper.deb 然后我们设置 web 服务器,以便可以通过http://example.com/debian/访问 debian 文件夹 通过几个命令为客户端安装: wget -O- http://example.com/debian/repokey.asc | apt-key add - echo "deb http://example.com/debian stable main" > /etc/apt/sources.list.d/myrepo.list apt update debian.org 上的类似说明 Best Answer don Rumata 2020-06-14T05:36:38Z2020-06-14T05:36:38Z 有一个恰当的项目。安德烈·斯米尔诺夫(Andrey Smirnov )堆积如山。他知道如何制作其他说唱的镜像,创建自己的说唱,快照。您可以通过CLI和API工作。 Habré描述了使用体验。 PS 甚至 Mikey 都是用来分发他自己的包的。签入 2 个计数: curl --silent http://packages.microsoft.com/repos/ms-teams/dists/stable/InRelease | grep aptly吐出Description: Generated by aptly。 UPD1。我将添加关于萝卜的创建。所以。 首先,关于变量和配置: my-first-repo- 内部厨房的存储库名称。 rolling- 手鼓\debian 发布名称,将在sources.list. 您可以执行与发行版名称相同的操作,即 bionic, buster, 和你自己的东西。我有rolling,因为还没有为特定版本制作特定功能的任务 配置: { "rootDir": "/var/aptly", "downloadConcurrency": 4, "downloadSpeedLimit": 0, "architectures": [], "dependencyFollowSuggests": false, "dependencyFollowRecommends": false, "dependencyFollowAllVariants": false, "dependencyFollowSource": false, "dependencyVerboseResolve": false, "gpgDisableSign": false, "gpgDisableVerify": false, "gpgProvider": "gpg", "downloadSourcePackages": false, "skipLegacyPool": true, "ppaDistributorID": "ubuntu", "ppaCodename": "", "skipContentsPublishing": false, "FileSystemPublishEndpoints": {}, "S3PublishEndpoints": {}, "SwiftPublishEndpoints": {} } /var/aptly必须创建并且必须有 ''rw'' 访问权限。 Добавление\создание репы != публикация. 创建萝卜时,它被创建/var/aptly/pool,它似乎拥有你需要的一切,但这并不完全正确。更多详细信息 -在文档中。当您想将完成的东西用作mirror.yandex.ru时,您需要发布它。然后/var/aptly/public在其中创建一棵树,它已经可以通过 http、ftp 等设置。 Unit systemd,如果您通过 http 恰当地进行通信: [Unit] Description=The Aptly api server After=network.target remote-fs.target nss-lookup.target # https://ma.ttias.be/auto-restart-crashed-service-systemd/ StartLimitIntervalSec=500 StartLimitBurst=10 [Service] ExecStart=/usr/bin/aptly api serve -listen=:8080 StandardOutput=syslog StandardError=syslog SyslogIdentifier=aptly User=aptly Group=aptly # WorkingDirectory=/var/aptly # https://ma.ttias.be/auto-restart-crashed-service-systemd/ Restart=on-failure RestartSec=10s [Install] WantedBy=multi-user.target 创建一个空存储库: 通过 bash: aptly repo create -distribution="rolling" my-first-repo 让我们发布它: aptly -architectures=i386,amd64 publish repo my-first-repo 通过 api: 创造: curl -X POST \ -H 'Content-Type: application/json' \ --data '{"Name":"my-first-repo","DefaultDistribution":"rolling","DefaultComponent":""}' \ http://localhost:8080/api/repos 我们发布: curl -X POST \ -H 'Content-Type: application/json' \ --data '{"SourceKind": "local", "Sources": [{"Name": "my-first-repo"}], "Architectures": ["i386", "amd64"], "Distribution": "rolling"}' \ http://localhost:8080/api/publish 通过 Ansible: 变量: aptly_my_first_repo_name: my-first-repo aptly_my_first_repo_distribution: rolling aptly_api_port: 8080 - name: Create my first repo uri: url: http://localhost:{{ aptly_api_port }}/api/repos method: POST body_format: json body: Name: "{{ aptly_my_first_repo_name }}" DefaultDistribution: "{{ aptly_my_first_repo_distribution }}" status_code: - 201 - 400 tags: - api - repo - create - name: Publish my first repo uri: url: http://localhost:{{ aptly_api_port }}/api/repos method: POST body_format: json body: SourceKind: "local" Sources: - Name: "{{ aptly_my_first_repo_name }}" Architectures: - i386 - amd64 Distribution: "{{ aptly_my_first_repo_distribution }}" status_code: - 200 - 201 - 400 tags: - api - repo - publish 创建空存储库后一切如何 通过 api curl --silent http://localhost:8080/api/repos | jq . [ { "Name": "my-first-repo", "DefaultDistribution": "rolling", "DefaultComponent": "main" } ] 通过 bash sudo aptly repo list -raw my-first-repo sudo aptly publish list -raw . rolling 通过FS cd /var/aptly/public . ├── dists │ └── rolling │ ├── InRelease │ ├── main │ │ ├── binary-amd64 │ │ │ ├── Packages │ │ │ ├── Packages.bz2 │ │ │ ├── Packages.gz │ │ │ └── Release │ │ └── binary-i386 │ │ ├── Packages │ │ ├── Packages.bz2 │ │ ├── Packages.gz │ │ └── Release │ ├── Release │ └── Release.gpg ├── pool ├── repo.key └── repo.key.gpg 添加一个包 cd /var/aptly/upload && wget https://download.cdn.viber.com/cdn/desktop/Linux/viber.deb 通过 bash 添加一个包: aptly repo add my-first-repo /var/aptly/upload/viber.deb 我们发布: aptly publish update rolling 通过 api\ansible - name: Add Viber to repo over api when: - ansible_os_family == 'Debian' - ansible_pkg_mgr == 'apt' - aptly_add_first_software_in_created_repo_over == 'api' uri: url: http://localhost:{{ aptly_api_port }}/api/repos/{{ aptly_my_first_repo_name }}/file/viber.deb method: POST status_code: - 200 - 201 - 400 - name: Update published repo over api when: - ansible_os_family == 'Debian' - ansible_pkg_mgr == 'apt' - aptly_add_first_software_in_created_repo_over == 'api' uri: url: http://localhost:{{ aptly_api_port }}/api/publish/:./{{ aptly_my_first_repo_distribution }} method: PUT body_format: json body: SourceKind: "local" # Sources: [{"Name": "{{ aptly_my_first_repo_name }}"}] Sources: - Name: "{{ aptly_my_first_repo_name }}" Component: "{{ aptly_my_first_repo_component }}" Architectures: - i386 - amd64 Distribution: "{{ aptly_my_first_repo_distribution }}" status_code: - 200 - 201 - 400 一般来说,ansible 的角色是编写和测试的,如果有的话,一切都是从那里拉出来的
在那里我们写了存储库的描述
更远
会有一个key ID,比如4607CAF2F88913A6 把它添加到上面的文件中。
接下来,我们创建萝卜本身
并填写包裹
然后我们设置 web 服务器,以便可以通过http://example.com/debian/访问 debian 文件夹
通过几个命令为客户端安装:
debian.org 上的类似说明
有一个恰当的项目。安德烈·斯米尔诺夫(Andrey Smirnov )堆积如山。他知道如何制作其他说唱的镜像,创建自己的说唱,快照。您可以通过CLI和API工作。
Habré描述了使用体验。
PS 甚至 Mikey 都是用来分发他自己的包的。签入 2 个计数:
curl --silent http://packages.microsoft.com/repos/ms-teams/dists/stable/InRelease | grep aptly
吐出Description: Generated by aptly
。UPD1。我将添加关于萝卜的创建。所以。
首先,关于变量和配置:
my-first-repo
- 内部厨房的存储库名称。rolling
- 手鼓\debian 发布名称,将在sources.list
. 您可以执行与发行版名称相同的操作,即bionic
,buster
, 和你自己的东西。我有rolling
,因为还没有为特定版本制作特定功能的任务配置:
/var/aptly
必须创建并且必须有 ''rw'' 访问权限。Добавление\создание репы != публикация
. 创建萝卜时,它被创建/var/aptly/pool
,它似乎拥有你需要的一切,但这并不完全正确。更多详细信息 -在文档中。当您想将完成的东西用作mirror.yandex.ru
时,您需要发布它。然后/var/aptly/public
在其中创建一棵树,它已经可以通过 http、ftp 等设置。Unit
systemd
,如果您通过 http 恰当地进行通信:创建一个空存储库:
通过 bash:
让我们发布它:
通过 api:
创造:
我们发布:
通过 Ansible:
变量:
创建空存储库后一切如何
通过 api
通过 bash
通过FS
添加一个包
通过 bash
添加一个包:
我们发布:
通过 api\ansible
一般来说,ansible 的角色是编写和测试的,如果有的话,一切都是从那里拉出来的