Docs

Adding package repositories

To use one of our APT / YUM repositories you need to configure your machine so that it is aware of the repository and knows about the packages it's hosting.

As all of our package repositories are private and can only be accessed by machines with the correct access keys; an installer is created to help set everything up.

Please ensure you have read through the package repository security documentation to ensure you understand the implications of the access keys being baked into each installer.

Installer

As mentioned above an installer is created when you create the package repository and this can be downloaded from the package repositories page within PKG Deploy. This will ensure that each package repository is added correctly.

All you need to do is copy the installer onto the server and run it. The commands below outline how this is done. This only needs to be done once per machine.

Note: for the commands:

  • A fake organisation called myorg has been used, please replace it with the organisation the repository was created under
  • If you are installing the package on a remote machine. Please replace [email protected] with the correct user and access details for your remote host
  • If you are in the same folder as the installer at the start and it's called myorg-apt-repo-pkgdeploy_1.0.0-1.deb

APT based distributions

$ scp ./myorg-apt-repo-pkgdeploy_1.0.0-1.deb [email protected]:/tmp/

$ ssh [email protected]
$ dpkg -i /tmp/myorg-apt-repo-pkgdeploy_1.0.0-1.deb
$ wget -qO - https://www.pkgdeploy.com/pkgdeploy_gpg.asc | apt-key add -
$ apt update

# Then to check everything is setup correctly
$ grep '^Package:' /var/lib/apt/lists/pkgdeploy-repo-myorg*Packages

YUM based distributions

$ scp ./myorg-apt-repo-pkgdeploy_1.0.0-1.deb [email protected]:/tmp/

$ ssh [email protected]
$ yum install /tmp/myorg-yum-repo-pkgdeploy_1.0.0-1.deb
$ yum clean expire-cache

# Then to check everything is set up correctly
$ yum repolist  # List all of the repository on the machine
$ yum repo-pkgs myorg-pkgdeploy list  # List packages in your repository

Example

Here is an example of the above APT commands being run on a Ubuntu server

Using with containers

Containers are great, we use them for some of our services.

Often YUM and APT installs are used in containers as part of their creation. This is great and supported by PKG Deploy.

As the package repositories we create for you are private you will need to configure the Dockerfile with the installer first:

FROM centos:7

COPY pkgdeploy-repo-installer.deb ./
RUN yum install -y myorg-yum-repo-pkgdeploy_1.0.0-1.deb
RUN yum install -y mypackage
RUN yum remove -y myorg-yum-repo-pkgdeploy
RUN yum clean all

A word of warning

As mentioned in the package repository security documentation the package repository installer includes access keys to the package repository it installs. It is, therefore best practice to remove the package repository installer from the image.

If you accidentally do create and distribute an image with the package repository credentials in it you can roll the credentials. However, although this will require you to update all of the machines which currently have the old access keys on them which could be quite a pain, so you have been warned!