[内容] Linux 日志文件权限的设置 (RHEL & SLES 版)

步骤一:设置日志文件的权限

# vi /etc/rsyslog.conf

添加以下内容:

......
$FileOwner root
$FileGroup root
$FileCreateMode 0640
$DireCreateMode 0640

或者:

......
$FileOwner root
$FileGroup root
$Umask 0137

(补充:这里以所属主是 root、所属组是 root、文件的权限是 0640、目录的权限是 0755 为例)

步骤二:让刚刚修改的 auditd 配置文件生效

如果是 RHEL 6 和 RHEL 6 之前的版本 RHEL:

# service rsyslog restart
# service auditd restart

如果是 RHEL 7 和 RHEL 7 之后版本的 RHEL 或者是 SLES:

# systemctl restart rsyslog
# service auditd restart

[内容] systemd 服务管理文件的常用参数

内容一:systemd 服务管理文件在系统中的位置

/etc/systemd/system/

内容二:systemd 服务管理文件的常用参数

[Unit]
Description=<service name>
Before=<another1.service> <another2.service> <another3.service>......
After=<another1.service> <another2.service> <another3.service>......
Requires=<another1.service> <another2.service> <another3.service>......

[Service]
Type=<type name>
ExecStart=<script>

[Install]
WantedBy=<action1>.target
WantedBy=<action2>.target
WantedBy=<action3>.target
......


补充:
1) Description= 服务的名称
2) Before= 必须在什么服务启动之前启动此服务
3) After= 必须在什么服务启动之后启动此服务
4) Requires= 启动此服务必须要求什么服务
5) Type= 启动此服务的方式,可以是 oneshot 或者 forking
6) ExecStart= 要执行的脚本
7) WantedBy= 在系统执行什么动作时启动此服务,可以是 default.target、poweroff.target、reboot.target 或者 halt.target

[排错] RHEL 8 及以上解决系统升级 Nginx 后使用 yum 命令时显示警告 “Problem: module……,but none of the providers can be installed”

报错代码

 Problem: module php:7.2:820181215112050:76554e01.x86_64 from rhel-8-for-x86_64-appstream-rpms requires module(nginx:1.14), but none of the providers can be installed
  - module nginx:1.14:820181214004940:9edba152.x86_64 from rhel-8-for-x86_64-appstream-rpms conflicts with module(nginx:1.24) provided by nginx:1.24:8100020240119085512:e155f54d.x86_64 from rhel-8-for-x86_64-appstream-rpms
  - module nginx:1.24:8100020240119085512:e155f54d.x86_64 from rhel-8-for-x86_64-appstream-rpms conflicts with module(nginx:1.14) provided by nginx:1.14:820181214004940:9edba152.x86_64 from rhel-8-for-x86_64-appstream-rpms
  - module nginx:1.14:8000020190830002848:f8e95b4e.x86_64 from rhel-8-for-x86_64-appstream-rpms conflicts with module(nginx:1.24) provided by nginx:1.24:8100020240119085512:e155f54d.x86_64 from rhel-8-for-x86_64-appstream-rpms
  - module nginx:1.24:8100020240119085512:e155f54d.x86_64 from rhel-8-for-x86_64-appstream-rpms conflicts with module(nginx:1.14) provided by nginx:1.14:8000020190830002848:f8e95b4e.x86_64 from rhel-8-for-x86_64-appstream-rpms
  - conflicting requests
Dependencies resolved.

解决方法一:禁用所有和 nginx 模块有关联的 php 模块

# dnf module disable php

解决方法二:开启最新版本的 php 模块

# dnf module reset php && dnf module enable php:7.2

(补充:这里以设置 php:7.2 模块为例)