一、实验目的

(1)掌握yum源文件的设置
(2)掌握用yum文件安装其他的服务。

二、实验背景

现在有一台已经安装了Linux操作系统的主机,并且已经配置了基本的TCP/IP 参数,能够通过网络连接局域网中或远程的主机。一台Linux服务器,能够提供FTP、Telnet和SSH连接。

三、实验内容

(1)查看当前文件系统挂载情况

  1. [root@centos-linux ~]# df -TH
  2. 文件系统 类型 容量 已用 可用 已用% 挂载点
  3. /dev/sda2 xfs 11G 73M 11G 1% /
  4. devtmpfs devtmpfs 942M 0 942M 0% /dev
  5. tmpfs tmpfs 957M 91k 957M 1% /dev/shm
  6. tmpfs tmpfs 957M 9.4M 948M 1% /run
  7. tmpfs tmpfs 957M 0 957M 0% /sys/fs/cgroup
  8. /dev/sda6 xfs 8.6G 3.3G 5.4G 38% /usr
  9. /dev/sda5 xfs 8.6G 1.6G 7.1G 19% /var
  10. /dev/sda3 xfs 8.6G 38M 8.6G 1% /home
  11. /dev/sda1 xfs 312M 151M 161M 49% /boot
  12. tmpfs tmpfs 192M 13k 192M 1% /run/user/0
  13. /dev/sr0 iso9660 4.4G 4.4G 0 100% /opt

(2)挂载光盘镜像到 opt目录

  1. [root@centos-linux ~]# mount /dev/cdrom /opt
  2. mount: /dev/sr0 写保护,将以只读方式挂载

(3)制作用于安装的yum源文件(本地源和网络源)

  1. [root@centos-linux ~]#vi /etc/yum.repos.d/local.repo
  2. [centos]
  3. name=centos
  4. baseurl=file:///opt
  5. gpcheck=0
  6. enabled=1

(4)安装BIND服务前先先清除yum缓存

  1. [root@centos-linux ~]# yum clean
  2. 已加载插件:fastestmirror, langpacks
  3. 错误:清理命令需要参数:headers, packages, metadata, dbcache, plugins, expire-cache, rpmdb, all
  4. [root@centos-linux ~]# yum repolist
  5. 已加载插件:fastestmirror, langpacks
  6. Loading mirror speeds from cached hostfile
  7. 源标识 源名称 状态
  8. centos centos 3,723
  9. repolist: 3,723

(5)使用yum命令安装BIND服务

  1. [root@centos-linux ~]# yum install -y bind
  2. 已加载插件:fastestmirror, langpacks
  3. Loading mirror speeds from cached hostfile
  4. 正在解决依赖关系
  5. --> 正在检查事务
  6. ---> 软件包 bind.x86_64.32.9.9.4-29.el7 将被 安装
  7. --> 解决依赖关系完成
  8. 依赖关系解决
  9. ==============================================================================================================
  10. Package 架构 版本 大小
  11. ==============================================================================================================
  12. 正在安装:
  13. bind x86_64 32:9.9.4-29.el7 centos 1.8 M
  14. 事务概要
  15. ==============================================================================================================
  16. 安装 1 软件包
  17. 总下载量:1.8 M
  18. 安装大小:4.3 M
  19. Downloading packages:
  20. Running transaction check
  21. Running transaction test
  22. Transaction test succeeded
  23. Running transaction
  24. 正在安装 : 32:bind-9.9.4-29.el7.x86_64 1/1
  25. 验证中 : 32:bind-9.9.4-29.el7.x86_64 1/1
  26. 已安装:
  27. bind.x86_64 32:9.9.4-29.el7
  28. 完毕!
  29. [root@centos-linux ~]#

(6)查看dns服务组件安装情况

  1. [root@centos-linux ~]# rpm -q dns
  2. 未安装软件包 dns