考试说明
yum服务器的位置:ftp://192.168.0.254/pub/rhel6/dvd
gpgkey的位置/etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release
DNS:192.168.0.254
网关:192.168.0.254
ipaddr:192.168.0.x
虚拟机主机名:serverX.example.com
iscsi 服务器: instructor.example.com
rhce测试题
1. SELinux 设置为开机自动 enforcing
2. 启用内核IP转发
3. 禁用student用户使用crontab
4. ftp服务器仅允许example.com域用户匿名登录
5. mail服务器可以接收本机和远程邮件,student用户可以从远程接收邮件,邮件存放到指定目录/var/spool/mail/username
6. 配置mail别名,使发送给admin的邮件发给student
7. 配置apache服务器,下载页面:ftp://instructor.example.com/pub/materials/station.html 到 /var/www/html 作为首页,可以访问http://serverX.example.com
8. 建立apache虚拟主机,下载页面:ftp://instructor.example.com/pub/materials/www.html 到 /www/virtual 作为首页,可以访问http://wwwX.example.com
9. 在/var/www/html 建一个 secret 目录,并启用身份验证,仅允许本地用户访问
10. 下载文件ftp://instructor.example.com/materials/words,查找hr字符串行,并按顺序复制到/root/lines.txt
11. 挂载 ISO 镜像文件到/mnt/img,启动时自动挂载 ftp://instructor.example.com/pub/materials/boot.iso
12. 编写一个脚本 test.sh,当执行命令“sh test.sh cat”执行脚本时,输出 dog
执行”sh test.sh dog”执行脚本时 输出 cat
执行“sh test.sh 空格或其他字符“执行脚本时,屏幕输出错误写符串。
13. 开机后查看/proc/cmdline,其中包含max_loop=16
14. 禁止只允许 192.168.0.0/24 网段用户访问 ssh 服务
15. 配置iscsi 目标:iqn.2010-09.com.example:rdisks.serverX, 永久挂载到/mnt/data,下载文件到/mnt/data 权限为0644,ftp://instructor.example.com/materials/iscsi.txt
16. nfs共享/common, 仅允许当前example.com域用户访问
17. Samba 共享/common,工作组名 STAFF,要求 browseable=yes ,harry用户可以读取密码为harry按照考试说明配置系统
答案
1 yum的配置
[root@desktop88 ~]# vi /etc/yum.repos.d/yum.repo
[Server]
name=local server
baseurl=ftp://192.168.0.254/pub/rhel6/dvd/Server
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release
2 网络的配置
[root@desktop88 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 #ip的配置
DEVICE=”eth0″
BOOTPROTO=”none”
ONBOOT=”yes”
IPADDR=192.168.0.88
NETMASK=255.255.255.0
GATEWAY=192.168.0.253
[root@desktop88 ~]# vi /etc/resolv.conf #dns的配置
nameserver 192.168.0.254
[root@desktop88 ~]# vi /etc/sysconfig/network #主机明的配置
NETWORKING=yes
HOSTNAME=server88.example.com
[root@desktop88 ~]# vi /etc/hosts #主机的本地解析
192.168.0.88 server88.example.com
[root@desktop88 ~]# /etc/init.d/NetworkManager stop 关闭网络自定配置服务
[root@desktop88 ~]# chkconfig NetworkManager off
rhce
1
[root@desktop88 ~]# vi /etc/sysconfig/selinux
SELINUX=enforcing
2
[root@desktop88 ~]# vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
[root@desktop88 ~]# sysctl -p
3
[root@desktop88 ~]# vi /etc/cron.deny
student
4
[root@desktop88 ~]# iptables -A INPUT ! -s 192.168.0.0/24 -p tcp –dport 21 -j REJECT
5
[root@desktop88 ~]# chkconfig postfix on
[root@desktop88 ~]# postconf -d | grep inet
[root@desktop88 ~]# postconf -e inet_interfaces=all
[root@desktop88 ~]# /etc/init.d/postfix restart
[root@desktop88 ~]# yum install dovecot -y
[root@desktop88 ~]# chkconfig dovecot on
[root@desktop88 ~]# su – student
[student@desktop88 ~]$ mkdir -p mail/.imap/INBOX
[root@desktop88 ~]# /etc/init.d/dovecot start
6
[root@desktop88 ~]# vi /etc/aliases
admin: student
[root@desktop88 ~]# newaliases
7
[root@desktop88 ~]# vi /etc/httpd/conf/httpd.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName server88.example.com
ErrorLog logs/server88.example.com-error_log
CustomLog logs/server88.example.com-access_log common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/virtual
ServerName www88.example.com
ErrorLog logs/www88.example.com-error_log
CustomLog logs/www88.example.com-access_log common
</VirtualHost>
[root@desktop88 ~]# mkdir -p /www/virtual
[root@desktop88 ~]# cd /www/virtual/
[root@desktop88 virtual]# lftp 192.168.0.254
lftp 192.168.0.254:~> cd pub/materials/
lftp 192.168.0.254:/pub/materials> get www.html
lftp 192.168.0.254:/pub/materials> quit
[root@desktop88 virtual]# chcon -t httpd_sys_content_t /www/ -R
[root@desktop88 html]# cd /var/www/html/
[root@desktop88 html]# lftp 192.168.0.254
lftp 192.168.0.254:~> cd pub/materials/
lftp 192.168.0.254:/pub/materials> get station.html
lftp 192.168.0.254:/pub/materials> quit
[root@desktop88 html]# mv station.html index.html
[root@desktop88 html]# vi /etc/hosts
192.168.0.88 www88.example.com
192.168.0.88 server88.example.com
[root@desktop88 html]# /etc/init.d/httpd restart
9
[root@desktop88 html]# cd /www/virtual/
[root@desktop88 virtual]# mkdir secret
[root@desktop88 secret]# vi index.html
[root@desktop88 ~]# htpasswd -cm /etc/httpd/.htpasswd lee
[root@desktop88 ~]# vi /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
DocumentRoot /www/virtual
ServerName www88.example.com
ErrorLog logs/www88.example.com-error_log
CustomLog logs/www88.example.com-access_log common
<Directory /www/virtual/secret>
authuserfile /etc/httpd/.htpasswd
authname “please input your username and passwd”
authtype basic
require valid-user
</Directory>
</VirtualHost>
10
[root@desktop88 ~]# lftp 192.168.0.254
lftp 192.168.0.254:~> cd pub/materials/
lftp 192.168.0.254:/pub/materials> get words
[root@desktop88 ~]# grep hr words >/root/lines.txt