om/前置配置/3.关闭强化(根据需要设置).md

40 lines
700 B
Markdown
Raw Normal View History

2023-09-19 10:11:14 -04:00
## 防火墙
```shell
# 关闭防火墙
systemctl stop firewalld
# 关闭开机启动
systemctl disable firewalld
# 校验状态
firewall-cmd --state
```
# 关闭selinux Security-Enhanced Linux
```shell
# 临时关闭
setenforce 0
# 修改配置文件关闭
sed -ri 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# 校验状态
sestatus
```
# 交换分区设置
```shell
# 临时关闭
swapoff -a
# 修改配置文件
sed -ri 's/.*swap.*/#&/' /etc/fstab
# 修改配置文件
echo "vm.swappiness=0" >> /etc/sysctl.conf
# 更新
sysctl -p
```
## 同步时间
```shell
# 安装
yum -y install ntpdate
# 同步阿里云时间
crontab -e
0 */1 * * * ntpdate time1.aliyun.com
```