Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Offline and Online Yum Repository Configuration for CentOS 6.7

Tech Apr 23 34

Offline Local Yum Repository Setup

  1. Prepare ISO Storage and Mount Points

    mkdir -p /app/centos-iso-mount
    mkdir -p /data/iso-files
    

    Upload the CentOS-6.7-x86_64-bin-DVD1.iso file to /data/iso-files.

  2. Mount the ISO Image

    mount -o loop /data/iso-files/CentOS-6.7-x86_64-bin-DVD1.iso /app/centos-iso-mount
    
  3. Adjust Yum Repository Configuration Files Navigate to the yum configuration directory and disable network-based repos by renaming them:

    cd /etc/yum.repos.d/
    mv CentOS-Base.repo CentOS-Base.repo.offline
    mv CentOS-Vault.repo CentOS-Vault.repo.offline
    mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.offline
    
  4. Create or Edit Local Media Repo Open CentOS-Local-Media.repo with a text editor and add the following content:

    [c6-local]
    name=CentOS-$releasever - Local ISO
    baseurl=file:///app/centos-iso-mount/
    gpgcheck=0
    enabled=1
    
  5. Clear Yum Cache and Test Installation

    yum clean all
    yum install -y git
    
  6. Enable Persistent ISO Mount on Boot Add the mount command to /etc/rc.d/rc.local:

    echo 'mount -o loop /data/iso-files/CentOS-6.7-x86_64-bin-DVD1.iso /app/centos-iso-mount' >> /etc/rc.d/rc.local
    chmod +x /etc/rc.d/rc.local
    

Online Vault-Based Yum Repository Setup

CentOS 6 reached end-of-life in November 2020, so standard public mirrors no longer serve updates. The Alibaba Cloud vault provides archvied packages. Follow these steps:

  1. Disable Fastest Mirror Plugin

    sed -i 's|enabled=1|enabled=0|g' /etc/yum/pluginconf.d/fastestmirror.conf
    
  2. Backup Existing Base Repo

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    
  3. Download and Apply Vault Repo File

    curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6-vault.repo
    
  4. Clear and Rebuild Yum Cache

    yum clean all
    yum makecache
    

Manual Vault Repo File Content

If the curl command fails, create /etc/yum.repos.d/CentOS-Base.repo manually with:

[base]
name=CentOS-6.10 - Base - Aliyun Vault
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[updates]
name=CentOS-6.10 - Updates - Aliyun Vault
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[extras]
name=CentOS-6.10 - Extras - Aliyun Vault
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[centosplus]
name=CentOS-6.10 - Plus - Aliyun Vault
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

[contrib]
name=CentOS-6.10 - Contrib - Aliyun Vault
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

Related Articles

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

SBUS Signal Analysis and Communication Implementation Using STM32 with Fus Remote Controller

Overview In a recent project, I utilized the SBUS protocol with the Fus remote controller to control a vehicle's basic operations, including movement, lights, and mode switching. This article is aimed...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.