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

实例

1.启动nfs服务

systemctl start nfs-server.service

2.设置开机自启动

systemctl enable nfs-server.service

3.停止开机自启动

systemctl disable nfs-server.service

4.查看服务当前状态

systemctl status nfs-server.service

5.重新启动某服务

systemctl restart nfs-server.service

6.查看所有已启动的服务

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
原文地址:http://man.linuxde.net/systemctl

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:https://www.178linux.com/96942

赞 (2)
小孜然小孜然
上一篇 2018-04-23 22:59
下一篇 2018-04-24 10:54

相关推荐

  • 计算机原理与Linux基础

    计算机的组成及功能 1、其实计算机的组织分为内部设备和外部设备, 内部设备:         CPU:运算器、寄存器、缓存         存储器:内存,RAM(Random Access Memory)         控制器:控制器是整个计算机系统的控制中心,它指挥计算机各部分协调地工作,保证计算机按照预先规定的目标和步骤有条不紊地进行操作及处理。 外部…

    Linux笔记 2018-05-13
  • linux入门命令

    bc:计算器 mainframe 缓存查看:lscpu磁盘和内存性能测试命令: dd Xmanager (xshell) 安装:用户名: byg公司: microsoft注册码: 使用工具生成 命令库调用: # ldd /bin/ls系统库跟踪,调用库详细信息 # strace lslibrary 库跟踪 # ltrace ls 二进制文件查看: # hex…

    Linux笔记 2018-07-21
  • mysql主从复制

    首先配置主从复制结构 主节点: # vim /etc/my.cnf.d/server.cnf [mysqld] server_id=1 log_bin=master-bin innodb_file_per_table=on skip_name_resolve=on # systemctl start mairadb mysql> grant repli…

    Linux笔记 2018-06-10
  • ansible的使用

    运维自动化发展历程及技术应用 IAAS基础设置即服务,提供硬件服务 PAAS平台即服务,提供操作系统服务 SAAS软件即服务,提供整套服务   ansible的安装 yum -y install ansible ansible –version 查看版本信息   /etc/ansible/ansible.cfg  配置文件 /…

    Linux笔记 2018-06-04
  • ansible httpd

    卸载服务ansible all -m shell -a ‘yum -y remove nginx’ 检查用户 组 uid gidansible all -m shell -a ‘getent passwd nginx’ansible all -m shell -a ‘getent group ngi…

    Linux笔记 2018-07-23
  • LAMP架构实现

    LAMP是一组Web应用软件的组合,Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,所有组成产品均是开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同组成了一个强大的Web应用程序平台。

    2018-06-23