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

相关推荐

  • iftop

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

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

    文章目录sed补充说明sed的选项、命令、替换标记选项参数sed命令sed替换标记sed元字符集sed用法实例替换操作:s命令全面替换标记g定界符删除操作:d命令已匹配字符串标记&…

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

    文章目录elinks补充说明语法选项参数 elinks 纯文本界面的WWW浏览器 补充说明 elinks命令 能实现一个纯文本界面的WWW浏览器,操作方式与“lynx”类似。 语法…

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

    文章目录dhcrelay补充说明语法选项例子 dhcrelay 使用dhcrelay命令可以提供中继DHCP和BOOTP请求 补充说明 dhcrelay命令 使用dhcrelay命…

    入门教程 2023年 12月 7日
  • HTTP 响应头信息

    HTTP请求头提供了关于请求,响应或者其他的发送实体的信息。 在本章节中我们将具体来介绍HTTP响应头信息。 应答头 说明 Allow 服务器支持哪些请求方法(如GET、POST等…

    2023年 5月 14日
  • Helm | Helm 回滚

    文章目录helm rollback简介可选项从父命令继承的命令请参阅 helm rollback 回滚发布到上一个版本 简介 该命令回滚发布到上一个版本 回滚命令的第一个参数是发布…

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

    Java 是由 Sun Microsystems 公司于 1995 年 5 月推出的高级程序设计语言。 Java 可运行于多个平台,如 Windows, Mac OS 及其他多种 …

    2023年 3月 4日
  • ifstat

    文章目录ifstat补充说明下载编译安装选项实例 ifstat 统计网络接口流量状态 补充说明 ifstat命令 就像iostat/vmstat描述其它的系统状况一样,是一个统计网…

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

    文章目录badblocks补充说明语法选项参数实例其他 badblocks 查找磁盘中损坏的区块 补充说明 badblock命令 用于查找磁盘中损坏的区块。 硬盘是一个损耗设备,当…

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

    文章目录rmmod补充说明语法选项参数实例 rmmod 从运行的内核中移除指定的内核模块 补充说明 rmmod命令 用于从当前运行的内核中移除指定的内核模块。执行rmmod指令,可…

    入门教程 2024年 3月 4日

发表回复

登录后才能评论
Translate »