Standard Operating Procedure (SOP)
Title: Adding a Custom Repository to a Virtual Machine
1. Purpose:
This document outlines the step-by-step procedure to add a custom repository to a virtual
machine (VM) running Linux, ensuring consistency and compliance with system
configurations.
2. Scope:
This procedure applies to all Linux-based virtual machines managed by the organization,
regardless of their hosting environment.
3. Prerequisites:
- Ensure you have administrative or sudo privileges on the virtual machine.
- Confirm the repository URL and its compatibility with the OS version.
- Backup existing repository configurations (optional but recommended).
- Access to the VM either via SSH or console.
4. Responsibilities:
- Linux Administrator: Perform the repository addition process.
- System Owner: Provide repository details and approve changes.
5. Procedure:
Step 1: Access the Virtual Machine
1.1 Use SSH or a console session to log in to the VM.
1.2 Authenticate with appropriate credentials.
Step 2: Validate Current Repositories
2.1 Check existing repository configurations using the appropriate package manager
command:
- For RHEL/CentOS:
yum repolist
or
dnf repolist
- For Ubuntu/Debian:
apt-cache policy
2.2 Take note of active repositories to avoid conflicts.
Step 3: Add the Custom Repository
3.1 Create a new repository file in the appropriate directory:
- For RHEL/CentOS:
sudo nano /etc/[Link].d/[Link]
- For Ubuntu/Debian:
sudo nano /etc/apt/[Link].d/[Link]
3.2 Add repository details as provided. An example for RHEL-based systems:
[custom-repo]
name=Custom Repository
baseurl=[Link]
enabled=1
gpgcheck=1
gpgkey=[Link]
Example for Debian-based systems:
deb [arch=amd64] [Link] buster main
Step 4: Import GPG Key (If Required)
4.1 Import the GPG key for the repository to validate package authenticity:
- For RHEL/CentOS:
sudo rpm --import [Link]
- For Ubuntu/Debian:
wget -qO - [Link] | sudo apt-key
add -
Step 5: Update Repository Cache
5.1 Refresh the repository cache to include the new repository:
- For RHEL/CentOS:
sudo yum makecache
or
sudo dnf makecache
- For Ubuntu/Debian:
sudo apt update
Step 6: Test the Repository
6.1 Validate the repository by installing a test package:
- For RHEL/CentOS:
sudo yum install package-name
or
sudo dnf install package-name
- For Ubuntu/Debian:
sudo apt install package-name
6.2 Confirm that the package is successfully downloaded from the custom repository.
Step 7: Documentation and Verification
7.1 Document the repository addition details, including the repository name, URL, and
configuration.
7.2 Share the details with relevant stakeholders for approval and record-keeping.
6. Rollback Plan:
In case of issues, remove the repository file created in Step 3 and refresh the repository
cache:
- For RHEL/CentOS:
sudo rm -f /etc/[Link].d/[Link]
sudo yum makecache
or
sudo dnf makecache
- For Ubuntu/Debian:
sudo rm -f /etc/apt/[Link].d/[Link]
sudo apt update
7. References:
- Official documentation for YUM/DNF/Apt package managers.
- Organization’s policy for repository management.
8. Approval:
This SOP has been reviewed and approved by:
| Name | Role | Signature | Date |
|---------------------|----------------------|--------------------|------------|
| | | | |