linux上systemctl使用

摘要:
摘要:systemctl是一个系统服务管理器命令,它实际上结合了service和chkconfig两个命令。

转载:https://www.cnblogs.com/zdz8207/p/linux-systemctl.html

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

syetemclt就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了。
摘要: systemctl 是系统服务管理器命令,它实际上将 service 和 chkconfig 这两个命令组合到一起。
 
任务旧指令新指令
使某服务自动启动chkconfig --level 3 httpd onsystemctl enable httpd.service
使某服务不自动启动chkconfig --level 3 httpd offsystemctl disable httpd.service
检查服务状态service httpd statussystemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅显示是否 Active)
显示所有已启动的服务chkconfig --listsystemctl list-units --type=service
启动某服务service httpd startsystemctl start httpd.service
停止某服务service httpd stopsystemctl stop httpd.service
重启某服务service httpd restartsystemctl 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

免责声明:文章转载自《linux上systemctl使用》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇delphi CopyMemory、FillMemory、MoveMemory、ZeroMemorySqlite-Sqlite3中的数据类型下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Linux操作系统的安装以及基本的操作命令详解

背景:使用的虚拟机安装Linux  虚拟机使用的是VMware  Linux版本:CentOS-6.7-X86    自行下载:CentOS-6.7-x86_64-bin-DVD1.iso 打开VMware -> 文件 - 》新建虚拟机  -》选择典型 - 下一步 -》选择第三个稍后安装 -下一步 -》选择Linux -下一步 -》虚拟机名称,位置,自...

ubuntu一些基本软件安装方法

ubuntu一些基本软件安装方法 首先说明一下 ubuntu 的软件安装大概有几种方式:1。 deb 包的安装方式deb 是 debian 系 Linux 的包管理方式, ubuntu 是属于 debian 系的 Linux 发行版,所以默认支持这种软件安装方式,当下载到一个 deb 格式的软件后,在终端输入这个命令就能安装:sudo dpkg -i *....

linux桌面的安装

在CentOS 7中提供了两种桌面"GNOME DESKTOP" 和 "KDE Plasa Workspaces",我们以安装"GNOME DESKTOP"为例 1.挂载光盘(搭建本地yum源,也可以使用网络yum源) [root@localhost /]# mount /dev/cdrom /media/cdrom/mount: /dev/sr0 写保护...

Linux(Ubuntu)设置环境变量(转载)

http://blog.csdn.net/wumingxing0228/article/details/6050175 环境变量是和Shell紧密相关的,用户登录系统后就启动了一个Shell。对于Linux来说一般是bash,但也可以重新设定或切换到其它的 Shell。对于UNIX,可能是CShelll。环境变量是通过Shell命令来设置的,设置好的环境变...

linux下find查找命令用法

转自http://www.jb51.net/os/RedHat/1307.html Linux下find命令在目录结构中搜索文件,并执行指定的操作。Linux下find命令提供了相当多的查找条件,功能很强大。由于find具有强大的功能,所以它的选项也很多,其中大部分选项都值得我们花时间来了解一下。即使系统中含有网络文件系统( NFS),find命令在该文件...

linux随笔:安装软连接时:ln: failed to create symbolic link ‘/usr/bin/python3/python3’: File exists

在云服务上面安装python: 1.安装软连接时报:ln: failed to create symbolic link ‘/usr/bin/python3/python3’: File exists 2.解决方法:删除软连接 rm /usr/bin/python3 重新安装软连接:ln -s /root/python36/bin/python3 /usr...