Kubeops RPM Repository Setup Guide #
Setting up a new RPM repository allows for centralized, secure, and efficient distribution of software packages, simplifying installation, updates, and dependency management.
Prerequisites #
To setup a new repostory on your KubeOps platform, following pre-requisites must be fulfilled.
- httpd (apache) server to access the repository over HTTP.
- Root or administrative access to the server.
- Software packages (RPM files) to include in the repository.
createrepo
(an RPM package management tool) to create a new repository.
Repository Setup Steps #
1. Install Required Tools #
sudo yum install -y httpd createrepo
2. Create Repository Dierectory #
When Apache is installed, the default Apache VirtualHost DocumentRoot
created at /var/www/html
. Create a new repository KubeOpsRepo
under DocumentRoot
.
sudo mkdir -p /var/www/html/KubeOpsRepo
3. Copy RPM Packages #
Copy RPM packages into KubeOpsRepo
repository.
Use below command to copy the packages that are already present in the host machine, else directly populate the packages into KubeOpsRepo
sudo cp -r <sourcePathForRPMs> /var/www/html/KubeOpsRepo/
4. Generate the GPG Signature (optional) #
If you want to use your packages in a secure way, we recommend using GPG Signature.
How does the GPG tool work? #
The
GNU Privacy Guard (GPG)
is used for secure communication and data integrity verification.
Whengpgcheck
set to 1 (enabled), the package will verify the GPG signature of each packages against the correponding key in the keyring. If the package’s signature matches the expected signature, the package is considered valid and can be installed. If the signature does not match or the package is not signed, the package manager will refuse to install the package or display a warning.
GPG Signature for new registry #
-
Create a GPG key and add it to the
/var/www/html/KubeOpsRepo/
. Check here to know how to create GPG keypairs. -
Save the GPG key as
RPM-GPG-KEY-KubeOpsRepo
using following command.
sudo cd /var/www/html/KubeOpsRepo/
gpg --armor --export > RPM-GPG-KEY-KubeOpsRepo
You can use following command to verify the gpg key.
curl -s http://<ip-address-of-server>/KubeOpsRepo/RPM-GPG-KEY-myrepo
5. Initialize the KubeOpsRepo #
By running createrepo
command the KubeOpsRepo
will be initialized.
sudo cd /var/www/html/KubeOpsRepo/
sudo createrepo .
The newly created directoryrepodata
conatains metadata files that describe the RPM packages in the repository, including package information, dependencies, and checksums, enabling efficient package management and dependency resolution.
6. Start and Enable Apache Service #
sudo systemctl start httpd
sudo systemctl enable httpd
Configure Firewall (Optional) #
If the firewall is enabled, we need to allow incoming HTTP traffic.
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload
7. Configure the local repository #
To install packages from KubeOpsRepo
without specifying the URL everytime, we can configure the local repository. Also if you are using GPG signature, then gpgcheck
needs to be enabled.
- Create a Repository Configuration File
Create a new.repo
configuration file (e.g.KubeOpsRepo.repo
) in/etc/yum.repos.d/
directory with following command.
sudo vi /etc/yum.repos.d/KubeOpsRepo.repo
- Add following confuration content to the File
[KubeOpsRepo]
name=KubeOps Repository
baseurl=http://<ip-address-of-server>/KubeOpsRepo/
enabled=1
gpgcheck=1
gpgkey=http://<ip-address-of-server>/KubeOpsRepo/RPM-GPG-KEY-KubeOpsRepo
Below are the configuration details :
KubeOpsRepo
: It is the repository ID.baseurl
: It is the base URL of the new repository. Add your repository URL here.name
: It can be customized to a descriptive name.enabled=1
: This enables the the repository.gpgcheck=1
: It is used to enable GPG signature verification for the repository.gpgkey
: Add the address where your GPG key is placed.
In case, you are not using the GPG signature verification
1. you can skip step 4
and
2. set the gpgcheck=0 in the above configuration file.
8. Test the Local Repository #
To ensure that the latest metadata for the repositories available, you can run below command: (optional)
sudo yum makecache
To verify the repository in list #
You can check the reposity in the repolist with following command :
sudo yum repolist
This will list out all the repositories with the information about the repositories.
[root@cluster3admin1 ~]# yum repolist Updating Subscription Management repositories. repo id repo name KubeOpsRepo KubeOps Repository rhel-8-for-x86_64-appstream-rpms Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) rhel-8-for-x86_64-baseos-rpms Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
To List all the packages in repository #
You can list all the packages availbale in KubeOpsRepo
with following command :
# To check all the packages including duplicate installed packages
sudo yum list available --disablerepo="*" --enablerepo="KubeOpsRepo" --showduplicates
# sudo yum list --showduplicates | grep KubeOpsRepo
To Install the Packages from the repository directly #
Now you can directly install the packages from the KubeOpsRepo Repository with following command :
sudo yum install package_name
For Example :
sudo yum install lima