Rocky Linux Mirror

 

 


官方 Mirror 清單

 

https://mirrors.rockylinux.org/mirrormanager/mirrors

 


官方 Repo

 

https://dl.rockylinux.org/pub/rocky/

 

 


建立 Private Mirror

 

ln -s /usr/share/nginx/html /root/mirror_root

/root/scripts/sync_mirror/sync_mirror.sh

#!/bin/env bash

# Please use a mirror geographically close to you for initial sync
SRC=ftp.udx.icscoe.jp

# sub-folder of web server public path
REPOS_BASE_DIR=/usr/share/nginx/html/rocky

# Filter
SCRIPT_ROOT=/root/scripts/sync_mirror

# Office Key File
KEYS="RPM-GPG-KEY-Rocky-8 RPM-GPG-KEY-Rocky-9"

# Start sync if base repo directory exist
if [[ -d "$REPOS_BASE_DIR" ]] ; then
  # Start Sync
  logger -t rsync "Updating RockyLinux Mirror"
  rsync -avSHP --progress --delete --delete-excluded \
        --filter "P RPM-GPG-KEY-Rocky-*" \
        --delay-updates --exclude="*.~tmp~" --delete-delay \
        --include-from="$SCRIPT_ROOT/include.txt" \
        --exclude-from="$SCRIPT_ROOT/excludes.txt" \
        rsync://$SRC/rocky $REPOS_BASE_DIR
  logger -t rsync "Finished updating RockyLinux Mirror"
  # Repository key
  for key in $KEYS;
  do
    if [ ! -f $REPOS_BASE_DIR/$key ]; then
      wget -nv -P $REPOS_BASE_DIR https://dl.rockylinux.org/pub/rocky/$key
    fi
  done
fi

excludes.txt

## OS Version
8/*
8.4/*
8.5/*
8.6/*
8.7/*
9/*
9.?/*
## Repository
*/Live/*
*/NFV/*
*/PowerTools/*
*/RT/*
*/ResilientStorage/*
*/devel/*
*/images/*
*/isos/*
*/isos/*/*
*/live/*
*/nfv/*
*/plus/*
# Sub-Folder
*/source*
*/aarch64*
*/i686*
# Sub-Sub-Folder
*/debug*
## Other
imagelist-rocky
RPM-GPG-KEY-rocky*
fullfiletimelist-rocky*

include.txt

/*/isos/x86_64/
**/Rocky-*-x86_64-minimal.iso*

 


改用 Local Repo

 

查看有什麼 Repo

dnf repolist

R8 有的 Repo config 有

  • /etc/yum.repos.d/Rocky-AppStream.repo    # R8.8: 16G
  • /etc/yum.repos.d/Rocky-BaseOS.repo         # R8.8: 3G
  • /etc/yum.repos.d/Rocky-Extras.repo           # R8.8: 3.7M

CLI

cd /etc/yum.repos.d/

# Backup file
cp -a Rocky-AppStream.repo{,.bak}
cp -a Rocky-BaseOS.repo{,.bak}
cp -a Rocky-Extras.repo{,.bak}

# Modify config
sed -i 's@^mirrorlist=http/@#mirrorlist=http@g' Rocky-AppStream.repo
sed -i '\@^#baseurl=http@a baseurl=https://X:10443/rocky/$releasever/AppStream/$basearch/os/' Rocky-AppStream.repo

sed -i 's@^mirrorlist=http/@#mirrorlist=http@g' Rocky-BaseOS.repo
sed -i '\@^#baseurl=http@a baseurl=https://X:10443/rocky/$releasever/BaseOS/$basearch/os/' Rocky-BaseOS.repo

sed -i 's@^mirrorlist=http/@#mirrorlist=http@g' Rocky-Extras.repo
sed -i '\@^#baseurl=http@a baseurl=https://X:10443/rocky/$releasever/extras/$basearch/os/' Rocky-Extras.repo

Test

yum update

 


Web Server Settings

 

/etc/nginx/nginx.conf

# Settings for a TLS enabled server.
    server {
        listen       443 ssl http2 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        ssl_certificate     "ssl/datahunter.org/server.pem";
        ssl_certificate_key "ssl/datahunter.org/server.key";
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;
        ssl_ciphers PROFILE=SYSTEM;
        ssl_prefer_server_ciphers on;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
                autoindex on;
                allow 192.168.123.0/24;
                allow R.R.R.R;
                deny  all;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

 

 

Creative Commons license icon Creative Commons license icon