12、在您的服务器的DocumentRoot目录下创建一个名为confidential的目录,从ftp://192.168.0.254/pub/rhce/station.html下载一个文件副本到这个目录,并且重命名为index.html,不要对文件的内容进行任何修改。从您的本地主机上可以浏览confidential的内容,但是从其他位置不能访问这个目录的内容。
操作步骤:
创建目录,复制文件:
# mkdir /var/www/html/confidential
# wget ftp://192.168.0.254/pub/rhel6/station.html
# cp station.html /var/www/html/confidential/index.html
修改配置文件:
# vim /etc/httpd/conf/httpd.conf
<VirtualHost 192.168.0.114>
DocumentRoot /var/www/html/
ServerName station.domain170.example.com
<Directory /var/www/html/confidential>
Order allow,deny
Allow from 192.168.0.114
</Directory>
</VirtualHost>
重启服务:
# service httpd restart
13、创建一个名为/root/script.sh的脚本,让其提供以下特性:
(1)当运行/root/script.sh all时,输出none。
(2)当运行/root/script.sh none时,输出all。
(3)当没有任何参数或者参数不是all或none时,其向stderr产生以下的输出:/root/script.sh all|none
操作步骤:
# vim script.sh
#!/bin/bash
case $1 in
all)
echo “none”
;;
none)
echo “all”
;;
*)
echo “/root/script.sh all|none”
;;
esac
保存退出,进行测试:
[root@localhost ~]# ./script.sh none
all
[root@localhost ~]# ./script.sh all
none
14、配置您的系统,让系统在启动的时候,将位于/root/disc.iso的文件系统镜像自动挂载到/mnt/virtdisk目录中。
操作步骤:
# mkdir /mnt/virtdisk
# vim /etc/rc.local
mount –o loop /root/disc.iso /mnt/virtdisk
保存退出。
15、修改您的系统,将系统的启动参数kernctl设置为5,您的修改应该在/proc/cmdline文件中可见。
操作步骤:
# vim /etc/grub.conf
在kernel的最后加上kerctl=5
重启后验证:cat /proc/cmdline
16、系统(IP:192.168.0.254)通过标准端口(3260)提供了一个iSCSI块设备,在您的虚拟机连接此设备,并完成如下要求:
(1)在iSCSI设备上创建一个大小为1400MB的分区,并格式化为ext4,将分区挂载到您的虚拟机上的/mnt/data。
(2)此文件系统将包括ftp://192.168.0.254/pub/iscsi.txt文件的副本,拥有人为root,权限为0644,不要更改文件的任何内容。
(3)此文件系统在系统启动时自动挂载。
操作步骤:
查看帮助手册,复制相关命令:
# man iscsiadm
# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.0.254 --discover
192.168.0.254:3260,1 iqn.2010-09.com.example:rdisks.server14
# iscsiadm --mode node --targetname iqn.2010-09.com.example:rdisks.server14 --portal 192.168.0.254:3260 --login
查看设备文件名:
# fdisk -l
用fdisk命令进行分区。
将分区格式化:
# mkfs -t ext4 /dev/sdb1
挂载分区:
# mount /dev/sdb1 /mnt/data
下载文件,修改权限
# wget ftp://192.168.0.254/pub/iscsi.txt
# cp iscsi.txt /mnt/data
# chmod 644 /mnt/data/iscsi.txt
最后修改/etc/fstab文件实现永久挂载:
# vim /etc/fstab
/dev/sdb1 /mnt/data ext4 _netdev 0 0
保存退出。
