linux(centos7)系统优化)
1.网络的配置,添加网卡
可以手动的在vmware的配置中添加网卡
然后选择lang区段配置内网网关
新增网卡的名称路径:
vim /etc/sysconfig/network-scripts/ifcfg-eth1
可以通过nmtui命令进行编辑:
nmtui
图形画的界面
没有界面检查NetManger服务是否启动
systemctl status NetManger
systemctl start NetManger
内网只需要配置IP即可
也可以在虚拟机的内部进行配置网卡,具体的步骤可以搜索其他博客
2.hosts文件的配置
vim /etc/hosts
172.16.1.5 lb01
172.16.1.6 lb02
添加主机ip 与主机名称的对应
3.更改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 http://mirrors.aliyun.com/repo/Centos-7.repo
yum install -y wget
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
查看yum源信息
yum repolist
4.关闭selinux
sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
getenforce
5.关闭防火墙
关闭
systemctl stop firewalld
开机自启关闭
systemctl disable firewalld
查看防火墙的状态
systemctl status firewalld
6.英文字符集
localectl set-locale LANG="en_US.UTF-8"
7.时间同步
yum install -y ntpdate
echo '#time sync by lidao at 2017-03-08' >>/var/spool/cron/root
echo '*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1' >>/var/spool/cron/root
crontab -l
8.加大文件描述
yum install -y lsof
lsof -i:22
echo '* - nofile 65536' >>/etc/security/limits.conf
tail -1 /etc/security/limits.conf
9.安装其他的小软件
yum install lrzsz nmap tree dos2unix nc telnet wget lsof ntpdate bash-completion bash-completion-extras -y
10.ssh连接速度慢
修改配置文件
sed -i.bak 's@#UseDNS yes@UseDNS no@g;s@^GSSAPIAuthentication yes@GSSAPIAuthentication no@g' /etc/ssh/sshd_config
重启ssh服务
systemctl restart sshd