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