Configuring a Yum Repository
Configure the Yum repository properly to install the required software and dependencies.
- If you have access to the Internet, see Configuring a Yum Repository from the Internet.
- If the Internet connection is unavailable, see Configuring the Local Yum Repository (openEuler).
Configuring a Yum Repository from the Internet
- Run the curl command to access any website. If the website information is displayed, the proxy is successfully configured and the Internet is connected.
- Check the Yum repository (a .repo file). If it is available, go to 7.
1ls /etc/yum.repos.d/ - Back up the Yum repository to the bak directory.
1 2 3
cd /etc/yum.repos.d mkdir bak mv *.repo bak
- Open the following file.
1vi /etc/yum.repos.d/openEuler.repo - Press i to enter the insert mode.
- If the OS is openEuler 22.03 LTS SP3, modify the file content as follows:
#generic-repos is licensed under the Mulan PSL v2. #You can use this software according to the terms and conditions of the Mulan PSL v2. #You may obtain a copy of Mulan PSL v2 at: # http://license.coscl.org.cn/MulanPSL2 #THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR #IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR #PURPOSE. #See the Mulan PSL v2 for more details. [OS] name=OS baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/OS/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/OS&arch=$basearch metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/OS/$basearch/RPM-GPG-KEY-openEuler [everything] name=everything baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/everything/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/everything&arch=$basearch metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/everything/$basearch/RPM-GPG-KEY-openEuler [EPOL] name=EPOL baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/EPOL/main/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/EPOL/main&arch=$basearch metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/OS/$basearch/RPM-GPG-KEY-openEuler [debuginfo] name=debuginfo baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/debuginfo/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/debuginfo&arch=$basearch metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/debuginfo/$basearch/RPM-GPG-KEY-openEuler [source] name=source baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/source/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever&arch=source metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/source/RPM-GPG-KEY-openEuler [update] name=update baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/update/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/update&arch=$basearch metadata_expire=1h enabled=0 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/OS/$basearch/RPM-GPG-KEY-openEuler [update-source] name=update-source baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/update/source/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever&arch=source metadata_expire=1h enabled=0 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP3/source/RPM-GPG-KEY-openEuler
- If the OS is openEuler 22.03 LTS SP4, modify the file content as follows:
#generic-repos is licensed under the Mulan PSL v2. #You can use this software according to the terms and conditions of the Mulan PSL v2. #You may obtain a copy of Mulan PSL v2 at: # http://license.coscl.org.cn/MulanPSL2 #THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR #IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR #PURPOSE. #See the Mulan PSL v2 for more details. [OS] name=OS baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/OS/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/OS&arch=$basearch metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/OS/$basearch/RPM-GPG-KEY-openEuler [everything] name=everything baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/everything/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/everything&arch=$basearch metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/everything/$basearch/RPM-GPG-KEY-openEuler [EPOL] name=EPOL baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/EPOL/main/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/EPOL/main&arch=$basearch metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/OS/$basearch/RPM-GPG-KEY-openEuler [debuginfo] name=debuginfo baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/debuginfo/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/debuginfo&arch=$basearch metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/debuginfo/$basearch/RPM-GPG-KEY-openEuler [source] name=source baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/source/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever&arch=source metadata_expire=1h enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/source/RPM-GPG-KEY-openEuler [update] name=update baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/update/$basearch/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever/update&arch=$basearch metadata_expire=1h enabled=0 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/OS/$basearch/RPM-GPG-KEY-openEuler [update-source] name=update-source baseurl=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/update/source/ metalink=https://mirrors.openeuler.org/metalink?repo=$releasever&arch=source metadata_expire=1h enabled=0 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-22.03-LTS-SP4/source/RPM-GPG-KEY-openEuler
- If the OS is openEuler 22.03 LTS SP3, modify the file content as follows:
- Press Esc to exit the insert mode. Type :wq! and press Enter to save the file and exit.
- Make the Yum repository take effect.
1 2 3
yum clean all yum makecache yum list
Configuring the Local Yum Repository (openEuler)
- Download the OS image file as required. For details about the download address, see Table 2.
- Mount the OS image file. This step uses the Arm-based OS image file as an example. The procedure for mounting the x86-based OS image file is similar.
- Method 1: Upload the OS image file to the /root directory and mount it to the /mnt directory.
- openEuler 22.03 LTS SP3
1mount /root/openEuler-22.03-LTS-SP3-everything-aarch64-dvd.iso /mnt
- openEuler 22.03 LTS SP4
1mount /root/openEuler-22.03-LTS-SP4-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.- Open the fstab file.
1vim /etc/fstab - Press i to enter the insert mode and add the following content to the end of the file.
- openEuler 22.03 LTS SP3
1/root/openEuler-22.03-LTS-SP3-everything-aarch64-dvd.iso /mnt iso9660 loop 0 0
- openEuler 22.03 LTS SP4
1/root/openEuler-22.03-LTS-SP4-everything-aarch64-dvd.iso /mnt iso9660 loop 0 0
- openEuler 22.03 LTS SP3
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the fstab file.
- openEuler 22.03 LTS SP3
- Method 2: Use a browser to log in to the BMC and use the KVM to load the OS image file.
- Check the device symbol corresponding to the OS image.
1ls /dev/sr* - Mount the OS image file to the /mnt directory.
1 2 3
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 2.a.
- Check the device symbol corresponding to the OS image.
- Method 1: Upload the OS image file to the /root directory and mount it to the /mnt directory.
- Back up the Yum repository.
1 2 3
cd /etc/yum.repos.d mkdir bak mv *.repo bak
- Configure the local Yum repository.
- Go to the /etc/yum.repos.d directory.
1cd /etc/yum.repos.d
- Create a local.repo file.
- Open the local.repo file.
1vim local.repo - 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
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Check the local.repo file.
1cat local.repo
- Open the local.repo file.
- Go to the /etc/yum.repos.d directory.
- Make the Yum repository take effect.
1 2 3
yum clean all yum makecache yum list
Parent topic: Configuring the Compilation Environment