1、关闭防火墙、selinux、修改字符集
# CentOS 7
$ setenforce 0 # 可以设置配置文件永久关闭
$ systemctl stop iptables.service
$ systemctl stop firewalld.service
# 修改字符集,否则可能报 input/output error的问题,因为日志里打印了中文
$ localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
$ export LC_ALL=zh_CN.UTF-8
$ echo 'LANG="zh_CN.UTF-8"' > /etc/locale.conf
# CentOS6
$ setenforce 0
$ service iptables stop
# 修改字符集,否则可能报 input/output error的问题,因为日志里打印了中文
$ localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
$ export LC_ALL=zh_CN.UTF-8
$ echo 'LANG=zh_CN.UTF-8' > /etc/sysconfig/i18n
vim /etc/selinux/config
SELINUX=disbled
2、配置时间同步
yum install ntpdate -y
ntpdate ntp1.aliyun.com
echo 'ntpdate ntp1.aliyun.com' >> /etc/rc.loacl
3、修该网卡配置文件
vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=dhcp
NAME=eth0
DEVICE=eth0
ONBOOT=no
4、ssh优化
vim /etc/ssh/sshd_config
GSSAPIAuthentication no
UseDNS no
重启ssh服务
5、修改主机名
centos6
hostname xxx
vim /etc/sysconfig/network
修改主机名
centos7
hostnamectl set-hostname controller
重新登陆
6、yum优化
6.1 备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
6.2换源
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
7、其他优化
7.1关闭图形化设置模式
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
7.2下载tab补全命令
yum install -y bash-completion.noarch
7.3下载常用命令
yum install -y net-tools vim lrzsz wget tree screen lsof tcpdump