linux上systemctl使用
转载:https://www.cnblogs.com/zdz8207/p/linux-systemctl.html
Linux服务器,服务管理--systemctl命令详解,设置开机自启动
任务 | 旧指令 | 新指令 |
使某服务自动启动 | 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
linux上systemctl使用的更多相关文章
- 把Asp.Net Core 2.0部署在Linux上,使用Nginx代理服务器,并且用Systemctl命令以服务的方式监听项目
在Linux上部署.net core 2.0程序: 第一步:配置Nginx代理 在/etc/nginx/sites-available/default 中添加 server { listen ; lo ...
- 【无私分享:ASP.NET CORE 项目实战(第十章)】发布项目到 Linux 上运行 Core 项目
目录索引 [无私分享:ASP.NET CORE 项目实战]目录索引 简介 ASP.Net Core 给我们带来的最大的亮点就是跨平台,我在我电脑(win7)上用虚拟机建了个 CentOS7 ,来演示下 ...
- Linux上的SQL Server的起步
我们知道,几个星期前,微软发布了在Linux上直接运行的SQL Server第一个公开CTP版本!因此,对我来说,是时候跨界在Linux上安装我的第一个SQL安装,这样的话,我就可以在Linux上折腾 ...
- 在 Linux 上配置一个 syslog 服务器
syslog服务器可以用作一个网络中的日志监控中心,所有能够通过网络来发送日志的设施(包含了Linux或Windows服务器,路由器,交换机以及其他主机)都可以把日志发送给它. 通过设置一个syslo ...
- Linux 上使用 Gmail SMTP 服务器发送邮件通知
导读 假定你想配置一个 Linux 应用,用于从你的服务器或桌面客户端发送邮件信息.邮件信息可能是邮件简报.状态更新(如 Cachet).监控警报(如 Monit).磁盘时间(如 RAID mdadm ...
- Node.js~在linux上的部署~外网不能访问node.js网站的解决方法
这是上一篇node.js部署到linux上的后续文章,当我们安装完node.js之后,建立了sailsjs的网站,然后在外面电脑上无法访问这个网站,这个问题我们如何去解决? 解决思路: 查看linux ...
- Configure Always On Availability Group for SQL Server on RHEL——Red Hat Enterprise Linux上配置SQL Server Always On Availability Group
下面简单介绍一下如何在Red Hat Enterprise Linux上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的 ...
- linux上安装redis的踩坑过程2
昨天在linux上安装redis后马上发现了其它问题,服务器很卡,cpu使用率上升,top命令查看下,原来有恶意程序在挖矿,此程序入侵了很多redis服务器,马上用kill杀掉它 然后开始一些安全策略 ...
- linux上安装redis的踩坑过程
redis用处很广泛,我不再啰嗦了,我按照网上教程想在linux上安装下,开始了踩坑过程,网上买了一个linux centos7.3,滴滴云的,巨坑无比啊,不建议大家用这家的! redis 为4.0, ...
随机推荐
- POJ 3994:Probability One
Probability One Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1674 Accepted: 1151 D ...
- apt-get install oracle-java8-installer时Err:7 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main amd64 Packages 404 not found
所有其他网址都有效,而不是amd64端点. 然后,当运行apt-get install oracle-java8-installer时,出现以下错误: Package oracle-java8-ins ...
- 如何下载Github的工程到本地,完成修改并提交
2019-02-22 对以下方法做了测试 可以生效 1 在Github上添加密钥 方法是:https://www.cnblogs.com/jason-beijing/p/9110187.html 2 ...
- Eclipse反编译插件jad的安装
Eclipse反编译插件jad的安装 JadClipse是Jad的Eclipse插件,是一款非常实用而且方便的Java反编译插件.时间久了,可能忘记在哪里进行配置了,因此记录下以备后续使用(若需要). ...
- web应用中并发控制的实现,各种锁的集合
参考:http://blog.csdn.net/xiangwanpeng/article/details/55106732 B/S构架的应用越来越普及,但由于它有别于C/S构架的特殊性,并发控制始终没 ...
- java里mongodb复合查询
Query query = new Query();Criteria criteria = Criteria.where("packetTitle").is(redPacketSt ...
- Callable、Future、线程池简单使用
Callable.Future与线程池 在创建新线程的三种方式中,继承Thread和实现Runnable接口两种方式都都没有返回值,因此当我们想要获取子线程计算结果时只能设置共享数据,同时还需要考虑同 ...
- CentOS7使用firewalld的基本命令
转自:https://www.cnblogs.com/moxiaoan/p/5683743.html.Thanks for 莫小安 1.firewalld的基本使用 启动: systemctl ...
- eclipse默认的WebContent目录修改为webRoot
从网上下载了个Java Web项目,导入Eclipse后在Tomcat中发布,发现在Tomcat的Webapps目录下没有JSP页面 到项目中去看才发现有两个目录,一个WebContent,一个Web ...
- HttpClient系列~StringContent与FormUrlEncodedContent
知识点 本文是一个很另类的文章,在项目中用的比较少,但如果项目中真的出现了这种情况,我们也需要知道如何去解决,对于知识点StringContent和FormUrlEncodedContent我们应该了 ...