Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring the Yum Source

Configure the yum source properly to install the required software and dependencies. Select the appropriate yum source configuration method based on your network condition and OS type.

Configuring the Internet Yum Source

  1. Run the curl command to access any website. If the website information is displayed, the proxy is successfully configured and the Internet is connected.
  2. Check for the yum source (a .repo file). If it is available, go to 6.
    1
    ls /etc/yum.repos.d/
    
  3. Back up the yum source to the bak directory.
    1
    2
    3
    cd /etc/yum.repos.d
    mkdir bak
    mv *.repo bak
    
  4. Configure the Internet yum source.
    • CentOS 7.6:
      1
      wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.huaweicloud.com/repository/conf/CentOS-AltArch-7.repo
      
    • CentOS 8.1:
      1
      wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo
      

    If wget is not installed, run the following command to install it:

    yum -y install wget
  5. Check the yum source.
    • CentOS 7.6:
      1
      2
      ls /etc/yum.repos.d/
      cat /etc/yum.repos.d/CentOS-Base.repo
      
    • CentOS 8.1:
      1
      2
      sed -i "s/\$releasever/8-stream/g" /etc/yum.repos.d/CentOS-Base.repo
      cat /etc/yum.repos.d/CentOS-Base.repo
      
  6. Make the yum source take effect.
    1
    2
    3
    yum clean all
    yum makecache
    yum list
    

Configuring the Internet Yum Source (openEuler)

  1. Run the curl command to access any website. If the website information is displayed, the proxy is successfully configured and the Internet is connected.
  2. Check for the yum source (a .repo file). If it is available, go to 7.
    ls /etc/yum.repos.d/
  3. Back up the yum source to the bak directory.
    1
    2
    3
    cd /etc/yum.repos.d
    mkdir bak
    mv *.repo bak
    
  4. Open the file.
    vi /etc/yum.repos.d/openEuler.repo
  5. Press i to enter the insert mode.
    • If the OS is openEuler 20.03, modify the file content as follows:
      [OS]
      name=OS
      baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/OS/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/OS/$basearch/RPM-GPG-KEY-openEuler
      [EPOL]
      name=EPOL
      baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/EPOL/update/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/OS/$basearch/RPM-GPG-KEY-openEuler
      [debuginfo]
      name=debuginfo
      baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/debuginfo/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/debuginfo/$basearch/RPM-GPG-KEY-openEuler
      [source]
      name=source
      baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/source/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/source/RPM-GPG-KEY-openEuler
      [update]
      name=update
      baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/update/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/OS/$basearch/RPM-GPG-KEY-openEuler
      [everything]
      name=everything
      baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/$basearch/RPM-GPG-KEY-openEuler
    • If the OS is openEuler 22.03, modify the file content as follows:
      [OS]
      name=OS
      baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/OS/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/OS/$basearch/RPM-GPG-KEY-openEuler
      
      [everything]
      name=everything
      baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/everything/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/everything/$basearch/RPM-GPG-KEY-openEuler
      
      [EPOL]
      name=EPOL
      baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/EPOL/main/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/OS/$basearch/RPM-GPG-KEY-openEuler
      
      [debuginfo]
      name=debuginfo
      baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/debuginfo/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/debuginfo/$basearch/RPM-GPG-KEY-openEuler
      
      [source]
      name=source
      baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/source/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/source/RPM-GPG-KEY-openEuler
      
      [update]
      name=update
      baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/update/$basearch/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/OS/$basearch/RPM-GPG-KEY-openEuler
      
      [update-source]
      name=update-source
      baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/update/source/
      enabled=1
      gpgcheck=1
      gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP1/source/RPM-GPG-KEY-openEuler
  6. Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
  7. Make the yum source take effect.
    1
    2
    3
    yum clean all
    yum makecache
    yum list
    

Configuring the Local Yum Source (CentOS & openEuler)

  1. Download the OS image file.
  2. Mount the OS image file.
    • Method 1: Upload the OS image file to the /root directory and mount it to the /mnt directory.
      • CentOS 7.6:
        1
        mount /root/CentOS-7-aarch64-Everything-1810.iso /mnt
        
      • CentOS 8.1:
        1
        mount /root/CentOS-8.1.1911-aarch64-dvd1.iso /mnt
        
      • openEuler 20.03:
        1
        mount /root/openEuler-20.03-LTS-SP1-everything-aarch64-dvd.iso /mnt
        
      • openEuler 22.03:
        mount /root/openEuler-22.03-LTS-SP1-everything-aarch64-dvd.iso /mnt
        Rename the ISO file based on your requirements. The renaming operation takes effect only once and becomes invalid after a system restart. You can perform the following operations for the image file to be automatically mounted upon system startup.
        1. Open the fstab file:
          1
          vim /etc/fstab
          
        2. Press i to enter the insert mode and add the following content to the end of the file:
          • CentOS 7.6:
            1
            /root/CentOS-7-aarch64-Everything-1810.iso /mnt iso9660 loop 0 0
            
          • CentOS 8.1:
            1
            /root/CentOS-8.1.1911-aarch64-dvd1.iso /mnt iso9660 loop 0 0
            
          • openEuler 20.03:
            1
            /root/openEuler-20.03-LTS-SP1-everything-aarch64-dvd.iso /mnt iso9660 loop 0 0
            
          • openEuler 22.03:
            /root/openEuler-22.03-LTS-SP1-everything-aarch64-dvd.iso /mnt iso9660 loop 0 0
        3. Press Esc, type :wq!, and press Enter to save the file and exit.
      Method 2: Use a browser to log in to the BMC and use the KVM to load the OS image file.
      1. Check the device symbol corresponding to the OS image.
        ls /dev/sr*
      2. Mount the OS image file to the /mnt directory.
        mount /dev/sr0 /mnt
        df -h | grep /mnt
        ls /mnt/

        /dev/sr0 is the device symbol corresponding to the OS image, which must be the same as that queried in 1.

  3. Back up the yum source.
    1
    2
    3
    cd /etc/yum.repos.d
    mkdir bak
    mv *.repo bak
    
  4. Configure the local yum source.
    1. Go to the /etc/yum.repos.d directory.
      1
      cd /etc/yum.repos.d
      
    2. Create a local.repo file.
      1. Open the local.repo file.
        1
        vim local.repo
        
      2. Press i to enter the insert mode and add the following content to the file:
        1
        2
        3
        4
        5
        [local]
        name=local.repo
        baseurl=file:///mnt
        enabled=1
        gpgcheck=0
        

        In baseurl, the file path indicates the path for mounting the image, which is the directory /mnt in 2.

      3. Press Esc, type :wq!, and press Enter to save the file and exit.
      4. Check the local.repo file.
        cat local.repo
  5. Make the yum source take effect.
    1
    2
    3
    yum clean all
    yum makecache
    yum list