systemctl

centos7 Systemd 指令详解

你离开我真会死。 提交于 2020-01-06 16:06:43
历史上, Linux 的启动 一直采用 init 进程。 下面的命令用来启动服务。 $ sudo /etc/init.d/apache2 start # 或者 $ service apache2 start 这种方法有两个缺点。 一是启动时间长。 init 进程是串行启动,只有前一个进程启动完,才会启动下一个进程。 二是启动脚本复杂。 init 进程只是执行启动脚本,不管其他事情。脚本需要自己处理各种情况,这往往使得脚本变得很长。 二、Systemd 概述 Systemd 就是为了解决这些问题而诞生的。它的设计目标是,为系统的启动和管理提供一套完整的解决方案。 根据 Linux 惯例,字母 d 是守护进程(daemon)的缩写。 Systemd 这个名字的含义,就是它要守护整个系统。 使用了 Systemd,就不需要再用 init 了。Systemd 取代了 initd ,成为系统的第一个进程(PID 等于 1),其他进程都是它的子进程。 $ systemctl --version 上面的命令查看 Systemd 的版本。 Systemd 的优点是功能强大,使用方便,缺点是体系庞大,非常复杂。事实上,现在还有很多人反对使用 Systemd,理由就是它过于复杂,与操作系统的其他部分强耦合,违反"keep simple, keep stupid"的 Unix 哲学 。 (上图为

Centos7 入门几个操作

时光毁灭记忆、已成空白 提交于 2020-01-05 20:04:02
http://www.wallcopper.com/linux/1650.html 创建文件软连接 ln -s 源路径 目标路径 查看软连接 ls -il 服务操作: systemctl start foo.service systemctl stop foo.service systemctl restart foo.service systemctl status foo.service 在开机时启用一个服务: systemctl enable foo.service 在开机时禁用一个服务: systemctl disable foo.service 列出服务的开机状态: systemctl list-unit-files 列出当前系统服务的状态 : systemctl list-units 查看指定服务的状态 : systemctl status foo iptables实例: cat > /etc/sysconfig/iptables < ! *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo

[转帖]学习一下centos7 新地方

假装没事ソ 提交于 2020-01-05 20:03:49
总结的挺好 copy一下 慢慢学习: http://blog.itpub.net/312079/viewspace-2214440/ Centos7 单用户模式 centos7里不再有0-6启动级别,而是4个target graphical.target 多人模式,支持图形和命令行两种登录,对应之前的3,5级别 multi-user.target 多人模式,只支持命令行登录,对应之前的3级别 rescue.target 单人模式,对应之前的1级别 emergency.target 单人模式,不过系统进入后根目录是只读的 centos7采用的是grub2,和之前的方式有所不同 在对应的内核条目上,按下"e",会进入edit模式,搜寻ro那一行,以linux16开头的,按“end”键到最后,输入rd.break,再按ctrl+x进入 进去后重新挂载 /sysroot/,增加写权限 mount -o remount,rw /sysroot/ 切换到原始系统下 chroot /sysroot/ passwd 修改密码输入新密码 touch /.autorelabel //这句是为了selinux生效 退出单用户的方法是 先ctrl+d 退出,然后reboot 1.3 centos7救援模式 设置光驱启动 选择Troubleshooting 选择Rescure a centos system

Linux 中使用 firewalld

牧云@^-^@ 提交于 2020-01-05 20:03:41
firewalld 是一种动态防火墙管理解决方案。Centos 7 默认使用 firewalld。firewalld 是对 iptables 的一个封装,可以让你更容易地管理 iptables 规则。它并不是 iptables 的替代品,虽然 iptables 命令仍可用于 firewalld,但建议 firewalld 时仅使用 firewalld 命令。 与 iptables 相比,我觉得 firewalld 更好用 用一个例子说明下。比如要开放 8080 端口。 firewalld firewalld-cmd --zone=public --add-port=5000/tcp --permanent firewalld-cmd --reload iptables iptables -I INPUT -p tcp --dport 8080 -j ACCEPT service iptables save systemctl iptables restart 相比之下 firewalld 更容易看懂,且步骤更少,又不用重启服务。 另外 firewalld 还有分区的概念容易整理一系列的端口。Centos 7 默认防火墙使用 Firewalld 还觉得挺好的。 安装 firewalld Centos 7 会默认安装 firewalld,若卸载了要重新安装 yum -y install

centos7 开启端口防火墙配置(如开启3306或者80端口)

允我心安 提交于 2020-01-04 03:23:31
转载自https://blog.csdn.net/codepen/article/details/52738906 https://www.cnblogs.com/hantianwei/p/5736278.html centos7 开启端口防火墙配置(如开启3306或者80端口) centos7 默认是FirewallD 提供支持网络/防火墙区域(zone)定义网络链接以及接口安全等级的动态防火墙管理工具,利用 以前开启centos7 的防火墙时,网上好多教程都是先关闭firewall,然后安装iptables-services ,真不改这么做,因为iptables-services 是centos6的防火墙,而7默认为firewall了,直接配置firewall就可以了 FirewallD开启80端口操作如下: 开启80端口 firewall-cmd –zone=public –add-port=80/tcp –permanent 出现success表明添加成功 命令含义: –zone #作用域 –add-port=80/tcp #添加端口,格式为:端口/通讯协议 –permanent #永久生效,没有此参数重启后失效 重启防火墙 systemctl restart firewalld.service 1、运行、停止、禁用firewalld 启动:# systemctl

centos7 firewalld 开放端口

三世轮回 提交于 2020-01-04 03:18:41
开通80端口 firewall-cmd --zone=public --add-port=80/tcp --permanent --zone #作用域 --add-port=80/tcp #添加端口,格式为:端口/通讯协议 --permanent #永久生效,没有此参数重启后失败 重启防火墙 systemctl restart firewalld.service 启动:# systemctl start firewalld 查看状态:# systemctl status firewalld 或者 firewall-cmd --state 停止:# systemctl disable firewalld 禁用:# systemctl stop firewalld 配置firewalld 查看版本:$ firewall-cmd --version 查看帮助:$ firewall-cmd --help 查看设置: 显示状态:$ firewall-cmd --state 查看区域信息: $ firewall-cmd --get-active-zones 查看指定接口所属区域:$ firewall-cmd --get-zone-of-interface=eth0 拒绝所有包:# firewall-cmd --panic-on 取消拒绝状态:# firewall-cmd --panic-off

Linux7关闭防火墙

。_饼干妹妹 提交于 2020-01-04 02:56:22
RedHat Enterprise Linux 7关闭防火墙方法 在之前的版本中关闭防火墙等服务的命令是 service iptables stop /etc/init.d/iptables stop 在RHEL7中,其实没有这个服务 [root@rhel7 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.0 (Maipo) [root@rhel7 ~]# service iptables stop Redirecting to /bin/systemctl stop iptables.service [root@rhel7 ~]# /etc/init.d/iptables stop -bash: /etc/init.d/iptables: No such file or directory 原来在RHEL7开始,使用systemctl工具来管理服务程序,包括了service和chkconfig [root@rhel7 ~]# systemctl list-unit-files|grep enabled cups.path enabled abrt-ccpp.service enabled abrt-oops.service enabled abrt-vmcore.service

firewalld - 打开关闭防火墙与端口

▼魔方 西西 提交于 2020-01-04 02:44:07
1、firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 : systemctl enable firewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。 启动一个服务:systemctl start firewalld.service 关闭一个服务:systemctl stop firewalld.service 重启一个服务:systemctl restart firewalld.service 显示一个服务的状态:systemctl status firewalld.service 在开机时启用一个服务:systemctl enable firewalld.service 在开机时禁用一个服务:systemctl disable firewalld.service 查看服务是否开机启动:systemctl is-enabled firewalld.service 查看已启动的服务列表:systemctl list-unit-files|grep

centos7操作防火墙

我只是一个虾纸丫 提交于 2020-01-04 02:39:58
1、firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 : systemctl enable firewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。 启动一个服务:systemctl start firewalld.service 关闭一个服务:systemctl stop firewalld.service 重启一个服务:systemctl restart firewalld.service 显示一个服务的状态:systemctl status firewalld.service 在开机时启用一个服务:systemctl enable firewalld.service 在开机时禁用一个服务:systemctl disable firewalld.service 查看服务是否开机启动:systemctl is-enabled firewalld.service 查看已启动的服务列表:systemctl list-unit-files|grep

Centos7 firewalld 基本使用

巧了我就是萌 提交于 2020-01-04 02:01:34
Centos7 的防火墙 firewalld比较常见   简单介绍使用   详细介绍链接推荐: https://blog.csdn.net/buster_zr/article/details/80604933              http://blog.51cto.com/13503302/2095633              https://www.jianshu.com/p/c06890b7739e firewalld 使用:   iptables firewalld 都是防火墙程序,并且firewalld内部也是通过iptables实现防火墙配置,但是两个程序不能同时运行    安装   如果iptables在运行,先关闭   systemctl stop iptables    #关闭iptables   systemctl disable iptables  #禁止iptables 开机启动   systemctl status firewalld  #查看防火墙firewalld状态   如果运行,会显示Active: active (running)     firewall-cmd --state      #查看防火墙firewalld状态的另一种方式   no runing 表示没有运行   yum -y install firewalld