Are you a developer who wants to understand the Setup of RPM and Debian repositories with JFrog Artifactory? Here is a perfect guide to answer your queries through step-by-step demonstrations:
In the previous articles on this JFrog Artifactory series, we have seen the usage of different package types that developers normally use.
JFrog Artifactory also offers support for RPM and Debian packages, which help manage development through remote repositories. You can use it to install RPM packages using YUM on RHEL 7.x or Debian packages using APT on Ubuntu 22. x
In this article, we will see how to set up and use RPM and Debian repositories with JFrog Artifactory.
=> Complete JFrog Guide for ALL
Table of Contents:
RPM and Debian Repositories: Quick Setup Guide
To set up a remote RPM repository, click on Quick Repository Creation.
Select RPM package type.
Provide a prefix and click on Create.
Setup RPM Client to Install Packages
To set up the RPM client on RHEL 7. x select the RPM remote repository and click on Set Me Up. Follow the instructions to set up the artifactory.repo file:
Replace the Password with the Identity token and the PATH_TO_REPODATA_FOLDER with 7/os/x86_64. See the final changes below.
After adding the RPM repository, you can install the package using the following yum install command.
In the below example, we will see how to install wget, php, and python3 using the just-configured RPM repository. In the VM we do not have the packages installed.
Use this command to install the packages from the Artifactory repository:
$ sudo yum install –disablerepo=”*” –enablerepo=”Artifactory” wget php python3
Here you can see that the packages will be installed from the Artifactory repository. Click on Y to install. Post the installation all the packages are installed.
Another example command is to install git:
$ sudo yum –disablerepo=”*” –enablerepo=”Artifactory” install git
Setup and Usage of Debian Repository
In the previous section, we looked at how to set up and install RPM packages using YUM on RHEL 7. x with JFrog Artifactory. In this section, we will look at how to set up and install Debian packages using APT on Ubuntu 22. x.
As shown in the previous section, use the Quick Repository Creation Wizard to create the Debian Remote repository using the Debian package type.
Setup Debian Client to Install Packages
As the Debian remote repository is created, select the same and click on Set Me Up. Follow the instructions to set up the Debian client:
The sources.list file should be updated with the repository details.
The command will be as follows. Replace the following:
DISTRIBUTION= trusty
COMPONENTS = main
sudo sh -c “echo ‘deb https://niranjan:<Token>@vniranjan1972.jfrog.io/artifactory/niranjan-debian-remote trusty main’ >> /etc/apt/sources.list”
Install the package using this command:
$ sudo apt-get install apache2/trusty
Click on Y to install.
As you can see, the installation of the packages is taken from the Artifactory repository only. Run the following commands to look at the repositories from which the packages have been installed.
dpkg -l | grep <packagename> to list all the matching installed packages and run the command apt-cache madison <packagename> to see what repository the package was installed from.
The list of installed packages is from the trusty DISTRIBUTION ONLY which was set earlier.
Using RPM and Debian Local Repositories
Local repositories of RPM and Debian can be set up to hold and share any custom packages for your teams. These packages can be installed once they are stored in the local repository.
So typically the process is to upload the custom packages (RPM or DEB files) to the root of the local repositories of RPM and Debian type, and set up the artifactory.repo / sources.list files and install the package from the local repository.
RPM local repository setup and Install Package
Use the Set Me Up and follow the instructions.
$ sudo vi /etc/yum.repos.d/artifactory.repo
Add the content below based on the local repository of your setup.
[Artifactory] name=Artifactory baseurl=https://niranjan:<PASSWORD>@vniranjan1972.jfrog.io/artifactory/niranjan-rpm-local enabled=1 gpgcheck=0
Replace PASSWORD with the identity token generated from your profile. Use the below YUM command to install the package.
$ sudo yum install –disablerepo=”*” –enablerepo=”Artifactory” <PackageNameAsUploadedInLocalRepo>
Example MySQL 8.0 Community Release install for RHEL 8
I have MySQL 8.0 Community Release RPM files uploaded to the RPM local repository. I will use them to install on RHEL 8 using the below command with YUM.
$ sudo yum install –disablerepo=”*” –enablerepo=”Artifactory” mysql80-community-release
Click on Y to install the RPM file.
Run the below command to install MYSQL
$ sudo yum install mysql-community-server
$ sudo systemctl start mysqld
Debian local repository setup and Install Package
Select the Debian local repository and click on the Deploy button on the right to upload the DEB files. A similar procedure can be followed for RPM files uploaded to the local repository.
Enter the target path as shown and scroll down.
Enter Distribution, Component, and Architecture as shown.
Click on Deploy.
Use Set Me Up in the local repository and follow the instructions.
To use the Artifactory repository to install the Debian package you need to add it to your sources. list file. Run the following command.
$ sudo sh -c “echo ‘deb https:// niranjan:<GeneratedToken>@vniranjan1972.jfrog.io/artifactory/niranjan-debian-local trusty private’ >> /etc/apt/sources.list”
$ sudo apt-get install mysql-client/trusty
Edge Nodes and Distribution
Typically in JFrog Artifactory, the artifacts built are uploaded and downloaded appropriately for deployment. Now, look at a scenario where a team in India is the development team responsible for building artifacts, and a team in say Europe needs the artifacts and their versions for deployment.
In JFrog Artifactory you have Edge nodes whose primary responsibility is to hold the distribution of packages ONLY through a concept called Release Bundles.
A release bundle is like a Software Bill of Material which groups together build artifacts of different types like Docker images or Maven artifacts etc. So this Release Bundle can be created and distributed from a source Artifactory (e.g. SAAS Main) to all Edge nodes The team in Europe can then download and use it for their deployments.
Typical deployments that I have seen as part of the setup in enterprises are that there is one SAAS main instance and the data is then replicated to a DR instance which is used in case of failover or unavailability of the SAAS main instance.
Here, the SAAS main instance which the developers normally use daily, is used as a source site to distribute packages to one or more Edge nodes. This feature is not available in the trial version but is a good feature for the distribution of Release Bundles.
Recommended Reading =>> Installation and Configuration of Open Source DevOps Tools
Conclusion
Hope this additional article for the earlier tutorials on JFrog Artifactory would have given you a bit more information on how Admins in your organization use RPM and Debian packages to support the Development team and also how you would have understood what is Edge node and how to distribute a Release Bundle that contains artifacts of a different type.
Happy reading to all of you and hope you use and implement Artifactory in your organization as part of your DevSecOps cycle.