`
jimmygan
  • 浏览: 82236 次
  • 性别: Icon_minigender_1
  • 来自: 成都
文章分类
社区版块
存档分类
最新评论

Centos 7 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
分享到:
评论

相关推荐

    CentOS7 service network start命令启动时报错解决方法

    CentOS7 service network start命令启动时报错解决方法

    centos7–DNS正(反)向解析

    [root@ c7-41 ~] systemctl stop firewalld [root@ c7-41 ~] setenforce 0 1,在主机A 服务端上安装DNS服务 [root@ c7-41 ~] yum -y install bind bind-utils bind-libs bind-chroot 2,修改配置 [root@ c7-41 ~] ...

    CentOS7_nvidia-docker2安装.rar

    centos7 nvidia-docker2离线安装包,使用命令rpm -ivh --force *.rpm sudo systemctl restart docker sudo systemctl daemon-reload 依次执行此命令,如果 事先安装了containerd.io 则需要先进行 rpm -qa | grep ...

    systemctl命令 管理系统服务

    Centos7之后从init完全换成了systemd的启动方式,systemd 启动服务的机制主要是通过 systemctl 的这个系统服务管理指令来处理。systemctl在用法上也囊括 service / chkconfig / setup / init 的大部分功能。 语法...

    CentOS7与CentOS6的区别总结

    运行级别对应表、防火墙、开放和关闭端口、查看端口状态、查看系统上所有的服务、原来的 service 命令与 systemctl 命令对比、设置开机启动/不启动服务等等。

    win10+centos7+centos7桌面双系统安装.docx

    1. 先安装win10,并给centos 7分出空间。 2. 安装centos 7系统分使用刚预留的分区。 3. 装完centos7,进入系统修改vim /boot/grub2/grub.cfg 最后面插入以下内容: menuentry 'Windows 10' { #显示菜单的名字 ...

    centos7 mysql8 (8.0.27) rpm静态安装包

    centos7 mysql8 (8.0.27) rpm静态安装包, tar -zxvf mysql8.tar.gz解压后,文件夹里包含mysql8安装的依赖文件,perl rpm文件和mysql rpm文件,直接执行脚本mysql8.sh install安装或者mysql8.sh uninstall卸载,基本...

    systemctl 管理tomcat.txt

    CentOS7 增加tomcat 启动,停止,使用systemctl进行配置详解!centos7 使用 systemctl 替换了 service命令

    centos7安装及Linux操作.docx

    centos7的虚拟机安装,在实际使用过程中记录的一些常用centos7命令。

    centos7更新openssh7.9

    centos7最新的openssh的安装 执行命令 yum -y --disablerepo=\* localinstall *.rpm /bin/cp -f /etc/ssh/sshd_config.rpmnew /etc/ssh/sshd_config sed -i "s/.*PermitRootLogin.*/PermitRootLogin yes/" /etc/...

    Centos7服务器下启动jar包项目的最佳方法

    细心的朋友可能已经在标题中发现关键词Centos7和最佳方式。 这就说明我不是随便写点东西水一篇博客的ヾ(◍°∇°◍)ノ゙ 首先Centos7 推荐我们这么运行项目 首先执行命令: cd /ets/systemd/system 到这个目录下,...

    centos7安装mysql

    在CentOS 7上安装MySQL可以按照以下步骤进行: 打开终端并以root用户身份登录服务器。 使用以下命令更新系统软件包: yum update 安装MySQL的软件存储库。执行以下命令导入MySQL存储库的RPM包: rpm -Uvh ...

    CentOS7防火墙和端口相关命令介绍.docx

    以下情况对应的linux系统版本为CentOS7,若使用的环境为CentOS6请使用service iptables state/start/stop/restart替换对应的systemctl status /start/stop/restart firewalld.service命令;

    Centos7离线安装Cockpit 依赖包(navigator文件管理器)

    Centos7离线安装Cockpit 依赖包(navigator文件管理器) Cockpit(驾驶舱)是一个用于管理和监控 Linux 服务器的 Web 控制台。支持终端操作,以及在线文件管理。 使用教程 ...使用方法: 1.Cockpit离线安装依赖项 ...

    linux之centos7防火墙基本使用详解

    2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。 启动防火墙: systemctl start firewalld.service 关闭防火墙: systemctl stop firewalld.service 重启防火墙: ...

    VMware 10 中为CentOS 7添加多网卡并重命名

    VMware 10 中为CentOS 7添加多网卡并重命名为ethx(eth0,eth1失败)(还想再添加网卡eth1???),因为工作需要切换到CentOS 7系统,网络配置,比较麻烦: 最小化安装的CentOS 7里面甚至连ifconfig、route -ne都没有,...

    ASP.NET Core应用程序部署至生产环境中(CentOS7)

    Centos7发布说明 环境说明: 服务器系统:CentOS 7.2.1511 相关工具:Xshel、Xftp 服务器软件软件:.netcore、nginx、supervisor 准备好发布的程序 安装.NET Core SDK for CentOS7 打开网址:...

    vm虚拟机centos7桥接模式连接外网.docx

    使用的是Centos7.4版本,记录了我的相关操作,第一步:关闭主机防火墙和虚拟机防火墙 相关命令: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 第...

    Centos 7系统虚拟机桥接模式详解

    本文主要给大家介绍了关于Centos 7系统虚拟机桥接模式的相关内容,分享出来供大家参考学习,下面话不多说了,来一起看看详细的介绍吧。 主机ping不通虚拟机centos7系统的ip大多有以下原因: 1、主机与centos7ip段...

    centos 7中firewall防火墙的常用命令总结

    关于CentOS7下Firewall防火墙配置用法可以通过这篇文章进行查看,下面来看看本文的主要内容关于centos 7中firewall防火墙的常用命令,需要的朋友们可以参考学习。 一、开启、关闭firewall 启动: systemctl start ...

Global site tag (gtag.js) - Google Analytics