1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > CentOS6.5 将安装光盘作为yum源

CentOS6.5 将安装光盘作为yum源

时间:2020-11-14 12:08:10

相关推荐

CentOS6.5 将安装光盘作为yum源

前言

网上找适合CentOS6.5的yum源很困难了替代方案,将安装光盘作为yum源我用的是VMware虚拟机。嗯,虚拟机还可以挂光盘,那要是云主机呢?可以考虑将文件拷贝到云主机的某个目录,将该目录作为yum源。CentOS6.5 CD: CentOS-6.5-x86_64-bin-DVD1.iso

基本步骤

VMware虚拟机已经添加好光驱,光驱中放上CentOS6.5安装盘。mount命令查看是否已经挂接了光驱。如果已挂接,直接看

未挂接是这样的:

shell> mount/dev/mapper/VolGroup-lv_root on / type ext4 (rw)proc on /proc type proc (rw)sysfs on /sys type sysfs (rw)devpts on /dev/pts type devpts (rw,gid=5,mode=620)tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")/dev/sda1 on /boot type ext4 (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

已挂接是这样的:

shell> mount/dev/mapper/VolGroup-lv_root on / type ext4 (rw)proc on /proc type proc (rw)sysfs on /sys type sysfs (rw)devpts on /dev/pts type devpts (rw,gid=5,mode=620)tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")/dev/sda1 on /boot type ext4 (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)/dev/sr0 on /mnt/cdrom type iso9660 (ro)

创建光驱挂载点

shell> mkdir /mnt/cdrom

挂载光驱

shell> mount /dev/sr0 /mnt/cdrommount: block device /dev/sr0 is write-protected, mounting read-onlyshell> mount/dev/mapper/VolGroup-lv_root on / type ext4 (rw)proc on /proc type proc (rw)sysfs on /sys type sysfs (rw)devpts on /dev/pts type devpts (rw,gid=5,mode=620)tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")/dev/sda1 on /boot type ext4 (rw)none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)/dev/sr0 on /mnt/cdrom type iso9660 (ro)

配置yum源

先备份

shell> cd /etc/yum.repos.d/shell> mv CentOS-Base.repo CentOS-Base.repo.backupshell> mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.backupshell> mv CentOS-Vault.repo CentOS-Vault.repo.backupshell> cp CentOS-Media.repo CentOS-Media.repo.backupshell> lsCentOS-Base.repo.backup CentOS-Media.repo CentOS-Vault.repo.backupCentOS-Debuginfo.repo.backup CentOS-Media.repo.backup

再修改

shell> vi /etc/yum.repos.d/CentOS-Media.repo----------------------------[c6-media]name=CentOS-$releasever - Media# 挂载的光盘路径baseurl=file:///mnt/cdrom/gpgcheck=1# 启用此yum源enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

检查yum源

shell> yum repolistLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfilerepo id repo namestatusc6-media CentOS-6 - Media 6,364+3repolist: 6,364

查看yum源中是否有wget

shell> yum info wgetLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfileAvailable PackagesName : wgetArch : x86_64Version: 1.12Release: 1.8.el6Size : 482 kRepo : c6-mediaSummary: A utility for retrieving files using the HTTP or FTP protocolsURL : /software/wget/License: GPLv3+ and GFDLDescription : GNU Wget is a file retrieval utility which can use either the HTTP or: FTP protocols. Wget features include the ability to work in the: background while you are logged out, recursive retrieval of: directories, file name wildcard matching, remote file timestamp: storage and comparison, use of Rest with FTP servers and Range with: HTTP servers to retrieve files over slow or unstable connections,: support for Proxy servers, and configurability.

安装 wget

shell> yum -y install wgetLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfileAvailable PackagesName : wgetArch : x86_64Version: 1.12Release: 1.8.el6Size : 482 kRepo : c6-mediaSummary: A utility for retrieving files using the HTTP or FTP protocolsURL : /software/wget/License: GPLv3+ and GFDLDescription : GNU Wget is a file retrieval utility which can use either the HTTP or: FTP protocols. Wget features include the ability to work in the: background while you are logged out, recursive retrieval of: directories, file name wildcard matching, remote file timestamp: storage and comparison, use of Rest with FTP servers and Range with: HTTP servers to retrieve files over slow or unstable connections,: support for Proxy servers, and configurability.[root@localhost yum.repos.d]# ^C[root@localhost yum.repos.d]# yum -y install wgetLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfileSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package wget.x86_64 0:1.12-1.8.el6 will be installed--> Finished Dependency ResolutionDependencies Resolved==========================================================================================================Package Arch Version RepositorySize==========================================================================================================Installing:wget x86_64 1.12-1.8.el6 c6-media 482 kTransaction Summary==========================================================================================================Install 1 Package(s)Total download size: 482 kInstalled size: 1.8 MDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionInstalling : wget-1.12-1.8.el6.x86_64 1/1Verifying : wget-1.12-1.8.el6.x86_64 1/1Installed:wget.x86_64 0:1.12-1.8.el6Complete!

参考

/article/425e69e6e033aebe15fc162b.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。