**优化体系 **
系统优化 基础必备优化: 基础服务优化
- ssh服务
- yum源配置
- 安装常见工具
- 时间同步:定时任务+ ntpdate / chrony
- 文件描述符 每个进程可以打开的最大文件数量
- 开机自启动crond sysstat network rsyslog sshd (c6)
- 修改历史命令环境变量
2.优化体系
1)系统优化
2)服务优化
nginx
php
tomact
系统优化
1.基础优化
1)关闭SElinux NSA
2)firewalld cenetos7 lptables(c6) 安全组(阿里云)
- 内网环境 不对外访问 可以关闭
- 公网 需要开启
2.网络管理服务
networkManagew network
相同点 管理网络
不同点 通过nmcli命令 修改配置文件 重启网卡生效
3.添加普通用户 配置sudo
- 预防root密码忘记
- 通过xshell到处主机信息和密码
oldboy ALL=(ALL) NOPASSWD: ALL1


- 配置sudo
- 秘钥登录
4./etc/hosts文件 解析当前的主机名
- 解析主机名 DNS
- 后面的服务软件 可能安装失败
5.锁定关键文件系统 chattr lsattr
- 命令
- 文件
6.字符集
系统字符集UTF-8
#en_US.UTF8
#zh_CN.UTF8
7.调整用户登录提示信息 /etc/motd
8.清空 /etc/issus /etc/issue.net
基础优化
1.ssh服务
Port 22 #修改默认的端口号
PermitRootLogin no 禁止root远程登陆
ssh远程连接慢 UseDNS no
禁止系统把ip解析对应域名
GSSAPIAuthentication no
配置内外网监听不同端口
监听 监听本地网卡的ip地址
ListenAddress 10.0.0.7:52113
ListenAddress 172.16.1.7:22
[root@web01 ~]# ss -lntup |grep sshd
tcp LISTEN 0 128 *:22 *:* users:(("sshd",pid=7214,fd=3))
tcp LISTEN 0 128 :::22 :::* users:(("sshd",pid=7214,fd=4))

2.yum源配置
物理服务器和虚拟机
云服务器:默认配置了
yum源:修改系统默认的yum源 增加epel源
3.安装常见工具


4.时间同步:定时任务+ntpdate / chrony
5.文件描述符 每个进程可以打开的最大文件数量
临时 ulimit -n65535
永久 /etc/security/limits.conf echo '* - nofile 65535 ' >>/etc/security/limits.conf
6.开机自启动 crond sysstat network rsyslog sshd

7.修改历史命令环境变量
环境变量
1)系统定义
2)大写
3)在系统的大部分地方 含义一致


网友评论