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

相关推荐

  • Helm | Helm 列表

    文章目录helm list简介可选项从父命令继承的命令请参阅 helm list 列举发布版本 简介 该命令会列举出指定命名空间的所有发布版本,(如果没有指定命名空间,会使用当前命…

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

    文章目录edquota补充说明语法选项参数实例 edquota 用于编辑指定用户或工作组磁盘配额 补充说明 edquota命令 用于编辑指定用户或工作组磁盘配额。edquota预设…

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

    文章目录rpmsign补充说明语法选项 rpmsign 使用RPM软件包的签名管理工具 补充说明 rpmsign命令 使用rpm软件包的签名管理工具。 语法 rpmsign(选项)…

    入门教程 2024年 3月 4日
  • su

    文章目录su补充说明语法选项参数实例 su 用于切换当前用户身份到其他用户身份 补充说明 su命令 用于切换当前用户身份到其他用户身份,变更时须输入所要变更的用户帐号与密码。 语法…

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

    文章目录dig补充说明语法选项参数实例 dig 域名查询工具 补充说明 dig命令 是常用的域名查询工具,可以用来测试域名系统工作是否正常。 语法 dig(选项)(参数) 选项 @…

    入门教程 2023年 12月 7日
  • Git 远程仓库(Github)

    Git 并不像 SVN 那样有个中心服务器。 目前我们使用到的 Git 命令都是在本地执行,如果你想通过 Git 分享你的代码或者与其他开发人员合作。 你就需要将数据放到一台其他开…

    2024年 4月 30日
  • smbpasswd

    文章目录smbpasswd补充说明语法选项参数 smbpasswd samba用户和密码管理工具 补充说明 smbpasswd命令 属于samba套件,能够实现添加或删除samba…

    入门教程 2024年 3月 5日
  • partprobe

    文章目录partprobe补充说明语法选项参数实例 partprobe 不重启的情况下重读分区 补充说明 partprobe命令 用于重读分区表,当出现删除文件后,出现仍然占用空间…

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

    文章目录lftpget补充说明语法选项参数 lftpget 调用lftp指令下载指定的文件 补充说明 lftpget命令 通过调用lftp指令下载指定的文件。 语法 lftpget…

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

    文章目录swapon补充说明语法选项参数实例 swapon 激活Linux系统中交换空间 补充说明 swapon命令 用于激活Linux系统中交换空间,Linux系统的内存管理必须…

    入门教程 2024年 3月 11日

发表回复

登录后才能评论
Translate »