系统优化 服务优化

2019-08-27  本文已影响0人  linux_龍

**优化体系 **

系统优化 基础必备优化: 基础服务优化

  1. ssh服务
  2. yum源配置
  3. 安装常见工具
  4. 时间同步:定时任务+ ntpdate / chrony
  5. 文件描述符 每个进程可以打开的最大文件数量
  6. 开机自启动crond sysstat network rsyslog sshd (c6)
  7. 修改历史命令环境变量

2.优化体系

1)系统优化
2)服务优化
nginx
php
tomact

系统优化

1.基础优化

1)关闭SElinux NSA
2)firewalld cenetos7 lptables(c6) 安全组(阿里云)

2.网络管理服务

networkManagew network
相同点 管理网络
不同点 通过nmcli命令 修改配置文件 重启网卡生效

3.添加普通用户 配置sudo

oldboy ALL=(ALL)    NOPASSWD: ALL1 
image.png
image.png

4./etc/hosts文件 解析当前的主机名

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))
image.png

2.yum源配置

物理服务器和虚拟机
云服务器:默认配置了
yum源:修改系统默认的yum源 增加epel源

3.安装常见工具

image.png
image.png

4.时间同步:定时任务+ntpdate / chrony

5.文件描述符 每个进程可以打开的最大文件数量

临时 ulimit -n65535
永久 /etc/security/limits.conf                            echo '* - nofile 65535 ' >>/etc/security/limits.conf

6.开机自启动 crond sysstat network rsyslog sshd

image.png

7.修改历史命令环境变量

环境变量
1)系统定义
2)大写
3)在系统的大部分地方 含义一致

image.png
image.png
上一篇 下一篇

猜你喜欢

热点阅读