It's possible to use JetPatch when you are working with local repositories. Here is the full guide on how to setup a centOS 8 local repositories. This userguide makes sure that all repositories are configured correctly and available for Jetpatch usage.
Please note that the instructions below are for setting up external repositories and are not related to Jetpatch.
Before we start:
- Local repository hardware specifications is based on the number of endpoints connecting to the repo
- Each operating system should have its own repository server, for centOS8 you should have a didected centOS8 server
- Local repository must have Internet connectivity
- This example configures [BaseOS], [AppStream], [extras] mirror repositories that are enabled by default on CentOS 8. You can always configure more / less repositories based on your comapny needs.
Step 1: Setup Local Repository Server
Install httpd on repo server:
1. Install and start apache httpd service
yum install httpd
2. Rename or remove welcome page
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.org
3. Configure httpd. Replace Server name to your own environment.
# Edit httpd.conf file
vi /etc/httpd/conf/httpd.conf
# Change to admin's email address
ServerAdmin root@jetpatch.local
# Change to your server's name
ServerName <servername>:80
# Change (remove [Indexes])
Options FollowSymLinks
# Change
AllowOverride All
# Add file name that it can access only with directory's name
DirectoryIndex index.html index.php index.cgi
# add follows to the end
# server's response header
ServerTokens Prod
4. Enable httpd
systemctl enable --now httpd
5. If Firewalld is running, allow HTTP service. HTTP uses 80/TCP.
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
Create Repositories and run reposync
1. Before we start creating the dir. make sure yum-utils is installed
yum install yum-utils
2. Create repositories (for BaseOS, extras and Appstrea,) and sync from official CentOS8 repositories.
# create parent directory for all repositories
mkdir -p /var/www/repos/centos/8/x86_64/os
# grant permissions (read and execute)
chmod -R 755 /var/www/repos
3. Copy packages from official repositories using the reposync command.
Please note : The reposync might take time. We highly recommend running it after working hours. Also, you might want to consider limiting the bandwith apt-mirror
# copy from official repository for [BaseOS] , [AppStream] and [extras]
reposync -p /var/www/repos/centos/8/x86_64/os/ --repo=BaseOS --download-metadata
reposync -p /var/www/repos/centos/8/x86_64/os/ --repo=AppStream --download-metadata
reposync -p /var/www/repos/centos/8/x86_64/os/ --repo=extras --download-metadata
4. Create a reposync cron task (copy packages) to the daily jobs :
vi /etc/cron.daily/update-repo
# create new
#!/bin/bash
VER='8'
ARCH='x86_64'
REPOS=(BaseOS AppStream extras)
for REPO in ${REPOS[@]}
do
reposync -p /var/www/repos/centos/${VER}/${ARCH}/os/ --repo=${REPO} --download-metadata --newest-only
done
# grant permissions
chmod 755 /etc/cron.daily/update-repo
5. Configure Apache httpd to provide repository for other Client Hosts
vi /etc/httpd/conf.d/repos.conf
# create new
Alias /repos /var/www/repos
<directory /var/www/repos>
Options +Indexes
Require all granted
</directory>
Save and exit the repos.conf file
6. Restart httpd service
systemctl restart httpd
7. If Firewalld is running, allow HTTP service.
Done!
Step 2: Setup client servers
On Client Hosts, Change settings of Yum to refer to Local Yum Mirror Host. Every repository has its own configuration file that should be modified. Make sure you modify the .repo files for all the configured repositories you enabled and synced on your local repo server.
1. Edit [BaseOS] configuration file
vi /etc/yum.repos.d/CentOS-Base.repo
# change to local mirror server
[BaseOS]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
baseurl=http://<repository server name or IP>/repos/centos/$releasever/$basearch/os/BaseOS/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
priority=1
2. Edit [AppStream] configuration file
[AppStream]
name=CentOS-$releasever - AppStream
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
baseurl=http://<repository server name or IP>/repos/centos/$releasever/$basearch/os/AppStream/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
priority=1
3. Edit [extras] configuration file
vi /etc/yum.repos.d/CentOS-Extras.repo
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/
baseurl=http://<repository server name or IP>/repos/centos/$releasever/$basearch/os/extras/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
priority=1
You're all set !
Comments
0 comments
Please sign in to leave a comment.