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

相关推荐

  • sync

    文章目录sync补充说明语法选项buffer与cache sync 用于强制被改变的内容立刻写入磁盘 补充说明 sync命令 用于强制被改变的内容立刻写入磁盘,更新超块信息。 在L…

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

    文章目录ncftp补充说明语法选项参数安装实例 ncftp 是增强的的FTP工具 补充说明 ncftp命令 是增强的的ftp工具,比传统的FTP指令更加强大。FTP让用户得以下载存…

    入门教程 2024年 1月 10日
  • grpck

    文章目录grpck补充说明语法选项实例 grpck 用于验证组文件的完整性 补充说明 grpck命令 用于验证组文件的完整性,在验证之前,需要先锁定(lock)组文件/etc/gr…

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

    文章目录neofetch补充说明安装语法返回 neofetch 显示带有发行徽标的系统信息的工具 补充说明 neofetch 支持Linux/Unix、Windows、macOS。…

    入门教程 2024年 1月 10日
  • diff

    文章目录diff补充说明语法选项参数实例以正常模式比较差异以上下文 (context) 模式比较差异以联合 (unified) 模式比较差异多文件比较差异 diff 比较给定的两个…

    入门教程 2023年 12月 7日
  • Java 多态

    多态是同一个行为具有多个不同表现形式或形态的能力。 多态就是同一个接口,使用不同的实例而执行不同操作,如图所示: 多态性是对象多种表现形式的体现。 现实中,比如我们按下 F1 键这…

    2023年 3月 9日
  • rpmverify

    文章目录rpmverify补充说明语法选项 rpmverify 验证已安装的RPM软件包的正确性 补充说明 rpmverify命令 用来验证已安装的rpm软件包的正确性。 语法 r…

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

    文章目录xset补充说明语法选项参数 xset 设置X-Window系统中的用户爱好的实用工具 补充说明 xset命令 是设置X-Window系统中的用户爱好的实用工具。 语法 x…

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

    文章目录blkid补充说明语法选项实例 blkid 查看块设备的文件系统类型、LABEL、UUID等信息 补充说明 在Linux下可以使用 blkid命令 对查询设备上所采用文件系…

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

    文章目录mysqladmin补充说明语法选项参数 mysqladmin MySQL服务器管理客户端 补充说明 mysqladmin命令 是mysql服务器管理任务的客户端工具,它可…

    入门教程 2024年 1月 3日

发表回复

登录后才能评论
Translate »