Create a simple APT Repository
As part of my work, my maintained patheat ider relies on some features in cURL and PycURL that have just been merged or are still waiting to be merged. I need to build a Docker container that contains these Debian packages, so I need to quickly build an APT repository.
The Debian repository is essentially a static website and the content is signed by GPG, so it doesn't have to be hosted in a trusted place (unless availability is critical to your program ). I host my blog on Netlify (a static website host). I think it is suitable for this situation. They also support open-source projects.
You can use the following command to install the netlify CLI tool:
sudo apt install npm
sudo npm install -g netlify-cli
To set a repository, follow these steps:
mkdir repository
cp/path/to/*.deb repository/
cd repository
apt-ftparchive packages . > Packages
apt-ftparchive release . > Release
gpg --clearsign -o InRelease Release
netlify deploy
After completing these steps and creating a new website on Netlify, you can also manage the website through the Web interface. You may want to set a custom domain name for your repository, or use Let's Encrypt to enable HTTPS. (If You Want To enable HTTPS, make sure the command containsapt-transport-https
.)
To add this repository to your apt Source:
gpg --export-a YOURKEYID |sudo apt-key add -
echo"deb https://SUBDOMAIN.netlify.com/ /"|sudotee-a /etc/apt/sources.list
sudo apt update
You will find that these software packages can be installed. Pay attention to APT pinnng, because you may find that the newer versions in the repository are not the preferred ones according to your policy.
Update: If you want a solution that is more suitable for normal use, refer to repropro. If you want end users to add your apt repository to their system as a third-party repository, view this page On Debian wiki, this section describes how to instruct users to use your repository.
Update 2: One reviewer pointed out that aptly provides more features and removes some repropro restrictions. I have never used aptly, so I can't comment on details, but from the perspective of the website, this is a good tool.
Via: https://iain.learmonth.me/blog/2017/2017w383/
Author: Iain R. Learmonth Translator: geekpi Proofreader: wxy
This article was originally compiled by LCTT and launched with the honor of Linux in China