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

相关推荐

  • lvremove

    文章目录lvremove补充说明语法选项参数实例 lvremove 删除指定LVM逻辑卷 补充说明 lvremove命令 用于删除指定LVM逻辑卷。如果逻辑卷已经使用mount命令…

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

    文章目录nc补充说明语法选项实例 nc nc是网络工具中的瑞士军刀 补充说明 nc命令 全称netcat,用于TCP、UDP或unix域套接字(uds)的数据流操作,它可以打开TC…

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

    文章目录cmp补充说明语法选项参数实例 cmp 比较两个文件是否有差异 补充说明 cmp命令 用来比较两个文件是否有差异。当相互比较的两个文件完全一样时,则该指令不会显示任何信息。…

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

    文章目录iptraf补充说明语法选项 iptraf 实时地监视网卡流量 补充说明 iptraf命令 可以实时地监视网卡流量,可以生成网络协议数据包信息、以太网信息、网络节点状态和i…

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

    文章目录logname概要主要用途选项返回值例子注意 logname 打印当前终端登录用户的名称。 概要 logname [OPTION]… 主要用途 打印当前终端登录用户的名…

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

    文章目录vmstat补充说明语法选项参数实例 vmstat 显示虚拟内存状态 补充说明 vmstat命令 的含义为显示虚拟内存状态(“Viryual Memor Statics”)…

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

    文章目录prtstat补充说明语法例子注意 prtstat 显示进程信息 补充说明 prtstat命令打印指定进程的统计信息。这个信息来自/proc/PID/stat文件。 语法 …

    入门教程 2024年 3月 1日
  • 如何让自己的模糊视频变高清(4K)?

    有些视频是不是看着很模糊,又不忍心丢掉。比如一段回忆,一个瞬间。下面安利一个很好用的软件,可以通过使用AI深度学习能力,将视频像素进行提升。 文章目录演示视频此软件对电脑要求较高,…

    2021年 7月 29日
  • Java 条件语句 – if…else

    Java 中的条件语句允许程序根据条件的不同执行不同的代码块。 一个 if 语句包含一个布尔表达式和一条或多条语句。 文章目录语法Test.java 文件代码:if…e…

    入门教程 2023年 3月 4日
  • rsync

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

    入门教程 2024年 3月 4日

发表回复

登录后才能评论
Translate »