Build a Local CD yum source using CentOS
Guide
When we use the Yum tool to install the software package, we will feel very simple, it solves the dependency of a certain degree of software package. However, the Yum tool provides an online installation method by default. it searches for software packages from the default online address and then automatically completes a series of processes. However, if we do not have a network, we need to build our own local Yum source. Today, Xiaofan of mountain Medical will hand you to build a local CD Yum source.
1. Virtual Machine Settings
Note that the hardware uses the ISO image file and the device is connected.
2. Attach a CD[Root @ nft_server ~] # Mkdir/mnt/cdrom [root @ nft_server ~] # Mount-o loop/dev/cdrom/mnt/cdrom [root @ nft_server ~] # Ls-l/mnt total usage 4dr-xr-xr-x. 7 root 4096 March 6 2013 cdrom
He followed Shan's doctor's Xiao fan and gave his hands to give his commands. Create a cdrom directory under the mnt directory as the mount point and mount the disc here as an access entry.
3. invalidate the network yum Source[root@nft_server ~]# cd /etc/yum.repos.d/[root@nft_server yum.repos.d]# lsCentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo[root@nft_server yum.repos.d]# mkdir repo.dir[root@nft_server yum.repos.d]# mv Centos* ./repo.dir[root@nft_server yum.repos.d]# mv CentOS* ./repo.dir[root@nft_server yum.repos.d]# lsrepo.dir
The way to invalidate the network yum source is to move its configuration file to the repo. dir directory I created, so that the address of the network yum source cannot be read when the yum tool is used.
3. Create and configure the local yum source file[root@nft_server yum.repos.d]# touch chenfan.repo[root@nft_server yum.repos.d]# vim chenfan.repo[root@nft_server yum.repos.d]# cat chenfan.repo#############by chenfan 2016/5/14[chenfan]name=chenfanbaseurl=file:///mnt/cdromgpgcheck=0enabled=1#########by chenfan 2016/5/28
Create a file ending with. repo and add the above content to the file. Note that the baseurl here is the mount point path!
4. Check whether the local yum source is correctly configured.[root@nft_server yum.repos.d]# yum install tree -yLoaded plugins: fastestmirror, securityLoading mirror speeds from cached hostfilechenfan | 4.0 kB 00:00 ...chenfan/primary_db | 4.4 MB 00:00 ...Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package tree.x86_64 0:1.5.3-2.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved======================================================================================================================================================================== Package Arch Version Repository Size========================================================================================================================================================================Installing: tree x86_64 1.5.3-2.el6 chenfan 36 kTransaction Summary========================================================================================================================================================================Install 1 Package(s)Total download size: 36 kInstalled size: 65 kDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : tree-1.5.3-2.el6.x86_64 1/1 Verifying : tree-1.5.3-2.el6.x86_64 1/1Installed: tree.x86_64 0:1.5.3-2.el6Complete!
Here, we mainly install the tree package to check whether the local yum source is correctly configured. It is simple and direct to learn linux with Xiaofan!
Address: http://www.linuxprobe.com/cd-yum-source.html