实验要求
设置Linux系统每次开机后自动进入字符模式界面。
使用ntsysv工具同时调整2、3、4、5运行级别中的服务状态,关闭下列服务: atd、bluetooth、cups、ip6tables、iptables、mdmonitor、nfslock、rhnsd、rpcgssd、 postfix。
使用chkconfig工具调整个别服务的启动状态。
将cups服务在运行级别3中的默认启动状态设为关闭。
将postfix服务在运行级别3、5中的默认启动状态设为启用其余级别中设为关闭。
查看当前系统中内存占用情况,重启并登录到字符模式,再次查看内存占用情况。
使用init命令切换到图形模式,再次确认运行级别并查看内存占用情况,比较优化 服务前后及在不同运行级别中的差异。
设置Linux系统每次开机后自动进入字符模式界面。
使用ntsysv工具同时调整2、3、4、5运行级别中的服务状态,关闭下列服务: atd、bluetooth、cups、ip6tables、iptables、mdmonitor、nfslock、rhnsd、rpcgssd、postfix。
[root@test2 jason]# chkconfig --list NetworkManager 0:off1:off2:on3:on4:on5:on6:off abrt-ccpp 0:off1:off2:off3:on4:off5:on6:off abrtd 0:off1:off2:off3:on4:off5:on6:off acpid 0:off1:off2:on3:on4:on5:on6:off atd 0:off1:off2:off3:on4:on5:on6:off auditd 0:off1:off2:on3:on4:on5:on6:off autofs 0:off1:off2:off3:on4:on5:on6:off blk-availability0:off1:on2:on3:on4:on5:on6:off bluetooth 0:off1:off2:off3:on4:on5:on6:off certmonger 0:off1:off2:off3:on4:on5:on6:off cpuspeed 0:off1:on2:on3:on4:on5:on6:off crond 0:off1:off2:on3:on4:on5:on6:off cups 0:off1:off2:on3:on4:on5:on6:off dnsmasq0:off1:off2:off3:off4:off5:off6:off firstboot 0:off1:off2:off3:off4:off5:off6:off haldaemon 0:off1:off2:off3:on4:on5:on6:off ip6tables 0:off1:off2:on3:on4:on5:on6:off iptables 0:off1:off2:on3:off4:on5:off6:off irqbalance 0:off1:off2:off3:on4:on5:on6:off kdump 0:off1:off2:on3:on4:on5:on6:off lvm2-monitor 0:off1:on2:on3:on4:on5:on6:off mdmonitor 0:off1:off2:on3:on4:on5:on6:off messagebus 0:off1:off2:on3:on4:on5:on6:off netconsole 0:off1:off2:off3:off4:off5:off6:off netfs 0:off1:off2:off3:on4:on5:on6:off network0:off1:off2:on3:on4:on5:on6:off nfs0:off1:off2:off3:off4:off5:off6:off nfslock0:off1:off2:off3:on4:on5:on6:off ntpd 0:off1:off2:off3:off4:off5:off6:off ntpdate0:off1:off2:off3:off4:off5:off6:off oddjobd0:off1:off2:off3:off4:off5:off6:off portreserve0:off1:off2:on3:on4:on5:on6:off postfix0:off1:off2:on3:on4:on5:on6:off psacct 0:off1:off2:off3:off4:off5:off6:off quota_nld 0:off1:off2:off3:off4:off5:off6:off rdisc 0:off1:off2:off3:off4:off5:off6:off restorecond0:off1:off2:off3:off4:off5:off6:off rngd 0:off1:off2:off3:off4:off5:off6:off rpcbind0:off1:off2:on3:on4:on5:on6:off rpcgssd0:off1:off2:off3:on4:on5:on6:off rpcsvcgssd 0:off1:off2:off3:off4:off5:off6:off rsyslog0:off1:off2:on3:on4:on5:on6:off saslauthd 0:off1:off2:off3:off4:off5:off6:off smartd 0:off1:off2:off3:off4:off5:off6:off snmpd 0:off1:off2:off3:off4:off5:off6:off snmptrapd 0:off1:off2:off3:off4:off5:off6:off spice-vdagentd 0:off1:off2:off3:off4:off5:on6:off sshd 0:off1:off2:on3:on4:on5:on6:off sssd 0:off1:off2:off3:off4:off5:off6:off sysstat0:off1:on2:on3:on4:on5:on6:off udev-post 0:off1:on2:on3:on4:on5:on6:off vmware-tools 0:off1:off2:on3:on4:on5:on6:off vmware-tools-thinprint0:off1:off2:on3:on4:on5:on6:off wdaemon0:off1:off2:off3:off4:off5:off6:off webmin 0:off1:off2:on3:on4:off5:on6:off winbind0:off1:off2:off3:off4:off5:off6:off wpa_supplicant 0:off1:off2:off3:off4:off5:off6:off xinetd 0:off1:off2:off3:on4:on5:on6:off ypbind 0:off1:off2:off3:off4:off5:off6:off xinetd based services: chargen-dgram: off chargen-stream:off daytime-dgram: off daytime-stream:off discard-dgram: off discard-stream:off echo-dgram:off echo-stream: off rsync: off tcpmux-server: off telnet:on time-dgram:off time-stream: off [root@test2 jason]#
service | Status |
---|---|
atd | 0:off 1:off 2:off 3:on 4:on 5:on 6:off |
bluetooth | 0:off 1:off 2:off 3:on 4:on 5:on 6:off |
cups | 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
ip6tables | 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
iptables | 0:off 1:off 2:on 3:off 4:on 5:off 6:off |
mdmonitor | 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
nfslock | 0:off 1:off 2:off 3:on 4:on 5:on 6:off |
rpcsvcgssd | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
postfix | 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
开始修改
[root@test2 jason]# ntsysv --level 2345
修改之后查看信息
[root@test2 jason]# chkconfig --list NetworkManager 0:off1:off2:on3:on4:on5:on6:off abrt-ccpp 0:off1:off2:on3:on4:on5:on6:off abrtd 0:off1:off2:on3:on4:on5:on6:off acpid 0:off1:off2:on3:on4:on5:on6:off atd0:off1:off2:off3:off4:off5:off6:off auditd 0:off1:off2:on3:on4:on5:on6:off autofs 0:off1:off2:on3:on4:on5:on6:off blk-availability0:off1:on2:on3:on4:on5:on6:off bluetooth 0:off1:off2:off3:off4:off5:off6:off certmonger 0:off1:off2:on3:on4:on5:on6:off cpuspeed 0:off1:on2:on3:on4:on5:on6:off crond 0:off1:off2:on3:on4:on5:on6:off cups 0:off1:off2:off3:off4:off5:off6:off dnsmasq0:off1:off2:off3:off4:off5:off6:off firstboot 0:off1:off2:off3:off4:off5:off6:off haldaemon 0:off1:off2:on3:on4:on5:on6:off ip6tables 0:off1:off2:off3:off4:off5:off6:off iptables 0:off1:off2:off3:off4:off5:off6:off irqbalance 0:off1:off2:on3:on4:on5:on6:off kdump 0:off1:off2:on3:on4:on5:on6:off lvm2-monitor 0:off1:on2:on3:on4:on5:on6:off mdmonitor 0:off1:off2:off3:off4:off5:off6:off messagebus 0:off1:off2:on3:on4:on5:on6:off netconsole 0:off1:off2:off3:off4:off5:off6:off netfs 0:off1:off2:on3:on4:on5:on6:off network0:off1:off2:on3:on4:on5:on6:off nfs0:off1:off2:off3:off4:off5:off6:off nfslock0:off1:off2:off3:off4:off5:off6:off ntpd 0:off1:off2:off3:off4:off5:off6:off ntpdate0:off1:off2:off3:off4:off5:off6:off oddjobd0:off1:off2:off3:off4:off5:off6:off portreserve0:off1:off2:on3:on4:on5:on6:off postfix0:off1:off2:off3:off4:off5:off6:off psacct 0:off1:off2:off3:off4:off5:off6:off quota_nld 0:off1:off2:off3:off4:off5:off6:off rdisc 0:off1:off2:off3:off4:off5:off6:off restorecond0:off1:off2:off3:off4:off5:off6:off rngd 0:off1:off2:off3:off4:off5:off6:off rpcbind0:off1:off2:on3:on4:on5:on6:off rpcgssd0:off1:off2:off3:off4:off5:off6:off rpcsvcgssd 0:off1:off2:off3:off4:off5:off6:off rsyslog0:off1:off2:on3:on4:on5:on6:off saslauthd 0:off1:off2:off3:off4:off5:off6:off smartd 0:off1:off2:off3:off4:off5:off6:off snmpd 0:off1:off2:off3:off4:off5:off6:off snmptrapd 0:off1:off2:off3:off4:off5:off6:off spice-vdagentd 0:off1:off2:on3:on4:on5:on6:off sshd 0:off1:off2:on3:on4:on5:on6:off sssd 0:off1:off2:off3:off4:off5:off6:off sysstat0:off1:on2:on3:on4:on5:on6:off udev-post 0:off1:on2:on3:on4:on5:on6:off vmware-tools 0:off1:off2:on3:on4:on5:on6:off vmware-tools-thinprint0:off1:off2:on3:on4:on5:on6:off wdaemon0:off1:off2:off3:off4:off5:off6:off webmin 0:off1:off2:on3:on4:on5:on6:off winbind0:off1:off2:off3:off4:off5:off6:off wpa_supplicant 0:off1:off2:off3:off4:off5:off6:off xinetd 0:off1:off2:on3:on4:on5:on6:off ypbind 0:off1:off2:off3:off4:off5:off6:off
service | Status |
---|---|
atd | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
bluetooth | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
cups | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
ip6tables | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
iptables | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
mdmonitor | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
nfslock | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
rpcsvcgssd | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
postfix | 0:off 1:off 2:off 3:off 4:off 5:off 6:off |
使用chkconfig工具调整个别服务的启动状态。
[root@test2 jason]# chkconfig --list postfix postfix 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@test2 jason]# chkconfig --level 35 postfix on
[root@test2 jason]# chkconfig --list postfix postfix0:off1:off2:off3:on4:off5:on6:off
将cups服务在运行级别3中的默认启动状态设为关闭。
[root@test2 jason]# chkconfig --list cups cups 0:off1:off2:off3:off4:off5:off6:off
[root@test2 jason]# chkconfig --level 3 cups on
[root@test2 jason]# chkconfig --list cups cups 0:off1:off2:off3:on4:off5:off6:off
将network服务在运行级别3、5中的默认启动状态设为启用。
[root@test2 jason]# chkconfig --list network network0:off1:off2:on3:on4:on5:on6:off
[root@test2 jason]# chkconfig --level 35 network off
[root@test2 jason]# chkconfig --list network network0:off1:off2:on3:off4:on5:off6:off
[root@test2 jason]# chkconfig --level 35 network on
[root@test2 jason]# chkconfig --list network network0:off1:off2:on3:on4:on5:on6:off
查看当前系统中内存占用情况,重启并登录到字符模式,再次查看内存占用情况。
[root@test2 jason]# grep "MemFree" /proc/meminfo MemFree: 7386376 kB
修改之后:
[root@test2 jason]# grep "MemFree" /proc/meminfo MemFree: 7584276 kB
重启
[root@test2 jason]# grep "MemFree" /proc/meminfo MemFree: 7703308 kB [root@test2 jason]#
本文出自 “Code Life” 博客,请务必保留此出处http://zencode.blog.51cto.com/11714065/1791570
原文地址:http://zencode.blog.51cto.com/11714065/1791570