Day07-操作系统基础优化
0. 环境变量/别名功能
全局配置和局部配置的冲突问题
结论:
- 局部配置:~/.bash_profile优先于~/.bashrc
- 全局配置:/etc/bashrc优先于**/etc/profile**
- 局部变量设置优先于全局设置
PS:\ 转义字符,还原命令本身作用
1. 系统基础管理优化
1.1 时间同步优化
- 实现时间同步:
- 修改设置好时区:
timedatectl set-timezone Asia/Shanghai - 同步时间:
- 手工同步:
yum install -y ntpdatentpdate ntp.aliyun.com - 自动同步:
timedatectl set-ntp 1启用后还未同步则systemctl start chronyd
- 手工同步:
- 观察Local time Time zone NTP enabled NTP synchronized是否正确
- 修改设置好时区:
1.2 系统字符编码优化
作用:避免系统字符出现乱码
- localectl set-locale LANG=zh_CN.utf8
1.3 系统软件下载优化
- 下载软件程序慢
- 下载的软件没有
设置镜像源(阿里云/清华源)mirrors.aliyun.com
扩展:
yum repolist查看应用的仓库
1.4 系统软件安全功能优化
- selinux:限制root用户操作行为
- 临时关闭:
setenforce 0(getenforce查看是否关闭) - 永久关闭:
vim /etc/selinux/config编辑- 修改7gg为disabled
- 临时关闭:
- firewalld:防火墙服务,实现外网访问隔离
- 临时关闭:
systemctl stop firewalld.service - 永久关闭:
systemctl disable firewalld.service - 查看状态:
systemctl is-active firewalld.servicesystemctl is-enabled firewalld.service
- 临时关闭:
1.5 系统远程连接优化
vim /etc/ssh/sshd_config编辑配置信息- 79gg 修改为no //已使用password验证,GSSAPI验证功能没必要开启,会影响速度
- 115gg 去掉注释,改为no //关掉反向DNS验证 //#内容为默认开启
[!note]
正向DNS: 域名 -> IP地址
反向DNS: IP地址 -> 域名 systemctl restart sshd重启服务
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Mandarava23!
评论


