Setup internal yum repositories for CentOS and RedHat Servers Part 3

Setup storage nodes

Setup RHEL7 storage node

Set hostname (example: el7repo)

hostnamectl set-hostname el7repo

Start apache and set to start on boot

systemctl start httpd.service

systemctl enable httpd.service

Create base directory structure

mkdir -p /var/www/html/repo/Package_Diff

Create repo config files (see Setup Note for link to contents)

touch /var/www/html/repo/CentOS-Base.repo

touch /var/www/html/repo/Epel.repo

touch /var/www/html/repo/Redhat.repo

chmod 644 /var/www/html/repo/*.repo

Setup Note: Remember to copy the content from the appropriate files.

Path: /var/www/html/repo/CentOS-Base.repo CentOS-Base.repo

Path: /var/www/html/repo/Epel.repo Epel.repo

Path: /var/www/html/repo/Redhat.repo Redhat.repo

Create scripts directory for sync shell scripts

mkdir /root/scripts

Create repo sync files (see Setup Note for link to contents)

touch /root/scripts/sync_centos_repos.sh

touch /root/scripts/sync_epel_repos.sh

touch /root/scripts/sync_rhel_repos.sh

chmod -R 700 /root/scripts

Setup Note: Remember to copy the content from the appropriate files.

Path: /root/scripts/sync_centos_repos.sh sync_centos_repos.sh

Path: /root/scripts/sync_epel_repos.sh sync_epel_repos.sh

Path: /root/scripts/sync_rhel_repos.sh sync_rhel_repos.sh

Add cron job entries to schedule the repo sync operations

vi /etc/crontab

Insert these entries (scripts will run at 02:15, 02:30, and 02:45 on the 12th day of the month)

15 2 12 * * root /root/scripts/sync_centos_repos.sh

30 2 12 * * root /root/scripts/sync_epel_repos.sh

45 2 12 * * root /root/scripts/sync_rhel_repos.sh

Setup Note: Use any time that makes sense in your environment. The times used are in no way meaningful other than making sure all of the scripts do not start at the same time as they could consume a lot of bandwidth; choking your internet connection.

Configure firewalld rules

Setup firewall rules (firewalld) to allow http connections. If for some reason you aren’t using a firewall then you can skip this.

Configure a default zone with firewalld (The default zone is assumed to already be set as “Internal”)

Add services (or ports) to allowed rules

firewall-cmd --permanent --zone=internal --add-service=httpd

or

firewall-cmd --zone=internal --add-port=80/tcp

Reload the current firewall config

firewall-cmd --reload

Check the interface and verify the services

firewall-cmd --zone=internal --list-services

Sync the remote repositories

Perform an initial sync with the remote repository

cd /root/scripts

./sync_centos_repos.sh

./sync_epel_repos.sh

./sync_rhel_repos.sh

You must be logged in to post a comment.

Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com