ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 10

10

原创 Linux操作系统 作者:database_hu 时间:2010-11-14 15:26:37 0 删除 编辑
    RHCE考前模拟试卷

测试环境: .example.com        192.168.0.0/255.255.255.0
测试环境: .cracker.org        192.168.10.0/255.255.255.0

考试服务器: 192.168.0.254    server.example.com

NFS服务器:  192.168.0.254    server.example.com    共享目录:/var/ftp/pub

YUM服务器:  http://server1.example.com/Server

系统要求:使用UTC,时区选择 亚洲/上海

IP地址为:192.168.0.X    子网掩码:255.255.255.0

主机名为:stationX.example.com    默认网关为:192.168.0.254

DNS服务器为:192.168.0.254



系统安装指令:  rhce


1、机器已经安装好了,但密码未知,请修改管理员密码为redhat

2、根据要求静态配置机器的IP,网关,主机名等信息
        nslookup stationX.example.com


3、划分一个500M的物理分区,挂载到/common目录下,要求文件系统为ext3

4、创建用户组admin,创建用户user1,附加组属于admin组;创建user2,附加组为admin;创建user3,不属于admin组,没有交互的shell

5、在/common目录下创建adm目录,所有者为root,所属组为admin组

6、任何人在adm目录下创建文件都属于admin组

7、把/etc/fstab文件复制到/var/tmp/目录下,任何人对该文件没有执行权限,user1对该文件具有读写权限,user2组对该用户具有读写权限。

8、升级系统的内核包,软件包在http://server1.example.com/Server/kernel-PAE-2.6.18-194.el5.i686.rpm
        <---要求使用rpm命令安装
9、使用yum 安装 kernel-PAE-devel 软件包

==================================================================


ps
    ps axu
    ps -ef

pstree | grep -A 3 -B 3 "grep"

D    Uninterruptible sleep (usually IO) 不可中断睡眠
S    Interruptible sleep (waiting for an event to complete)  可中断睡眠
R    Running or runnable (on run queue) 运行状态

T    Stopped, either by a job control signal or because it is being traced. 暂停

Z    Defunct ("zombie") process, terminated but not reaped by its parent. 僵尸进程,不可结束,只能重启系统


kill 专门用于发送信号命令
    -9  强制结束某个进程
    -15 比较友好地正常结束进程
    -STOP 暂停进程
    -HUP  让进程重载(重启)
    

top
    shift + M
    shift + P


top - 14:18:48 up 4 days, 23:37,  4 users,  load average: 0.08, 0.04, 0.01
Tasks: 167 total,   1 running, 164 sleeping,   0 stopped,   2 zombie
Cpu(s):  2.0%us,  0.3%sy,  0.0%ni, 97.6%id,  0.0%wa,  0.1%hi,  0.0%si,  0.0%st
Mem:   2040412k total,  1396844k used,   643568k free,   103720k buffers
Swap:  2008084k total,      136k used,  2007948k free,  1011496k cached


# top -b -n 3 > /tmp/test/top.txt


进程的优先级
  -20  ~  19  数值越低,优先级越高,得到资源的比例越高

nice  -优先级  要运行的程序
nice --20 rpm --rebuilddb

renice 优先级 已经运行的进程的pid
renice -20 12921


# skill -9  httpd  批量删除以httpd为名的进程
    -u  后面带 进程运行身份
    -p  后面带pid

 skill -9 -u 用户名 ?


=========================================


Grub 《---Linux 常用引导程序
    软件包 grub
    配置文件目录 /boot/grub
    安装了grub到MBR之后,才在配置目录下产生配置文件 (grub-install进行安装)



# vim /boot/grub/grub.conf


default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu

title Red Hat Enterprise Linux Server (2.6.18-194.el5)
        root (hd0,0)
        kernel (hd0,0)/vmlinuz-2.6.18-194.el5 ro root=LABEL=/1 rhgb quiet
        initrd /initrd-2.6.18-194.el5.img


title Red Hat Enterprise Linux Server (2.6.18-194.el5PAE)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/1 rhgb quiet
        initrd /initrd-2.6.18-194.el5PAE.img


引导的三步曲:
    1、root (hd0,0)  <--告诉grub,引导需要的内核镜像放在哪里(具体某个分区)
    2、kernel /... 根据第一步得到的分区,然后在该分区上找到具体内核镜像文件
        root=LABEL=/1  传给内核的一个参数,告诉内核系统根目录在哪个分区,这个参数不能忘掉    
        可以写成设备的绝对路径  root=/dev/sda2


    3、initrd /... 根据第一步得到的分区,然后在该分区上找到具体初始化内存盘镜像
        初始化内存盘镜像 用来驱动一些必要的基础硬件


sda1         /
sda2        /home
sda3        swap
   
系统中 /boot目录是属于哪个分区? sda1 <--- (hd0,0)
    /boot/vmlinuz 文件存放在哪个分区? sda1 <-- (hd0,0)/boot/vmlinuz

    /home  目录本身是属于哪个分区?  sda1  <--- (hd0,0)
    /home  目录里的数据(文件)是属于哪个分区 ? sda2  (hd0,1)
        /home/tom  属于哪个分区 sda2  <--- (hd0,1)/tom


sda1        swap
sda2        /boot
sda3        /

系统中 /boot目录里内容是属于哪个分区?  sda2  <--- (hd0,1)
    /boot/vmlinux    <-- (hd0,1)/vmlinuz





简单的合法的配置实例:
default=0
timeout=8

title "My Linux"
        root (hd0,0)
        kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/sda2 quiet rhgb
        initrd /initrd-2.6.18-194.el5.img



作业:
    虚拟机安装系统,安装指令: grub
    手工引导系统,登录之后修复grub.conf,确保下次能自动引导

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/24920726/viewspace-678064/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 09
下一篇: 11
请登录后发表评论 登录
全部评论

注册时间:2010-11-14

  • 博文量
    10
  • 访问量
    10463