赞
踩
目录
(2)查看状态systemctl status httpd,active为dead为无法使用状态
(1)临时启动一次systemctl start httpd,active为running已启动服务可以使用
(2)开机自启动systemctl enable httpd
(1)临时停止一次systemctl stop httpd,已关闭
(2)永久禁用服务systemctl disable httpd
- [root@sulibao ~]# yum install -y httpd
- Updating Subscription Management repositories.
- Unable to read consumer identity
-
- This system is not registered with an entitlement server. You can use subscription-manager to register.
-
- Last metadata expiration check: 14:01:12 ago on Wed 11 Jan 2023 09:53:23 PM CST.
- Package httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64 is already installed.
- Dependencies resolved.
- Nothing to do.
- Complete!
- [root@sulibao ~]# systemctl status httpd
- ● httpd.service - The Apache HTTP Server
- Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor pres>
- Active: inactive (dead)
- Docs: man:httpd.service(8)
- [root@sulibao ~]# systemctl start httpd
- [root@sulibao ~]# systemctl status httpd
- ● httpd.service - The Apache HTTP Server
- Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor pres>
- Active: active (running) since Thu 2023-01-12 11:58:03 CST; 11s ago
- Docs: man:httpd.service(8)
- Main PID: 8291 (httpd)
- Status: "Started, listening on: port 80"
- Tasks: 213 (limit: 65651)
- Memory: 55.4M
- CGroup: /system.slice/httpd.service
- ├─8291 /usr/sbin/httpd -DFOREGROUND
- ├─8307 /usr/sbin/httpd -DFOREGROUND
- ├─8308 /usr/sbin/httpd -DFOREGROUND
- ├─8309 /usr/sbin/httpd -DFOREGROUND
- └─8322 /usr/sbin/httpd -DFOREGROUND
-
- Jan 12 11:57:52 sulibao systemd[1]: Starting The Apache HTTP Server...
- Jan 12 11:58:03 sulibao httpd[8291]: AH00558: httpd: Could not reliably determi>
- Jan 12 11:58:03 sulibao systemd[1]: Started The Apache HTTP Server.
- Jan 12 11:58:13 sulibao httpd[8291]: Server configured, listening on: port 80
- //显示你所做的操作
- [root@sulibao ~]# systemctl enable httpd
- Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
- //为httpd服务创建了软链接
systemctl restart httpd
[root@sulibao ~]# systemctl restart httpd
- [root@sulibao ~]# systemctl stop httpd
- [root@sulibao ~]# systemctl status httpd
- ● httpd.service - The Apache HTTP Server
- Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor prese>
- Active: inactive (dead) since Thu 2023-01-12 12:03:50 CST; 10s ago
- Docs: man:httpd.service(8)
- Process: 8615 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, s>
- Main PID: 8615 (code=exited, status=0/SUCCESS)
- Status: "Running, listening on: port 80"
-
- Jan 12 12:02:02 sulibao systemd[1]: Starting The Apache HTTP Server...
- Jan 12 12:02:17 sulibao httpd[8615]: AH00558: httpd: Could not reliably determi>
- Jan 12 12:02:17 sulibao systemd[1]: Started The Apache HTTP Server.
- Jan 12 12:02:27 sulibao httpd[8615]: Server configured, listening on: port 80
- Jan 12 12:03:49 sulibao systemd[1]: Stopping The Apache HTTP Server...
- Jan 12 12:03:50 sulibao systemd[1]: httpd.service: Succeeded.
- Jan 12 12:03:50 sulibao systemd[1]: Stopped The Apache HTTP Server.
- [root@sulibao ~]# systemctl disable httpd
- Removed /etc/systemd/system/multi-user.target.wants/httpd.service.
- [root@sulibao ~]# systemctl reload httpd
- httpd.service is not active, cannot reload.
- [root@sulibao ~]# systemctl restart httpd
- [root@sulibao ~]# systemctl reload httpd
使用setenforce 0命令临时关闭SElinux
- [root@sulibao ~]# setenforce 0
- setenforce: SELinux is disabled
查看状态是否关闭
- [root@sulibao ~]# getenforce
- Disabled
(1)修改配置文件/etc/selinux/config
[root@sulibao ~]# vim /etc/selinux/config
(2)将文件内SELINUX=XX这行改为 SELINUX=disabled或者SELINUX=permissive,然后保存退出,重启生效
-
- # 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=disabled
- # SELINUXTYPE= can take one of three values:
- # targeted - Targeted processes are protected,
- # minimum - Modification of targeted policy. Only selected processes are protected.
- # mls - Multi Level Security protection.
- SELINUXTYPE=targeted
(3)重启过后使用getenforce查看SElinux状态,为Disabled或permissive即可认为关闭成功
- [root@sulibao ~]# getenforce
- Disabled
systemctl status firewalld,active为running表示正在运行
- [root@sulibao ~]# systemctl status firewalld
- ● firewalld.service - firewalld - dynamic firewall daemon
- Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
- Active: inactive (dead)
- Docs: man:firewalld(1)
- [root@sulibao ~]# systemctl restart firewalld
- [root@sulibao ~]# systemctl status firewalld
- ● firewalld.service - firewalld - dynamic firewall daemon
- Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
- Active: active (running) since Fri 2023-01-06 13:32:07 CST; 2s ago
- Docs: man:firewalld(1)
- Main PID: 28795 (firewalld)
- Tasks: 2
- CGroup: /system.slice/firewalld.service
- └─28795 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
-
- Jan 06 13:32:06 sulibao systemd[1]: Starting firewalld - dynamic firewall daemon...
- Jan 06 13:32:07 sulibao systemd[1]: Started firewalld - dynamic firewall daemon.
- Jan 06 13:32:07 sulibao firewalld[28795]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be removed in a ...ng it now.
- Hint: Some lines were ellipsized, use -l to show in full.
systemctl stop firewalld 此次关闭,下次不关闭
systemctl disable firewalld 禁用,永久关闭
- [root@sulibao ~]# systemctl stop firewalld
- [root@sulibao ~]# systemctl disable firewalld
- Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
- Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
查看firewalld服务状态,active为dead,此时已经永久关闭
- [root@sulibao ~]# systemctl status firewalld
- ● firewalld.service - firewalld - dynamic firewall daemon
- Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
- Active: inactive (dead)
- Docs: man:firewalld(1)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。