(总结)RHEL/CentOS 7.x的几点新改变
一、CentOS的Services使用了systemd来代替sysvinit管理
1、systemd的服务管理程序:
systemctl是主要的工具,它融合之前service和chkconfig的功能于一体。可以使用它永久性或只在当前会话中启用/禁用服务。 systemctl可以列出正在运行的服务状态,如图:

systemd-cgls以树形列出正在运行的进程,它可以递归显示控制组内容。如图:

2、如何启动/关闭、启用/禁用服务?
启动一个服务:systemctl start postfix.service
关闭一个服务:systemctl stop postfix.service
重启一个服务:systemctl restart postfix.service
显示一个服务的状态:systemctl status postfix.service
在开机时启用一个服务:systemctl enable postfix.service
在开机时禁用一个服务:systemctl disable postfix.service
查看服务是否开机启动:systemctl is-enabled postfix.service;echo $?
查看已启动的服务列表:systemctl list-unit-files|grep enabled
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
说明:启用服务就是在当前“runlevel”的配置文件目录
/etc/systemd/system/multi-user.target.wants/里,建立/usr/lib/systemd/system里面对应服务配置文件的软链接;禁用服务就是删除此软链接。如图:

查看了/usr/lib/systemd/system 里的文件,语法跟旧版/etc/init.d/里的系统服务脚本完全不同了。
二、修改系统运行级别:
1、systemd使用比sysvinit的运行级更为自由的target替代。
第3运行级用multi-user.target替代。
第5运行级用graphical.target替代。runlevel3.target和runlevel5.target分别是指向 multi-user.target和graphical.target的符号链接。 可以使用下面的命令切换到“运行级别3 ”:
systemctl isolate multi-user.target
或
systemctl isolate runlevel3.target
可以使用下面的命令切换到“运行级别5 ”:
systemctl isolate graphical.target
或
systemctl isolate runlevel5.target
2、如何改变默认运行级别?
systemd使用链接来指向默认的运行级别。在创建新的链接前,可以通过下面命令删除存在的链接:
rm /etc/systemd/system/default.target
默认启动运行级别3 :
ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
默认启动运行级别5 :
ln -sf /lib/systemd/system/graphical.target/etc/systemd/system/default.target
systemd不使用/etc/inittab文件。
3、如何查看当前运行级别?
旧的runlevel命令在systemd下仍然可以使用。可以继续使用它,尽管systemd使用 „target‟ 概念(多个的 „target‟ 可以同时激活)替换了之前系统的runlevel。 等价的systemd命令是systemctl list-units –type=target
三、其他配置工具:
1、setup和ntsysv工具还是保留了,但是功能已大大减弱,以前ntsysv工具可以控制所有系统服务的自启动,现在只能控制少部分服务。 2、/etc/resolv.conf这个DNS配置文件没变。
3、/etc/sysconfig/network-scripts/ifcfg-ens192网卡配置文件名字和一些选项有所变化。
4、引导方式改用grub2引导,grub2有如下特点:1、模块化设计;2、支持多体系硬件架构;3、支持国际化多语言;4、独立内存管理;5、支持脚本语言。 附:systemd简介
systemd是Linux下的一种init软件,由Lennart Poettering带头开发,并在LGPL 2.1及其后续版本许可证下开源发布。其开发目标是提供更优秀的框架以表示系统服务间的依赖关系,并依此实现系统初始化时服务的并行启动,同时达到降低Shell的系统开销的效果,最终代替现在常用的System V与BSD风格init程序。 与多数发行版使用的System V风格init相比,systemd采用了以下新技术: 采用Socket激活式与总线激活式服务,以提高相互依赖的各服务的并行运行性能; 用cgroups代替PID来追踪进程,以此即使是两次fork之后生成的守护进程也不会脱离systemd的控制。
从设计构思上说,由于systemd使用了cgroup与fanotify等组件以实现其特性,所以只适用于Linux。


centos7 关闭firewall安装iptables并配置
一、配置防火墙,开启80端口、3306端口
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
1、关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2、安装iptables防火墙
yum install iptables-services #安装
vi /etc/sysconfig/iptables #编辑防火墙配置文件
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended. *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 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq! #保存退出
systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
二、关闭SELINUX
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
#SELINUXTYPE=targeted #注释掉 IT网,http://www.it.net.cn SELINUX=disabled #增加 Linux学习,http:// linux.it.net.cn :wq! #保存退出
setenforce 0 #使配置立即生效
(总结)RHEL/CentOS 7.x的几点新改变的更多相关文章
- (转)RHEL/CentOS 6.x使用EPEL6与remi的yum源安装MySQL 5.5.x
PS:如果既想获得 RHEL 的高质量.高性能.高可靠性,又需要方便易用(关键是免费)的软件包更新功能,那么 Fedora Project 推出的 EPEL(Extra Packages for En ...
- RHEL/CentOS 7最小化安装后需做的30件事情
导读 CentOS是一个工业标准的Linux发行版,是红帽企业版 Linux 的衍生版本.你安装完后马上就可以使用,但是为了更好地使用你的系统,你需要进行一些升级.安装新的软件包.配置特定服务和应用程 ...
- RHEL/CentOS/Fedora各种源(EPEL、Remi、RPMForge、RPMFusion)配置
最新文章:Virson’s Blog CentOS默认自带CentOS-Base.repo源,但官方源中去除了很多有版权争议的软件,而且安装的软件也不是最新的稳定版.Fedora自带的源中也找不到很多 ...
- How to install 64-bit Google Chrome 28+ on 64-bit RHEL/CentOS 6 or 7
How to install 64-bit Google Chrome 28+ on 64-bit RHEL/CentOS 6 or 7 The problem Google developers s ...
- Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x
This howto guide shows you’ll how to enable EPEL repository under RHEL/CentOS 6/5 to install additio ...
- Google Chrome 55 Released – Install on RHEL/CentOS 7/6 and Fedora 25-20
Google Chrome is a freeware web browser developed by Google Inc. Google Chrome team proudly announce ...
- Linux Systemd——在RHEL/CentOS 7中启动/停止/重启服务
RHEL/CentOS 7.0中一个最主要的改变,就是切换到了systemd.它用于替代红帽企业版Linux前任版本中的SysV和Upstart,对系统和服务进行管理.systemd兼容SysV和Li ...
- RHEL/CentOS 6.x 系统服务详解
PS:RHEL/CentOS 6.x的系统服务比5.x系列的要多了很多新面孔,估计很多童鞋不甚理解,网上这方面资料也很少.理解这个对运维人员是必要的,因为开启不必要的服务越 多,系统就相对越不安全.不 ...
- Install TightVNC Server in RHEL/CentOS and Fedora to Access Remote Desktops
Virtual Networking Computing (VNC) is a Kind of remote sharing system that makes it possible to take ...
随机推荐
- kaptcha验证码
@Action("/validimg") public String validimg() throws Exception { genernateCaptchaImage(); ...
- 设计模式之原型模式(php实现)
github地址:https://github.com/ZQCard/design_pattern1.先了解什么是浅拷贝与深拷贝 //深拷贝:赋值时值完全复制,完全的copy,对其中一个作出改变,不会 ...
- tez参数
https://tez.apache.org/releases/0.8.4/tez-api-javadocs/configs/TezConfiguration.html
- 数据库中存在0,1,2.....或者1,null,2 排序时让0或者null在最后的sql语句
select * from yryz_products_t order by isnull(sort),sort; select * from yourtable order by cast ...
- vscode - 选中多行操作
选中Alt+鼠标左键即可,按ESC退出 ,具体演示效果如下
- 内容提供器(ContentProvider)
一.简介内容提供器(Content Provider)主要用于在不同的应用程序之间实现数据共享的功能,它提供了一套完整的机制,允许一个程序访问另一个程序中的数据,同时还能保证被访数据的安全性.目前,使 ...
- Oracle PLSQL通过SMTP发送E-MAIL邮件代码
登录到SMTPserver发送邮件,支持HTML CREATE OR REPLACE PROCEDURE send_mail( p_recipient VARCHAR2, -- 邮件接收 ...
- windows新建或者重命名文件及目录必须手动刷新才干显示出来问题解决方法
首先推断注冊表中HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Update\UpdateMode值是否为0,该值若为1表示手工刷新, 该 ...
- Windows操作系统设置代理
1.打开控制面板 2.点击网络和Internet 3.点击Internet选项 4.点击连接Tab页 5.点击局域网设置 6.选中代理服务器 7.输入代理的地址和端口号
- (通用Mapper、分页,批量插入,一分钟接入)spring mvc+mybatis+maven集成tkmapper+pagehelper
<!-- maven tkmapper引入--> <dependency> <groupId>tk.mybatis</groupId> <arti ...