CentOS6.7生产环境基础优化实战
1、添加aliyun在线yum源。
添加源前,首先请做好备份/etc/yum.repos.d/CentOS-Base.repo
mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup
下面提供多个在线源供选择:
wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/repo/Centos-6.repo wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.sohu.com/help/CentOS-Base-sohu.repo wget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.163.com/.help/CentOS6-Base-163.repo
接下来就要安装几个必要的软件了:
[root@sample~]#yuminstall-ylrzsztreetelnet [root@sample~]#rpm-qatreetelnetlrzsz telnet-0.17-48.el6.x86_64 tree-1.5.3-3.el6.x86_64 lrzsz-0.12.20-27.1.el6.x86_64
2、关闭SELINUX和iptables
[root@sample~]#sed-i's#SELINUX=enforcing#SELINUX=disabled#g'/etc/selinux/config #修改配置文件则永久生效,但是必须要重启系统。 [root@sample~]#setenforce0#临时生效命令 [root@sample~]#getenforce#查看selinux当前状态 Permissive [root@sample~]#/etc/init.d/iptablesstatus#查看iptables的状态 Table:filter ChainINPUT(policyACCEPT) numtargetprotoptsourcedestination 1ACCEPTall--0.0.0.0/00.0.0.0/0stateRELATED,ESTABLISHED 2ACCEPTicmp--0.0.0.0/00.0.0.0/0 3ACCEPTall--0.0.0.0/00.0.0.0/0 4ACCEPTtcp--0.0.0.0/00.0.0.0/0stateNEWtcpdpt:22 5REJECTall--0.0.0.0/00.0.0.0/0reject-withicmp-host-prohibited ChainFORWARD(policyACCEPT) numtargetprotoptsourcedestination 1REJECTall--0.0.0.0/00.0.0.0/0reject-withicmp-host-prohibited ChainOUTPUT(policyACCEPT) numtargetprotoptsourcedestination #iptablesoff [root@sample~]#chkconfigiptablesoff#取消开机自启动iptables [root@sample~]#chkconfig--list|grepiptables iptables0:off1:off2:off3:off4:off5:off6:off [root@sample~]#/etc/init.d/iptablesstop#临时停止iptables服务 iptables:SettingchainstopolicyACCEPT:filter[OK] iptables:Flushingfirewallrules:[OK] iptables:Unloadingmodules:[OK] [root@sample~]#/etc/init.d/iptablesstatus iptables:Firewallisnotrunning.#再次查看服务已没有运行。
[root@sample~]#useraddguest
4、定时自动更新服务器时间
[root@sample ~]# crontab -e
[root@sample ~]# crontab -l
#####sync time#####
*/5 * * * * /usr/sbin/ntpdate time.windows.com >/dev/null 2>&1
待续……………………
原文链接:https://www.f2er.com/centos/379253.html