It's possible to use JetPatch when you are working with local repositories. Here is the full guide on how to setup your environment and make sure all repositories are configured correctly and available for Jetpatch usage.
Please note that the instructions below are for setting up local repositories and are not related to JetPatch functionality.
Prerequisites:
- Local repository storage requirements are based on the OS type & number of repositories you are enabling and syncing from. If you are enabling only the repositories mentioned below, 150GB are enough, otherwise- we recommend allocating up to 400 GB. Please refer this for Storage(Specifically the /var/www mount point)
- Local repository Server must have Internet connectivity and Need to Whitelist the Public repository URL’s of Alma-Linux.
- Please take under consideration the 'repo-sync' command, which might take 9-10 hours to complete.
Create dnf Local Repository
1. Install the required packages for creating, configuring and managing your local repository.
dnf install createrepo yum-utils
2. Create the necessary directories (yum repositories) that will store packages and any related information.
mkdir -p /var/www/html/repos/BaseOS
mkdir -p /var/www/html/repos/AppStream
mkdir -p /var/www/html/repos/Extras
3. Use the reposync tool to synchronize CentOS YUM repositories to the local directories as shown.
reposync -p /var/www/html/repos/BaseOS --repo=baseos --download-metadata
reposync -p /var/www/html/repos/AppStream --repo=appstream --download-metadata
reposync -p /var/www/html/repos/Extras --repo=extras --download-metadata
4. Create a new repodata for each repositories by running the following commands.
createrepo /var/www/html/repos/BaseOS/
createrepo /var/www/html/repos/AppStream
createrepo /var/www/html/repos/Extras/
Install and configure Nginx on Repo Server
1. First start by installing Nginx from the EPEL repository using the DNF package manager as follows.
dnf install epel-release
dnf install nginx
2. Once you have installed Nginx, you can start it for the first time and enable and start the service.
systemctl start nginx
systemctl enable nginx
3. To enable viewing of repositories and packages in them, via a web browser, create a Nginx server block which points to the root of your repositories as shown.
vi /etc/nginx/conf.d/repos.conf
Add the following configuration to file repos.conf:
server {
listen 80;
server_name serverIP; #change test.lab to your real domain or IP address
root /var/www/html/;
location / {
index index.php index.html index.htm;
autoindex on; #enable listing of directory index
}
}
4. Next, you need to open port 80 and 443 to allow web traffic to Nginx service, update the system firewall rules to permit inbound packets on HTTP and HTTPS using the commands below
firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-service=https
firewall-cmd –reload
5. Then restart your Nginx server and view the repositories from a web browser using the following URL.
6. Confirm that your Nginx server is up and running, using the following URL; if you see the default Nginx web page, all is well. http://SERVER_DOMAIN_NAME_OR_IP
Create Script and Cron Job to Update Your Repositories
1. Add a cron job that will automatically synchronize your local repos with the official AlmaLinux repos to grab the updates and security patches.
vi /etc/cron.daily/update-localrepos
Add these commands in the script:
#!/bin/bash
##specify all local repositories in a single variable
LOCAL_REPOS=”baseos appstream extras”
##a loop to update repos one at a time
for REPO in ${LOCAL_REPOS}; do
reposync -d --repoid=$REPO --newest-only --download-metadata --download_path=/var/www/html/repos/
createrepo -g comps.xml /var/www/html/repos/$REPO/
done
Save the script and close it and set the appropriate permissions on it.
chmod 755 /etc/cron.daily/update-localrepos
Setting Up Client Servers
Step 4: Setup Local Dnf Repository on Client Machines
1. On your AlmaLinux client machines, add your local repos to the Dnf configuration. (or run the provided script "create-repo-jetpatch-almalinux")
vi /etc/yum.repos.d/local-repos.repo
[local-BaseOS]
name=AlmaLinux_BaseOS
baseurl=http://ServerIP/BaseOS/
gpgcheck=0
enabled=1
priority=1
[local-AppStream]
name=AlmaLinux_AppStream
baseurl=http://ServerIP/AppStream/
gpgcheck=0
enabled=1
priority=1
[local-Extras]
name=AlmaLinux_Extras
baseurl=http://ServerIP/Extras/
gpgcheck=0
enabled=1
priority=1
Save the file and start using your local DNF mirrors.
Use the instructions to learn how to configure local repository on all client servers
2. Run the following command to view your local repos in the list of available YUM repos, on the client machines.
dnf clean all
dnf repolist all
Error Handling
1. If you're encountering the following error when installaing nginx: yum error “Cannot retrieve metalink for repository: epel. Please verify its path and try again” updating ContextBroker
Solution:
Edit both /etc/yum.repos.d/epel.repo and /etc/yum.repos.d/epel-testing.repo files commenting all entries starting with mirrorlist=... and uncommenting all the entries starting with baseurl=.... ;
run again
dnf install nginx
2. If files do not appear when viewing the repositories from web browser:
Solution Try restoring context to default :
restorecon -R /var/www/html/repos
3. If you have any issues such as Error 404 page not found it might be related to your nginx configuration. To view nginx errors go to /var/log/nginx/error.log . Errors might be related to nginx configuration (etc/nginx/conf.d/repos.conf). Please make sure you configured it properly.
4. In case you have changed configurations (in repo server) do not forget to run 'dnf clean all' and 'dnf repolist all' afterwards. If you have changed nginx conf. restart nginx service.
Comments
0 comments
Please sign in to leave a comment.