1.
下载iso光盘CentOS-6.5-x86_64-bin-DVD1.iso,并上传至/tmp目录下
网址:http://www.onlinedown.net/soft/229582.htm
[root@nagios tmp]# ll
总用量 168968
-rw-r--r-- 1 root root 173015040 11月 10 16:34
CentOS-6.5-x86_64-bin-DVD1.iso
lrwxrwxrwx 1 root
root 25 11月 10 15:09 mysql.sock ->
/var/lib/mysql/mysql.sock
-rw-r--r-- 1 root
root 81 11月 10 08:03 ntp.log
[root@nagios tmp]#
上传工具很多,比如ftp等。。。
2. 挂载光盘到/mnt/centos目录下
[root@nagios tmp]# mkdir -p /mnt/centos
[root@nagios tmp]# mount CentOS-6.5-x86_64-bin-DVD1.iso
/mnt/centos/
mount: /tmp/CentOS-6.5-x86_64-bin-DVD1.iso is not a block device
(maybe try `-o loop'?)
[root@nagios tmp]# mount -o loop CentOS-6.5-x86_64-bin-DVD1.iso
/mnt/centos/
[root@nagios tmp]#
# mount iso 文件,必须加 -o loop参数
3. 去到/mnt/centos目录下,可以查看到光盘内容
[root@nagios tmp]# cd /mnt/centos/
[root@nagios centos]# ll
总用量 682
-r--r--r-- 2 root
root 14 11月 29 2013 CentOS_BuildTag
dr-xr-xr-x 3 root root 2048 11月
29 2013 EFI
-r--r--r-- 2 root
root 212 11月
28 2013 EULA
-r--r--r-- 2 root root 18009 11月 28 2013
GPL
dr-xr-xr-x 3 root root 2048 11月
29 2013 images
dr-xr-xr-x 2 root root 2048 11月
29 2013 isolinux
dr-xr-xr-x 2 root root 655360 11月 29 2013 Packages
-r--r--r-- 2 root root 1354 11月
28 2013 RELEASE-NOTES-en-US.html
dr-xr-xr-x 2 root root 4096 11月
29 2013 repodata
-r--r--r-- 2 root root 1706 11月
28 2013 RPM-GPG-KEY-CentOS-6
-r--r--r-- 2 root root 1730 11月
28 2013 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r-- 2 root root 1730 11月
28 2013 RPM-GPG-KEY-CentOS-Security-6
-r--r--r-- 2 root root 1734 11月
28 2013 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r-- 1 root root 3380 11月
29 2013 TRANS.TBL
[root@nagios centos]#
也可以df -h查看
[root@nagios centos]# df -h
文件系统 容量 已用 可用 已用%%
挂载点
/dev/sda3 12G 3.0G 7.8G 28% /
tmpfs 939M 0 939M 0%
/dev/shm
/dev/sda1 504M 37M 443M 8% /boot
/tmp/CentOS-6.5-x86_64-bin-DVD1.iso
4.2G 4.2G 0 100% /mnt/centos
[root@nagios centos]#
此时说明挂载成功!!
4.
配置本地yum网络,在/etc/yum.repos.d/目录下,先删除以.repo结尾的文件,并且新建文件rhel-source.repo
[root@nagios centos]# cd /etc/yum.repos.d/
[root@nagios yum.repos.d]# ll
总用量 4
-rw-r--r-- 1 root root 157 11月 10 16:30
rhel54.repo
[root@nagios yum.repos.d]# rm -rf
rhel54.repo
[root@nagios yum.repos.d]# vi rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - Source
baseurl=file:///mnt/centos/Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
~
~
~
~
~
~
"rhel-source.repo" [New] 6L, 171C written
[root@nagios yum.repos.d]#
5. 测试yum网络
[root@nagios yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: rhel-source
Cleaning up Everything
Cleaning up list of fastest mirrors
You have new mail in /var/spool/mail/root
[root@nagios yum.repos.d]#
[root@nagios yum.repos.d]# yum list gcc*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
file:///mnt/centos/repodata/repomd.xml: [Errno -1] Error importing
repomd.xml for rhel-source: Damaged repomd.xml
file
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for
repository: rhel-source. Please verify its path and try
again
[root@nagios yum.repos.d]#
该iso文件损坏,换一个iso文件,测试成功!!
[root@nagios yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: rhel-source
Cleaning up Everything
Cleaning up list of fastest mirrors
You have new mail in /var/spool/mail/root
[root@nagios yum.repos.d]#
[root@nagios yum.repos.d]# yum list
gcc*
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Installed Packages
gcc.x86_64 4.1.2-46.el5 installed
gcc-c++.x86_64 4.1.2-46.el5 installed
gcc-gfortran.x86_64 4.1.2-46.el5 installed
gcc-gnat.x86_64 4.1.2-46.el5 installed
gcc-java.x86_64 4.1.2-46.el5 installed
gcc-objc.x86_64 4.1.2-46.el5 installed
gcc44.x86_64 4.4.0-6.el5 installed
gcc44-c++.x86_64 4.4.0-6.el5 installed
gcc44-gfortran.x86_64 4.4.0-6.el5 installed
Available Packages
gcc-objc++.x86_64 4.1.2-46.el5 Server
[root@nagios yum.repos.d]#
[root@nagios yum.repos.d]#
[root@nagios yum.repos.d]#
6. yum安装卸载gcc*
yum install -y gcc*
yum remove gcc*
7. 卸载光盘
[root@nagios yum.repos.d]# umount /mnt/centos/
[root@nagios yum.repos.d]# cd /mnt/centos/
[root@nagios centos]# ll
总用量 0
[root@nagios centos]#