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

相关推荐

  • chattr

    文章目录chattr补充说明语法选项实例 chattr 用来改变文件属性 补充说明 chattr命令 用来改变文件属性。这项指令可改变存放在ext2文件系统上的文件或目录属性,这些…

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

    文章目录iftop补充说明语法选项界面说明实例 iftop 一款实时流量监控工具 补充说明 iftop命令 是一款实时流量监控工具,监控TCP/IP连接等,缺点就是无报表功能。必须…

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

    文章目录unrar语法安装选项SWITCHES 开关设置参数实例 unrar 解压rar文件命令,从 rar 压缩包中提取文件 语法 unrar [选项][switch 命令] […

    入门教程 2024年 3月 11日
  • dpkg-deb

    文章目录dpkg-deb补充说明语法选项参数实例 dpkg-deb Debian Linux下的软件包管理工具 补充说明 dpkg-deb命令 是Debian Linux下的软件包…

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

    文章目录rsync补充说明语法选项实例 rsync 远程数据同步工具 补充说明 rsync命令 是一个远程数据同步工具,可通过LAN/WAN快速同步多台主机间的文件。rsync使用…

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

    文章目录touch补充说明语法选项参数实例 touch 创建新的空文件 补充说明 touch命令 有两个功能:一是用于把已存在文件的时间标签更新为系统当前的时间(默认方式),它们的…

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

    文章目录fuser补充说明语法选项参数实例 fuser 使用文件或文件结构识别进程 补充说明 fuser命令 用于报告进程使用的文件和网络套接字。fuser命令列出了本地进程的进程…

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

    文章目录pgrep补充说明语法选项参数实例 pgrep 根据用户给出的信息在当前运行进程中查找并列出符合条件的进程ID(PID) 补充说明 pgrep命令 以名称为依据从运行进程队…

    入门教程 2024年 3月 1日
  • 31. 自定义错误

    欢迎来到 Golang 系列教程的第 31 篇。 在上一教程里,我们学习了 Go 中的错误是如何表示的,并学习了如何处理标准库里的错误。我们还学习了从标准库的错误中提取更多的信息。…

    2023年 12月 5日
  • grpconv

    文章目录grpconv补充说明语法实例 grpconv 用来开启群组的投影密码 补充说明 grpconv命令 用来开启群组的投影密码。Linux系统里的用户和群组密码,分别存放在/…

    入门教程 2023年 12月 14日

发表回复

登录后才能评论
Translate »