構建本地Yum源
2、/mnt 目錄創建目錄repos,存放之後掛載的光驅文件信息
[root@hmaster mnt]# mkdir repos
[root@hmaster mnt]# ls
repos
[root@hmaster mnt]# pwd
/mnt
3、臨時掛載光驅到/mnt/repos/目錄,並查看掛載後生成的文件目錄信息,Packages包含許多RPM軟件安裝包
[root@hmaster dev]# mount /dev/cdrom /mnt/repos/
mount: /dev/sr0 is write-protected, mounting read-only
[root@hmaster repos]# pwd
/mnt/repos
[root@hmaster repos]# ls
CentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages repodata RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL
[root@hmaster repos]#
4、配置
[base]
name=CentOS-my
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
gpgcheck=0
Enabled=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[root@hmaster repos]# cd /etc/yum.repos.d/
[root@hmaster yum.repos.d]# ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo
[root@hmaster yum.repos.d]# vim CentOS-Base.repo
Yum clean all
Yum makecache
Vim /etc/fstab 設置開機自動掛載:
/dev/mapper/centos-root / xfs defaults 0 0
UUID=ace745bb-2d4c-46e0-8be3-0897c52d3b23 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
下載或拷貝CentOS或RedHat的iso鏡像到本地,比如 /usr/local/src/CentOS-6.4-x86_64-bin-DVD1.iso
Vim /etc/fstab 設置開機自動掛載:
#掛載iso
/usr/local/src/CentOS-6.4-x86_64-bin-DVD1.iso /mnt/cdrom1 iso9660 loop,defaults 0 0
執行 mount -a 自動檢測並激活掛載,若未報錯,執行df -h即可看到結果。
構建本地Yum源