CentOS 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-unit-files
开启防火墙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 6 与 centos 7开关服务区别#######################################
centos 6 :使用chkconfig命令即可。
我们以apache服务为例:
#chkconfig --add apache 添加nginx服务
#chkconfig apache on 开机自启nginx服务
#chkconfig apache off 关闭开机自启
#chkconfig --list | grep apache 查看
centos 7 :使用systemctl中的enable、disable 即可。
示例:
#systemctl enable apache.service 开机自启apache服务
#systemctl disable apache.service 关闭开机自启
转自------------------------------http://man.linuxde.net/systemctl
CentOS systemctl命令的更多相关文章
- CentOS 7.X 中systemctl命令用法详解
systemctl是RHEL 7 的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体.可以使用它永久性或只在当前会话中启用/禁用服务,下面来看CentOS 7.X 中 ...
- Docker容器Centos不能使用systemctl命令问题
注:本文出自博主 Chloneda:个人博客 | 博客园 | Github | Gitee | 知乎 本文源链接:https://www.cnblogs.com/chloneda/p/bug-dock ...
- Docker的centos镜像内无法使用systemctl命令的解决办法
在Docker官方的centos镜像内无法使用systemctl命令的解决办法, 使用该命令docker报错 Failed to get D-Bus connection: Operation not ...
- (转)systemctl 命令完全指南
场景:在使用chkconfig查看vsftpd是否看机启动时候看不到启动项,用systemctl 才看到自己想要的结果 1 总结 from:https://linux.cn/article-5926- ...
- Linux服务器,服务管理--systemctl命令详解,设置开机自启动
Linux服务器,服务管理--systemctl命令详解,设置开机自启动 syetemclt就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了. 摘要: syst ...
- CentOS Bash 命令补全增强软件包 bash-completion
引言 之前安装的 CentOS 7 是最小化安装,在使用 systemctl 命令进行服务的管理时,经常手动输入相关服务名.如果对一个服务名称不熟悉,这样可以迫使我们记住它,但如果对一个服务名已经很熟 ...
- 【转载】systemctl命令完全指南
Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器. Systemd是一个系统管理守护进程.工具和库的集合,用于取代System V初始进程.Systemd的功能是 ...
- Centos7下的systemctl命令与service和chkconfig
博主使用的操作系统是最新的CentOS 7,所以可能和网上一些老的博文有一定出入,那是因为版本更新的原因. 这里写图片描述1 service service命令用于对系统服务进行管理,比如启动(sta ...
- Docker下构建centos7容器无法使用systemctl命令的解决办法
最近在使用docker 构建centos7 容器时,发现无法使用systemctl 命令.后来万能的百度解决了问题,随记之以备后用. 解决办法: docker run --privileged -it ...
随机推荐
- 作为sort()方法的参数的比较函数(高程三第五章)
<script> var nums = [0,1,5,10,15]; var nums2 = nums; nums.sort(); console.log(nums);//0,1,10,1 ...
- leetcode1010
class Solution: def numPairsDivisibleBy60(self, time: 'List[int]') -> int: sums = 0 s = {} n = le ...
- Swoole 结合TP5搭建文字直播平台
直播模块流程: 主进程服务:主进程同时开启两个服务 http服务,负责向前端传递页面,处理登录等事务 websocket服务,服务处理直播以及聊天室等事务 在项目根目录(框架代码同级目录)建立scri ...
- 网站优化--减少HTTP请求
发送HTTP请求需要经过几个过程 域名解析--TCP连接--发送请求--等待--下载资源--解析时间 这其中需要花费一定时间,因此,尽可能的需要减少网站的HTTP请求,方法有以下几种: 1 . css ...
- js判断对象
一般学java的小伙伴,刚开始写js时如果遇到要判断一个字符串是否不为空,往往会这样写 if(str != undefined && str != null && st ...
- for里的上一个/下一个下标的安全写法
const len:int=10; for(var:int=0;i<len;i++){ var previ:int=(i-1+len)%len; var nexti:int=(i+1)%len; ...
- Linux tcpdump命令使用方法
tcpdump是Linux上常用的抓包命令,用于截取网络分组并输出分组内容,常用于网络问题分析和排查. tcpdump语法 tcpdump [-i 接口] [-nn] [-w 文件名] [-c 次数] ...
- WEB前端问题——img标签的onclick事件无法响应问题【转载】
一个纠结了一下午的问题,img标签里面的onclick事件无法响应.最终找到了错误原因,是因为img标签的id与onclick事件的方法名相同. 于是接着又测试了一下,发现name名和方法名相同也会导 ...
- Python之路 - 网络编程之粘包
Python之路 - 网络编程之粘包 粘包
- 部署Java的运行环境
1.先去官网下载最新的jdk 网址:http://www.oracle.com/technetwork/java/javase/downloads/ 2.用tar zxvf解压相应的文档到相应的路径 ...