当前位置: > CentOS > CentOS入门 >

Centos净化系统到最小安装及语言设置

时间:2015-05-25 01:20来源:linux.it.net.cn 作者:IT
现在各种廉价vps让人眼花缭乱,光淘宝上就有N多,但大多数都很山寨,就拿centos系统来说,竟然装的是桌面版,叫人无语~~~

那么到底如何选择呢?

本文重点讲一下如何净化桌面版centos,使其更适合做服务器,避免不必要的内存开销。



首先是服务器以命令行模式启动,放弃桌面启动

  vim /etc/inittab

修改 id:5:initdefault:

改为 id:3:initdefault:

然后保存退出



还原语言模式

  vim /etc/sysconfig/i18n
#将里面的内容设置成
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"



然后重启系统,重新登录



删除X11环境

  rpm -e --allmatches --nodeps `rpm -qa|grep x11`
rpm -e --allmatches --nodeps `rpm -qa|grep X11`

注意上面命令不是复制了两次,而是后一个X11是大写的



停止不必要的服务

  service acpid stop
service atd stop
service auditd stop
service avahi-daemon stop
service avahi-dnsconfd stop
service bluetooth stop
service conman stop
service cpuspeed stop
service cups stop
service dnsmasq stop
service dund stop
service firstboot stop
service hidd stop
service httpd stop
service ibmasm stop
service ip6tables stop
service iptables stop
service irda stop
service kdump stop
service lm_sensors stop
service mcstrans stop
service messagebus stop
service microcode_ctl stop
service netconsole stop
service netfs stop
service netplugd stop
service nfs stop
service nfslock stop
service nscd stop
service ntpd stop
service oddjobd stop
service pand stop
service pcscd stop
service portmap stop
service psacct stop
service rdisc stop
service restorecond stop
service rpcgssd stop
service rpcidmapd stop
service rpcsvcgssd stop
service saslauthd stop
service setroubleshoot stop
service smb stop
service vncserver stop
service winbind stop
service wpa_supplicant stop
service xfs stop
service ypbind stop
service yum-updatesd stop
chkconfig acpid off
chkconfig atd off
chkconfig auditd off
chkconfig avahi-daemon off
chkconfig avahi-dnsconfd off
chkconfig bluetooth off
chkconfig conman off
chkconfig cpuspeed off
chkconfig cups off
chkconfig dnsmasq off
chkconfig dund off
chkconfig firstboot off
chkconfig hidd off
chkconfig httpd off
chkconfig ibmasm off
chkconfig ip6tables off
chkconfig iptables off
chkconfig irda off
chkconfig kdump off
chkconfig lm_sensors off
chkconfig mcstrans off
chkconfig messagebus off
chkconfig microcode_ctl off
chkconfig netconsole off
chkconfig netfs off
chkconfig netplugd off
chkconfig nfs off
chkconfig nfslock off
chkconfig nscd off
chkconfig ntpd off
chkconfig oddjobd off
chkconfig pand off
chkconfig pcscd off
chkconfig portmap off
chkconfig psacct off
chkconfig rdisc off
chkconfig restorecond off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig rpcsvcgssd off
chkconfig saslauthd off
chkconfig setroubleshoot off
chkconfig smb off
chkconfig vncserver off
chkconfig winbind off
chkconfig wpa_supplicant off
chkconfig xfs off
chkconfig ypbind off
chkconfig yum-updatesd off





删除无用的包

  yum remove -y Deployment_Guide-en-US finger cups-libs cups bluez-libs desktop-file-utils ppp rp-pppoe wireless-tools irda-utils nfs-utils nfs-utils-lib rdate fetchmail eject ksh mkbootdisk mtools syslinux tcsh startup-notification talk apmd rmt dump setserial portmap yp-tools ypbind apmd autofs bluez-utils cups irda-utils iiimf-server iiimf-libs iiimf-csconv iiimf-docs isdn4k-utils pcmcia-cs sendmail xorg-x11-xfs ypbind xinetd





停掉并且删除一些不需要的 xinetd 服务

  /sbin/service xinetd stop;
/sbin/chkconfig xinetd off
rm -rf /etc/xinetd.d





禁止一些 /etc/init.d/ 下面不需要的服务,

  for a in acpid anacron apmd atd autofs avahi-daemon bluetooth cpuspeed \
cups firstboot gpm haldaemon hidd ip6tables irqbalance isdn kdump \
kudzumcstrans messagebus microcode_ctl netfs nfs nfslock pcscd portmap \
readahead_early readahead_later rpcgssd rpcidmapd sendmail \
setroublesshoot smartd xfs xinetd yum-updatesd; \
do /sbin/chkconfig $a off; done



重启系统后,检查一下正在运行中的服务,看看是不是都是必须的。

  netstat -an | grep LISTEN

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容