0001-01-01
2分钟阅读时长

nexus 配置apt hosted

nexus web url http://10.100.1.32:8081/
user admin
password Ysuan@2024

1. Create a gpg key pair

following commands

apt-get update
apt-get install gpg
gpg --gen-key
gpg --list-keys
cd <path to the folder to import the key pair>
gpg --armor --output public.gpg.key --export <gpg key Id>
gpg --armor --output private.gpg.key --export-secret-key <gpg key Id>

A key ID looks like: ‘515F58C16D58E682E91ACEFF17B5C97F9A816AD7’

Minimal configuration steps are:

  • Define Name e.g. apt-hosted
  • Define the Distribution e.g. bionic
  • Put the private pgp key into Signing Key field, as described above
  • Put the passphrase for the private signing key into the Passphrasefield if you have defined one
  • Pick a Blob store for Storage

To use an Apt hosted repository you need to export the gpg public key into your Linux system. Use the public key () from the key pair generated above.public.gpg.key

2.Create a blob store and repo

image-20241114164842505

image-20241114164850294

image-20241114164903159

3. Deploying Packages to Apt Hosted Repositories

The following example uses the command and example credentials of **admin **for user and Ysuan@2024 for password to upload a file to a hosted Apt repository:curl nvidia-gpu-exporter_1.2.1_linux_amd64.deb

curl -u "admin:Ysuan@2024" -H "Content-Type: multipart/form-data" --data-binary "@./nvidia-gpu-exporter_1.2.1_linux_amd64.deb" "http://10.100.1.32:8081/repository/ubuntu22-hosted/"

4. Configuring Apt Client

upload public.gpg.key to /etc/apt/trusted.gpg.d/

edit /etc/apt/sources.list

deb [signed-by=/etc/apt/trusted.gpg.d/public.gpg.key] http://10.100.1.32:8081/repository/ubuntu22-hosted/ jammy main

For a hosted repository you should use the from the repository properties. For a proxy repository, the should be the same as in the original remote repository settings.

You can get the from the table inBrowsing Repositories and Repository Groups via the UI.

test output:

image-20241114164917489