Configuring the OS Yum, APT, or Zypper Source
Skip this section if the OS environment can access the Internet and the default Yum, APT, or Zypper source of the OS is available.
Configuring the OS Yum Source (for CentOS/EulerOS/openEuler/RHEL/NeoKylin/Kylin/BC-Linux/iSoft)
The following describes how to configure the Yum source on CentOS 7.6. The configuration procedure is the same for other OSs.
- Download the CentOS image file CentOS-7-x86_64-Everything-1810.iso from the CentOS official website.
- Use an SSH remote login tool to upload the CentOS 7.6 image to the /root directory.
- Use an SSH tool to remotely log in to the CentOS CLI.
- Run the following command to mount the CentOS 7.6 ISO image to a local directory:
1mount /root/CentOS-7-x86_64-Everything-1810.iso /media -o loop
If the OS is restarted, you need to mount the image file again.
- Run the following commands to back up the original Yum source. In the mv command, path indicates the backup directory. Replace it with the actual backup directory.
1 2
cd /etc/yum.repos.d/ mv ./* path
- Configure the Yum source.
- Run the following command to open the media.repo file.
1vi /etc/yum.repos.d/media.repo - Press i to enter the insert mode and add the following content to the media.repo file:
1 2 3 4 5 6 7
[InstallMedia] name=CentOS7.6 metadata_expire=-1 gpgcheck=0 cost=500 baseurl=file:///media enabled=1
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Run the following command to open the media.repo file.
- Run the following commands to update the local cache information of the Yum source:
1 2
yum clean all yum makecache
Configuring the APT Source (for Ubuntu/Debian/Deepin/Linx/UOS)
The following describes how to configure the APT source on Ubuntu 18.04.1. The configuration procedure is the same for other OSs.
- Download the Ubuntu image file ubuntu-18.04.1-server-amd64.iso from the Ubuntu official website.
- Use an SSH remote login tool to upload the Ubuntu 18.04.1 image to the /root directory.
- Use an SSH tool to remotely log in to the Ubuntu CLI.
- Run the following command to mount the Ubuntu 18.04.1 ISO image to a local directory:
1mount /root/ubuntu-18.04.1-server-amd64.iso /media -o loop
- If the OS is restarted, you need to mount the image file again.
- Some installation packages are missing in the local image sources of Debian OSs. Download the required installation packages from the Internet or using a proxy. The dependencies are listed as follows. If you cannot access the Internet or configure a proxy, check, download, and install the dependencies manually.
expect GCC make zlib1g zlib1g-dev libpcre3 libpcre3-dev OpenSSL libssl-dev
You can run the following commands to query and install dependency packages:
1 2
dpkg -l Installation_package_name dpkg -i Installation_package_name
- Run the following commands to back up the original APT source:
1 2
cd /etc/apt mv -v sources.list{,.bak}
- Configure the APT source.
- Run the following command to open the sources.list file.
1vi sources.list - Add the following content to the sources.list file:
1deb file:///media wheezy main
In the preceding command, wheezy main is the directory where Packages is located. Replace it with the actual directory.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Run the following command to open the sources.list file.
- Run the following command to update the local cache information of the APT source:
1apt update
Configuring the Zypper Source (for SUSE)
- Download the SUSE image file SLE-15-SP1-Packages-x86_64-GM-DVD1.iso from the SUSE official website.
- Use an SSH tool to remotely log in to the SUSE CLI and upload the SUSE image to the /root directory.
- Run the following command to mount the SUSE ISO image to a local directory:
1mount /root/SLE-15-SP1-Packages-x86_64-GM-DVD1.iso /media -o loop
If the OS is restarted, you need to mount the image file again.
- Run the following command to add the local Zypper source. local indicates the local source name.
1zypper ar file:///media/ local
- Run the following command to check whether the local source is configured successfully:
1zypper lrIf command output is displayed, the local source is configured successfully.
1 2 3 4
Repository priorities are without effect. All enabled repositories share the same priority. # | Alias | Name | Enabled | GPG Check | Refresh --+-------+-------+---------+-----------+-------- 1 | local | local | Yes | ( p) Yes | No
- Clear the local cache and refresh the image source.
1 2
zypper clean zypper ref