Rhcsa
考试说明
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
虚拟机配置
硬盘:6G
内存:1G
虚拟交换分区:512M
rhcsa测试题
1. 缩减/home分区到100M
2. 新建组manager,创建两个用户natasha,harry这两个用户的附加组为manager,创建用户strlt,这个用户不允许登录系统
3. 复制/etc/fstab 到/var/tmp/fstab ,设置 harry 可以读写,natasha 不能做任何操作,其他用
户可读,设置 manager 组为 fstab 所属组
4. 设置crontab,natasha 在 14:23 执行 echo “file_world”
5. 升级kernel,默认不起动新内核,新内核的位置在:“ftp://192.168.0.254/pub/kernel/”
6. 新建用户bob,其uid为700
7. 设置ldap身份验证,dc=example,dc=com TLS证书:ldap://instructor.example.com/pub/example-ca.crt
8. 当ldap用户登录时,自动挂载用户主
9. 设置ntp时间同步,ntp服务器的地址为:192.168.0.254
10. 在系统中查找属于mail组的文件,并把文件备份到/mnt/backup中
11. 新建目录/share,要求/share目录的组位manager,在这个目录下建立的所有文件都属于manager组,要求在这个目录下所有用户都可以自由建立文件。但用户只能删除属于自己的文件。
12. 新建100M分区并把这个分区挂在到/share下
13. 建立文件/share/testfile,要求只有root和natasha用户可写,其他用户没有任何权限。
14. 增加一个512M的swap分区,自动挂载
15. 创建一个VG和LV,VG名称为vgshare,LV名称为lvshare,PE大小为8M,lv中有20个PE,格式化为vfat,开机自动挂在到/mnt/vfat
16. 配置FTP服务器,匿名用户可以上传下载
17. 配置apache服务器,可以访问http://serverX.example.com,页面自定义
18. 配置客户端NIS认证,domain为notexample,NIS服务器为192.168.0.254
19. 配置网络打印机,将打印作业发送到instructor.example.com上名为/printers/printerX(其中X是1-20)的IPP打印队列,你的打印队列名为remote-testX(其中X是你的桌面号),使用text-only printer作为型号
答案
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
rhcsa部分
1
[root@desktop88 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda2 4031680 2019596 1807284 53% /
tmpfs 498476 0 498476 0% /dev/shm
/dev/vda1 198337 25745 162352 14% /boot
/dev/mapper/vg0-lv0 396672 10510 365682 3% /home
[root@desktop88 ~]# umount /home/
[root@desktop88 ~]# e2fsck -f /dev/vg0/lv0
[root@desktop88 ~]# resize2fs /dev/vg0/lv0 100M
[root@desktop88 ~]# lvreduce -L 100M /dev/vg0/lv0
[root@desktop88 ~]# mount -a
2
[root@desktop88 ~]# groupadd manager
[root@desktop88 ~]# useradd -G manager harry
[root@desktop88 ~]# useradd -G manager natasha
[root@desktop88 ~]# useradd -s /sbin/nologin strlt
3
[root@desktop88 ~]# chgrp manager /var/tmp/fstab
[root@desktop88 ~]# setfacl -m u:harry:rw /var/tmp/fstab
[root@desktop88 ~]# setfacl -m u:natasha:0 /var/tmp/fstab
[root@desktop88 ~]# getfacl /var/tmp/fstab
getfacl: Removing leading '/' from absolute path names
# file: var/tmp/fstab
# owner: root
# group: manager
user::rw-
user:harry:rw-
user:natasha:---
group::r--
mask::rw-
other::r--
4
[root@desktop88 ~]# su - natasha
[natasha@desktop88 ~]$ crontab -e
23 14 * * * echo "file_world"
5
[root@desktop88 ~]# lftp 192.168.0.254
lftp 192.168.0.254:/> cd pub/kernel/
lftp 192.168.0.254:/pub/kernel> get kernel-firmware-2.6.32-71.7.1.el6.noarch.rpm
lftp 192.168.0.254:/pub/kernel> quit
[root@desktop88 ~]# ls
anaconda-ks.cfg install.log.syslog
install.log kernel-firmware-2.6.32-71.7.1.el6.noarch.rpm
[root@desktop88 ~]# rpm -ivh kernel-firmware-2.6.32-71.7.1.el6.noarch.rpm
6
[root@desktop88 ~]# useradd -u 700 bob
10
[root@desktop88 ~]# mkdir /mnt/backup
[root@desktop88 backup]# find / -group mail -exec cp {} /mnt/backup \;
12
[root@desktop88 ~]# mkdir /share
[root@desktop88 ~]# fdisk -cu /dev/vda
Command (m for help): n
First sector (14751744-16777215, default 14751744):
Using default value 14751744
Last sector, +sectors or +size{K,M,G} (14751744-16777215, default 16777215): +100M
Command (m for help): wq
[root@desktop88 ~]# partx -a /dev/vda
[root@desktop88 ~]# mkfs.ext4 /dev/vda6
[root@desktop88 ~]# vi /etc/fstab
/dev/vda6 /share ext4 defaults,acl 0 0
[root@desktop88 ~]# mount -a
[root@desktop88 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda2 4031680 2023240 1803640 53% /
tmpfs 498476 0 498476 0% /dev/shm
/dev/vda1 198337 25745 162352 14% /boot
/dev/mapper/vg0-lv0 99033 9779 84134 11% /home
/dev/vda6 99150 5646 88384 7% /share
11
[root@desktop88 ~]# chgrp manager /share/
[root@desktop88 ~]# chmod 777 /share/
[root@desktop88 ~]# chmod g+s,o+t /share/
[root@desktop88 ~]# ll -d /share/
drwxrwsrwt. 3 root manager 1024 Sep 29 06:40 /share/
13
[root@desktop88 ~]# touch /share/testfile
[root@desktop88 ~]# chmod 600 /share/testfile
[root@desktop88 ~]# setfacl -m u:natasha:rw /share/testfile
[root@desktop88 ~]# getfacl /share/testfile
getfacl: Removing leading '/' from absolute path names
# file: share/testfile
# owner: root
# group: manager
user::rw-
user:natasha:rw-
group::---
mask::rw-
other::---
15
[root@desktop88 ~]# fdisk -cu /dev/vda
Command (m for help): n
First sector (14958592-16777215, default 14958592):
Using default value 14958592
Last sector, +sectors or +size{K,M,G} (14958592-16777215, default 16777215): +1000M
Command (m for help): t
Partition number (1-7): 7
Hex code (type L to list codes): 8e
Command (m for help): p
Disk /dev/vda: 8589 MB, 8589934592 bytes
16 heads, 63 sectors/track, 16644 cylinders, total 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b3c2f
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 411647 204800 83 Linux
/dev/vda2 411648 8603647 4096000 83 Linux
/dev/vda3 8603648 12699647 2048000 82 Linux swap / Solaris
/dev/vda4 12699648 16777215 2038784 5 Extended
/dev/vda5 12701696 14749695 1024000 8e Linux LVM
/dev/vda6 14751744 14956543 102400 83 Linux
/dev/vda7 14958592 15163391 102400 8e Linux LVM
[root@desktop88 ~]# partx -a /dev/vda
[root@desktop88 ~]# pvcreate /dev/vda7
[root@desktop88 ~]# vgcreate -s 8M vgshare /dev/vda7
[root@desktop88 ~]# lvcreate -L 80M -n lvshare vgshare
[root@desktop88 ~]# mkfs.vfat /dev/vgshare/lvshare
[root@desktop88 ~]# mkdir /mnt/vfat
[root@desktop88 ~]# vi /etc/fstab
/dev/vgshare/lvshare /mnt/vfat vfat defaults 0 0
[root@desktop88 ~]# mount -a
16
[root@desktop88 ~]# yum install vsftpd -y
[root@desktop88 ~]# chkconfig vsftpd on
[root@desktop88 ~]# vi /etc/vsftpd/vsftpd.conf
anon_upload_enable=YES
anon_world_readable_only=NO
[root@desktop88 ~]# /etc/init.d/vsftpd start
[root@desktop88 ~]# chmod 775 /var/ftp/pub/
[root@desktop88 ~]# chgrp ftp /var/ftp/pub/
[root@desktop88 ~]# getsebool -a | grep ftp
allow_ftpd_anon_write --> off
allow_ftpd_full_access --> off
allow_ftpd_use_cifs --> off
allow_ftpd_use_nfs --> off
[root@desktop88 ~]# setsebool -P allow_ftpd_anon_write on
[root@desktop88 ~]# chcon -t public_content_rw_t /var/ftp/pub/
17
[root@desktop88 ~]# chkconfig httpd on
[root@desktop88 ~]# vi /var/www/html/index.html
[root@desktop88 ~]# /etc/init.d/httpd start