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

相关推荐

  • read

    文章目录read补充说明语法选项参数实例read命令示例 read 从键盘读取变量值 补充说明 read命令 从键盘读取变量的值,通常用在shell脚本中与用户进行交互的场合。该命…

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

    文章目录true概要主要用途返回值例子注意 true 返回状态为成功。 概要 true 主要用途 用于和其他命令进行逻辑运算。 返回值 返回状态总是成功;返回值为0。 例子 # 当…

    入门教程 2024年 3月 11日
  • Java 对象和类

    Java作为一种面向对象语言。支持以下基本概念: 多态 继承 封装 抽象 类 对象 实例 方法 重载 本节我们重点研究对象和类的概念。 对象:对象是类的一个实例(对象不是找个女朋友…

    2023年 3月 4日
  • 介绍和安装

    文章目录介绍和安装什么是Golang为什么选择Golang选择Go时的一些优点安装苹果系统Windows 系统Linux 系统环境配置linux1.下载安装包 or 直接安装2.解…

    2023年 12月 5日
  • dircolors

    文章目录dircolors补充说明语法选项参数实例 dircolors 置ls命令在显示目录或文件时所用的色彩 补充说明 dircolors命令 设置ls命令在显示目录或文件时所用…

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

    文章目录kill目录内建命令概要主要用途选项参数返回值例子注意外部命令概要主要用途选项参数例子返回值注意参考链接 kill 发送信号到进程。 目录 bash内建命令 GNU cor…

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

    文章目录ifconfig补充说明语法参数实例 ifconfig 配置和显示Linux系统网卡的网络参数 补充说明 ifconfig命令 被用于配置和显示Linux内核中网络接口的网…

    入门教程 2023年 12月 19日
  • Java 方法

    在前面几个章节中我们经常使用到 System.out.println(),那么它是什么呢? println() 是一个方法。 System 是系统类。 out 是标准输出对象。 这…

    2023年 3月 4日
  • ls

    文章目录ls补充说明语法选项参数实例扩展知识不同颜色代表的文件类型 ls 显示目录内容列表 补充说明 ls命令 就是list的缩写,用来显示目标列表,在Linux中是使用率较高的命…

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

    文章目录quota补充说明语法选项参数实例 quota 显示磁盘已使用的空间与限制 补充说明 quota命令 用于显示用户或者工作组的磁盘配额信息。输出信息包括磁盘使用和配额限制。…

    入门教程 2024年 3月 1日

发表回复

登录后才能评论
Translate »