From 556985e4fd9111b4df1e99b2f1ba966d152a9212 Mon Sep 17 00:00:00 2001 From: Bryan Date: Wed, 8 Dec 2021 22:43:49 -0500 Subject: [PATCH 1/2] added setup local repo --- docs/gemstones/setup_local_repo.md | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 docs/gemstones/setup_local_repo.md diff --git a/docs/gemstones/setup_local_repo.md b/docs/gemstones/setup_local_repo.md new file mode 100644 index 0000000000..529a605938 --- /dev/null +++ b/docs/gemstones/setup_local_repo.md @@ -0,0 +1,43 @@ +--- +title: Setup Local Rocky Linux Repositories +Author: codedude +--- + +# Introduction +Sometimes you need to have Rocky Repositories local for building virtual machines, lab environments, etc. It can also can help save bandwidth if that is a concern. This article will walk you thru using rsync to copy Rocky repositories to a local web server. Building a web server is out of the scope of this short article. + +## Requirements +A web server + +## Code +``` +#!/bin/bash +repos_base_dir="/web/path" + +# Start sync if base repo directory exist +if [[ -d "$repos_base_dir" ]] ; then + # Start Sync + rsync -avSHP --progress --delete --exclude-from=/opt/scripts/excludes.txt rsync://ord.mirror.rackspace.com/rocky "$repos_base_dir" --delete-excluded + # Download Rocky 8 repository key + if [[ -e /web/path/RPM-GPG-KEY-rockyofficial ]]; then + exit + else + wget -P $repos_base_dir https://dl.rockylinux.org/pub/rocky/RPM-GPG-KEY-rockyofficial + fi +fi +``` +## Breakdown +This simple shell script uses rsync to pull repository files from the nearest mirror. It also utilizes the "exclude" option which is defined in a text file in the form of keywords that shouldnt be included. Excludes are good if you have limited disk space or just dont want everything for whatever reason. We can use '*' as a wildcard character. Be careful using '*/ng' as it will exclude anything that match those characters. An example is below. + +``` +*/source* +*/debug* +*/images* +*/Devel* +8/* +8.4-RC1/* +8.4-RC1 +``` + +# End +A simple script that can help save bandwidth or make building out a lab environment a little easier. From b8ed874c805e42ded7943160db48738db7ec267c Mon Sep 17 00:00:00 2001 From: Steven Spencer Date: Thu, 9 Dec 2021 09:05:47 -0600 Subject: [PATCH 2/2] Editing PR 425 - gemstone for setup of local Rocky repo * edited the meta to include the update date and contributors tags * edited the title meta to shorten the title some so that it fits better in the side menu * added code blocks around `rsync` for clarity * ended up adding code blocks around the * options, as markdown was formatting the quotes instead of showing the * in single or double quotes * a couple of wording corrections "through" instead of "thru"... * added some spacing to give separation to the items when displayed on the web server Thanks again for a great contribution! --- docs/gemstones/setup_local_repo.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/gemstones/setup_local_repo.md b/docs/gemstones/setup_local_repo.md index 529a605938..90c1e59691 100644 --- a/docs/gemstones/setup_local_repo.md +++ b/docs/gemstones/setup_local_repo.md @@ -1,15 +1,20 @@ --- -title: Setup Local Rocky Linux Repositories -Author: codedude +title: Setup Local Rocky Repositories +author: codedude +contributors: Steven Spencer +update: 09-Dec-2021 --- # Introduction -Sometimes you need to have Rocky Repositories local for building virtual machines, lab environments, etc. It can also can help save bandwidth if that is a concern. This article will walk you thru using rsync to copy Rocky repositories to a local web server. Building a web server is out of the scope of this short article. + +Sometimes you need to have Rocky repositories local for building virtual machines, lab environments, etc. It can also help save bandwidth if that is a concern. This article will walk you through using `rsync` to copy Rocky repositories to a local web server. Building a web server is out of the scope of this short article. ## Requirements -A web server -## Code +* A web server + +## Code + ``` #!/bin/bash repos_base_dir="/web/path" @@ -26,8 +31,10 @@ if [[ -d "$repos_base_dir" ]] ; then fi fi ``` -## Breakdown -This simple shell script uses rsync to pull repository files from the nearest mirror. It also utilizes the "exclude" option which is defined in a text file in the form of keywords that shouldnt be included. Excludes are good if you have limited disk space or just dont want everything for whatever reason. We can use '*' as a wildcard character. Be careful using '*/ng' as it will exclude anything that match those characters. An example is below. + +## Breakdown + +This simple shell script uses `rsync` to pull repository files from the nearest mirror. It also utilizes the "exclude" option which is defined in a text file in the form of keywords that shouldnt be included. Excludes are good if you have limited disk space or just dont want everything for whatever reason. We can use `*` as a wildcard character. Be careful using `*/ng` as it will exclude anything that matches those characters. An example is below: ``` */source*