树莓派俱乐部 树莓派俱乐部
  • 首页
  • 树莓派
  • OpenWrt
  • Python
  • Linux
  • 注册
    登录
现在登录。
  • 首页
  • 树莓派
  • OpenWrt
  • Python
  • Linux
首页 Linux CentOS 8 时间同步和如何关闭防火墙

CentOS 8 时间同步和如何关闭防火墙

束发少年 6 年 前

前几天CentOS 8 发布了正式版本,全新安装后发现时间同步和防火墙让我恼火了一下午,因为弄些不可描述的服务,所以用的大佬DD脚本,所以记录一下CentOS 8 下如何时间自动同步和关闭自带的selinux、Firewall。

时间同步

在CentOS 8只能用chrony 来同步时间。

安装chrony:

yum -y install chrony

运行 chrony

systemctl enable chronyd

查看是否设置了开机启动:

systemctl is-enabled chronyd

如果现实enabled说明成功运行。开启chrony:

systemctl start chronyd

时区的设置:

timedatectl list-timezones # 列出所有时区
timedatectl set-local-rtc 1 # 将硬件时钟调整为与本地时钟一致, 0 为设置为 UTC 时间
timedatectl set-timezone Asia/Shanghai # 设置系统时区为上海
timedatectl set-ntp yes # 设置开启自动同步

关闭SELINUX、firewalld

大部分时间对折两个自带的防火墙用不着,所以直接关闭:

查看运行状态:

systemctl status firewalld

禁止开机启动:

systemctl disable firewalld

停止运行

systemctl stop firewalld

关闭SElinux

查看运行状态:

getenforce

如果现实Enforcing 说明是开启状态。

编辑配置文件:

vim /etc/selinux/config

内容大概如下:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

将SELINUX=enforcing 修改为 SELINUX=disabled 即可。

#Centos#Linux#时间同步#防火墙
1
束发少年
用自己的眼睛去读世间这一部书。
评论 (0)
返回
    发表评论
猜你喜欢
  • CentOS8安装LNMP/LAMP环境
  • 如何构建树莓派64位系统(5)把文件放入镜像
  • 如何构建树莓派64位系统(4)制作镜像
  • 如何构建树莓派64位系统(3)编译初始化根目录(非必要)
束发少年
28
文章
7
评论
86
获赞
文章聚合
树莓派搭建minecraft我的世界基岩版服务器
5 年 前
树莓派如何安装中文输入法
5 年 前
树莓派 Ubuntu 18.04 更换apt 源
6 年 前
树莓派zero wh自动连接无线网和usb共享网络
5 年 前
树莓派+pn532使用NFC
6 年 前
  • 首页
Copyright © 2018-2025 树莓派俱乐部. Designed by nicetheme.