systemctl

systemctl

系统服务管理器指令

补充说明

systemctl命令 是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。

任务 旧指令 新指令
使某服务自动启动 chkconfig –level 3 httpd on systemctl enable httpd.service
使某服务不自动启动 chkconfig –level 3 httpd off systemctl disable httpd.service
检查服务状态 service httpd status systemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅显示是否 Active)
显示所有已启动的服务 chkconfig –list systemctl list-units –type=service
启动服务 service httpd start systemctl start httpd.service
停止服务 service httpd stop systemctl stop httpd.service
重启服务 service httpd restart systemctl restart httpd.service
重载服务 service httpd reload systemctl reload httpd.service

实例

systemctl start nfs-server.service . # 启动nfs服务
systemctl enable nfs-server.service # 设置开机自启动
systemctl disable nfs-server.service # 停止开机自启动
systemctl status nfs-server.service # 查看服务当前状态
systemctl restart nfs-server.service # 重新启动某服务
systemctl list-units --type=service # 查看所有已启动的服务

开启防火墙22端口

iptables -I INPUT -p tcp --dport 22 -j accept

如果仍然有问题,就可能是SELinux导致的

关闭SElinux:

修改/etc/selinux/config文件中的SELINUX=""为disabled,然后重启。

彻底关闭防火墙:

sudo systemctl status firewalld.service
sudo systemctl stop firewalld.service          
sudo systemctl disable firewalld.service

若文章对你有帮助,可以点赞或打赏支持我们。发布者:Aurora,转载请注明出处:http://61.174.243.28:13541/AY-knowledg-hub/systemctl/

(0)
AuroraAurora站点维系者
上一篇 2024年 3月 11日 下午5:22
下一篇 2024年 3月 11日 下午5:23

相关推荐

  • mesg

    文章目录mesg补充说明语法参数实例 mesg 设置当前终端的写权限 补充说明 mesg命令 用于设置当前终端的写权限,即是否让其他用户向本终端发信息。将mesg设置y时,其他用户…

    入门教程 2024年 1月 3日
  • arpwatch

    文章目录arpwatch补充说明语法选项 arpwatch 监听网络上ARP的记录 补充说明 arpwatch命令 用来监听网络上arp的记录。 语法 arpwatch(选项) 选…

    入门教程 2023年 12月 6日
  • iOS定位操作

    文章目录IOS定位操作简介实例步骤输出 IOS定位操作 简介 在IOS中通过CoreLocation定位,可以获取到用户当前位置,同时能得到装置移动信息。 实例步骤 1、创建一个简…

    2023年 4月 1日
  • cmp

    文章目录cmp补充说明语法选项参数实例 cmp 比较两个文件是否有差异 补充说明 cmp命令 用来比较两个文件是否有差异。当相互比较的两个文件完全一样时,则该指令不会显示任何信息。…

    入门教程 2023年 12月 7日
  • egrep

    文章目录egrep补充说明语法实例 egrep 在文件内查找指定的字符串 补充说明 egrep命令 用于在文件内查找指定的字符串。egrep执行效果与grep -E相似,使用的语法…

    入门教程 2023年 12月 14日
  • HTTP 状态码

    当浏览者访问一个网页时,浏览者的浏览器会向网页所在服务器发出请求。当浏览器接收并显示网页前,此网页所在的服务器会返回一个包含 HTTP 状态码的信息头(server header)…

    2023年 5月 14日
  • ssh-add

    文章目录ssh-add补充说明语法选项实例 ssh-add 把专用密钥添加到ssh-agent的高速缓存中 补充说明 ssh-add命令 是把专用密钥添加到ssh-agent的高速…

    入门教程 2024年 3月 11日
  • hwclock

    文章目录hwclock补充说明语法选项实例 hwclock 显示与设定硬件时钟 补充说明 hwclock命令 是一个硬件时钟访问工具,它可以显示当前时间、设置硬件时钟的时间和设置硬…

    入门教程 2023年 12月 15日
  • Docker 更改默认存储目录

    由于安装docker,默认的存储目录在根磁盘,会导致我们在拉取镜像的时候,更目录的空间越来越小,不修改存储目录的情况下,会导致我们可用空间越来越小,最终导致根目录不够用。根目录大点…

    2021年 11月 4日
  • mailstat

    文章目录mailstat补充说明语法选项参数 mailstat 显示到达的邮件状态 补充说明 mailstat命令 用来显示到达的邮件状态。 语法 mailstat(选项)(参数)…

    入门教程 2024年 1月 3日

发表回复

登录后才能评论
Translate »