###########在server主机中配置yum仓库,并安装gcc编辑器
利用真实主机共享yum源给server主机,以节省server主机空间
1.####在真实主机中配置yum源共享
[root@foundation37 Desktop]# cd /mnt
[root@foundation37 mnt]# ls
guazai rhel-server-7.1-x86_64-dvd.iso
LENOVO_GhostXP_SP3_2014.04.iso wps-office-8.1.0.3724-0.1.b1p2.i686.rpm
[root@foundation37 mnt]# mount /mnt/rhel-server-7.1-x86_64-dvd.iso /mnt/guazai ###把镜像挂载到/mnt/guazai目录下
mount: /dev/loop0 is write-protected, mounting read-only
[root@foundation37 mnt]# vim /etc/yum.repos.d/yum.repo ####编辑yum指向文件
[root@foundation37 mnt]# yum clean all ####更新yum指向
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel7.0
Cleaning up everything
[root@foundation37 mnt]# yum install httpd -y ####安装httpd服务
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel7.0 | 4.1 kB 00:00
(1/2): rhel7.0/group_gz | 134 kB 00:00
(2/2): rhel7.0/primary_db | 3.4 MB 00:00
Package httpd-2.4.6-31.el7.x86_64 already installed and latest version
Nothing to do
[root@foundation37 mnt]# umount /mnt/rhel-server-7.1-x86_64-dvd.iso ####解除镜像挂载
[root@foundation37 mnt]# mount /mnt/rhel-server-7.1-x86_64-dvd.iso /var/www/html/rhel7.1/ ###挂载镜像到httpd服务共享目录
mount: /dev/loop0 is write-protected, mounting read-only
在yum源存放主机中用浏览器输入http://本机ip/rhel7.1 ######测试共享是否成功
已共享成功
2.########server主机中
[root@server Desktop]# rm -fr /etc/yum.repos.d/yum.repo ####清除以前yum指向文件
[root@server Desktop]# vim /etc/yum.repos.d/yum.repo #####配置主机yum指向
[root@server Desktop]# yum clean all ###更新yum指向
Loaded plugins: langpacks
Cleaning repos: server
Cleaning up everythin
[root@server Desktop]# yum list gcc #####查看yum仓库中关于gcc的信息
Loaded plugins: langpacks
server | 4.1 kB 00:00:00
(1/2): server/group_gz | 134 kB 00:00:00
(2/2): server/primary_db | 3.4 MB 00:00:00
Available Packages
gcc.x86_64 4.8.3-9.el7 server
[root@server Desktop]# yum list gcc ####安装gcc编辑器
安装成功