转载自:http://linux.it.net.cn/CentOS/fast/2014/0720/3212.html

CentOS 7.0中已经没有service命令,而是启用了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

下面以nfs服务为例:

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

CentOS 7.0 服务管理 – systemctl 命令的更多相关文章

  1. Linux服务器,服务管理--systemctl命令详解,设置开机自启动

    Linux服务器,服务管理--systemctl命令详解,设置开机自启动 syetemclt就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了. 摘要: syst ...

  2. Linux服务管理 systemctl命令详解

    Linux服务器,服务管理--systemctl命令详解,设置开机自启动 syetemclt就是service和chkconfig这两个命令的整合     任务 旧指令 新指令 使某服务自动启动 ch ...

  3. 服务管理--systemctl命令

    摘要: systemctl 是系统服务管理器命令,它实际上将 service 和 chkconfig 这两个命令组合到一起. 任务 旧指令 新指令 使某服务自动启动 chkconfig --level ...

  4. systemd服务管理---systemctl命令列出所有服务

    1.列出系统所有服务 #systemctl list-units --all --type=service

  5. Linux软件安装——服务管理的命令

    Linux软件安装——服务管理的命令 摘要:本文主要学习了Linux系统中服务管理的命令. service命令 service命令用于对系统服务进行管理,比如启动(start).停止(stop).重启 ...

  6. systemd服务管理--systemctl常用命令

    转自 :https://m635674608.iteye.com/blog/2359480 1. #systemctl enable crond.service //让某个服务开机启动(.servic ...

  7. centos 7.0 firewall 防火墙常用命令

    1.查看防火墙是否在运行  firewall-cmd --state [root@localhost ~]# firewall-cmd --staterunning 2.查看都有哪些端口添加到例外 f ...

  8. Centos 7.0系统服务管理

    从Centos7开始,不再用sysvinit管理系统服务了,而是改用了systemd,因此对系统服务管理方法已经变更,以下简述 1.查看当前所有系统服务的状态 systemctl 2.查看指定系统服务 ...

  9. nacos1.0.0 服务管理使用mysql

    在自己的MySQL中添加nacos_config数据库,在nacos\conf 下找到nacos-mysql.sql.拷贝里面的sql语句创建表和数据 INSERT INTO users (usern ...

随机推荐

  1. NOIP2018 集训(二)

    A题 神炎皇 问题描述 神炎皇乌利亚很喜欢数对,他想找到神奇的数对. 对于一个整数对 \((a,b)\) ,若满足 \(a+b\leq n\) 且 \(a+b\) 是 \(ab\) 的因子,则称 为神 ...

  2. ExtJs学习之MessAgeBox的使用

    1.Ext.MessageBox.alert() 调用格式: alert( String title, String msg, [Function fn], [Object scope] ) 参数说明 ...

  3. 电脑显卡4种接口类型:VGA、DVI、HDMI、DP

    电脑显卡全称显示接口卡(Video card,Graphics card),又称为显示适配器(Video adapter),显示器配置卡简称为显卡,是个人电脑最基本组成部分之一.对于显卡接口类型,主要 ...

  4. php连接数据库增删改查----多条件查询

    关于查询,可以直接写在主页面上 来进行查询 首先,先建立一个表单 <form method="post" action="crud.php"> &l ...

  5. Java 中xml解析

    1.String 字符串保持到txt文件 String xml ="abcdefghijk"; FileWriter fw = null; File f = new File(&q ...

  6. DataBase -- SQL INNER JOIN

    SQL INNER JOIN 关键字 在表中存在至少一个匹配时,INNER JOIN关键字返回行. INNER JIN关键字语法 SELECT column_name(s) FROM table_na ...

  7. <转自原博客> 可爱的字符串算法们

    在非常强又非常关心学弟学妹学习的企鹅学长变态的考纲下,我们无奈中选择一起学习新姿势 first:KMP算法 这是一个小迪更过博客的算法,我就不好意思在这里献丑了,所以献上友链一份:http://rab ...

  8. 3.2 Lucene实战:一个简单的小程序

    在讲解Lucene索引和检索的原理之前,我们先来实战Lucene:一个简单的小程序! 一.索引小程序 首先,new一个java project,名字叫做LuceneIndex. 然后,在project ...

  9. hdu6188&&百度之星初赛(B) T5

    度度熊的交易计划 Problem Description 度度熊参与了喵哈哈村的商业大会,但是这次商业大会遇到了一个难题: 喵哈哈村以及周围的村庄可以看做是一共由n个片区,m条公路组成的地区. 由于生 ...

  10. Windows下安装Redis并注册为服务

    1.安装 下载地址:https://github.com/MSOpenTech/redis/releases. Redis 支持 32 位和 64 位.这个需要根据你系统平台的实际情况选择,这里我们下 ...