服务器优化:
关闭Selinux
[root@xiaosun ~]#setenforce 0
[root@xiaosun ~]#getenforce
Permissive
[root@xiaosun ~]#sed -i '7c SELINUX=disabled' /etc/selinux/config
关闭firewalld
systemctl stop firewalld
systemctl disable firewalld
修改默认YUM源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
安装epel扩展源
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
安装常用的软件
[root@xiaosun ~]#yum -y install vim tree lrzsz ntpdate net-tools wget
[root@xiaosun ~]#rpm -qa vim tree lrzsz ntpdate net-tools wget
ntpdate-4.2.6p5-29.el7.centos.2.x86_64
tree-1.6.0-10.el7.x86_64
lrzsz-0.12.20-36.el7.x86_64
net-tools-2.0-0.25.20131004git.el7.x86_64
wget-1.14-18.el7_6.1.x86_64
安装自动补全命令:
yum -y install bash-completion.noarch bash-completion-extras.noarch
时间同步
[root@xiaosun ~ ]#vi /etc/crontab
*/5 * * * * root ntpdate ntp1.aliyun.com &>/dev/null
修改文件描述符
[root@xiaosun ~ ]# vim /etc/security/limits.conf
* - nofile 65535
关闭NetworkManagewr
systemctl stop NetworkManager
systemctl disable NetworkManager
修改命令行颜色
[root@xiaosun ~ ]# vim .bashrc
PS1='[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\]\[\e[31;1m\] \W\[\e[0m\]]# '
修改网卡的配置文件
[root@xiaosun ~ ]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
NAME=eth0
DEVICE=eth0
ONBOOT=yes
IPADDR=10.0.0.200
PREFIX=24
GATEWAY=10.0.0.2
DNS1=223.5.5.5