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

相关推荐

  • gcc

    文章目录gcc补充说明语法选项参数实例 gcc 基于C/C++的编译器 补充说明 gcc命令 使用GNU推出的基于 C/C++ 的编译器,是开放源代码领域应用最广泛的编译器,具有功…

    入门教程 2023年 12月 14日
  • Helm | Helm 仓库索引

    文章目录helm repo index简介可选项从父命令继承的命令请参阅 helm repo index 基于包含打包chart的目录,生成索引文件 简介 读取当前目录,并根据找到…

    入门教程 2023年 12月 14日
  • atrm

    文章目录atrm补充说明语法选项参数实例 atrm 删除待执行任务队列中的指定任务 补充说明 atrm命令 用于删除待执行任务队列中的指定任务。 语法 atrm(选项)(参数) 选…

    入门教程 2023年 12月 6日
  • usermod

    文章目录usermod补充说明语法选项参数实例 usermod 用于修改用户的基本信息 补充说明 usermod命令 用于修改用户的基本信息。usermod 命令不允许你改变正在线…

    入门教程 2024年 3月 11日
  • ssh-agent

    文章目录ssh-agent补充说明语法选项实例 ssh-agent ssh密钥管理器 补充说明 ssh-agent命令 是一种控制用来保存公钥身份验证所使用的私钥的程序。ssh-a…

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

    文章目录objdump补充说明选项实例 objdump 显示二进制文件信息 补充说明 objdump命令 是用查看目标文件或者可执行的目标文件的构成的gcc工具。 选项 -a –…

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

    文章目录unset概要主要用途选项参数返回值例子注意 unset 删除指定的shell变量或函数。 概要 unset [-f] [-v] [-n] [name …] 主要用途 …

    入门教程 2024年 3月 11日
  • iptables-save

    文章目录iptables-save补充说明语法选项实例 iptables-save 备份iptables的表配置 补充说明 iptables-save命令 用于将linux内核中的…

    入门教程 2023年 12月 19日
  • axel

    文章目录axel补充说明安装语法选项实例 axel 多线程下载工具 补充说明 axel 是Linux下一个不错的HTTP/ftp高速下载工具。支持多线程下载、断点续传,且可以从多个…

    入门教程 2023年 12月 6日
  • xauth

    文章目录xauth补充说明语法选项参数 xauth 显示和编辑被用于连接X服务器的认证信息 补充说明 xauth命令 用于显示和编辑被用于连接X服务器的认证信息。 语法 xauth…

    入门教程 2024年 3月 11日

发表回复

登录后才能评论
Translate »