CentOS 6与CentOS 7的区别收集
说明:
1、CentOS与Ubuntu没有什么可比性,底层都是Linux,并且Ubuntu在YY广泛的使用,这些并不能说明那个强大哪个不行,只要能解决问题的都是好家伙。
2、市面上教程基本都是基于6,而7的比较少,如果想要练手可以直接上6,大把解决方案;但建议用最新的7,性能和兼容性都得到很好的解决;这一点和用JDK 7和JDK 8有点相像,在Java来说,JDK永远兼容低版本,并且越高的版本修复的BUG和性能上都有明显的改善,所以,有最新的版本就用最新的版本。
命令区别:
()桌面系统
[CentOS6] GNOME .x
[CentOS7] GNOME .x(GNOME Shell) ()文件系统
[CentOS6] ext4
[CentOS7] xfs ()内核版本
[CentOS6] 2.6.x-x
[CentOS7] 3.10.x-x ()启动加载器
[CentOS6] GRUB Legacy (+efibootmgr)
[CentOS7] GRUB2 ()防火墙
[CentOS6] iptables
[CentOS7] firewalld ()默认数据库
[CentOS6] MySQL
[CentOS7] MariaDB ()文件结构
[CentOS6] /bin, /sbin, /lib, and /lib64在/下
[CentOS7] /bin, /sbin, /lib, and /lib64移到/usr下 ()主机名
[CentOS6] /etc/sysconfig/network
[CentOS7] /etc/hostname ()时间同步
[CentOS6]
ntp
ntpq -p [CentOS7]
chrony
chronyc sources ()修改时间
[CentOS6]
vim /etc/sysconfig/clock
ZONE="Asia/Tokyo"
UTC=fales
sudo ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime [CentOS7]
timedatectl set-timezone Asia/Tokyo
timedatectl status ()修改地区
[CentOS6]
vim /etc/sysconfig/i18n
LANG="ja_JP.utf8"/etc/sysconfig/i18n
locale
[CentOS7]
localectl set-locale LANG=ja_JP.utf8
localectl status ()服务相关 启动停止
[CentOS6]
service service_name start
service service_name stop
service sshd restart/status/reload [CentOS7]
systemctl start service_name
systemctl stop service_name
systemctl restart/status/reload sshd 自启动
[CentOS6]
chkconfig service_name on/off [CentOS7]
systemctl enable service_name
systemctl disable service_name
服务一览
[CentOS6]
chkconfig --list [CentOS7]
systemctl list-unit-files
systemctl --type service 强制停止
[CentOS6]
kill - <PID> [CentOS7]
systemctl kill --signal= sshd ()网络 网络信息
[CentOS6]
netstat
netstat -I
netstat -n [CentOS7]
ip n
ip -s l
ss IP地址MAC地址
[CentOS6]
ifconfig -a [CentOS7]
ip address show 路由
[CentOS6]
route -n
route -A inet6 -n [CentOS7]
ip route show
ip - route show ()重启关闭 关闭
[CentOS6]
shutdown -h now [CentOS7]
poweroff
systemctl poweroff 重启
[CentOS6]
reboot
shutdown -r now [CentOS7]
reboot
systemctl reboot 单用户模式
[CentOS6]
init S [CentOS7]
systemctl rescue 启动模式
[CentOS6]
[GUICUI]
vim /etc/inittab
id::initdefault:
[CUIGUI]
startx [CentOS7]
[GUICUI]
systemctl isolate multi-user.target
[CUIGUI]
systemctl isolate graphical.target
默认
systemctl set-default graphical.target
systemctl set-default multi-user.target
当前
systemctl get-default
底层区别:
0.前言
CentOS7与6之间最大的差别就是初始化技术的不同,7采用的初始化技术是Systemd,并行的运行方式,除了这一点之外,服务启动、开机启动文件、网络命令方面等等
1.系统初始化技术
- Sysvinit技术
- Upstart技术
- Systemd技术
Sysvinit技术
特点:
- 1.系统第1个进程为init;
- 2.init进程是所有进程的父进程,不可kill;
- 3.大多数Linux发行版的init系统是和SystemV相兼容的,被称为sysvinti
- 4.代表系统:CentOS5 CentOS6
优点:
- sysvinit运行非常良好,概念简单清晰。它主要依赖于shell脚本。
缺点:
- 1.按照一定顺序执行——>启动太慢。
- 2.很容易hang住,fstab与nfs挂载问题
Upstart技术
CentOS6采用了upstart技术代替sysVinit进行引导,Upstart对rc.sysinit脚本做了大量的优化,缩短了系统初始化的启动时间。但是CentOS6为了简便管理员的操作,upstart的很多特性并没有凸显或直接不支持。
代表系统:CentOS6, Ubuntu14, 从CentOS7, Ubuntu15开始使用systemd
Systemd技术
新系统都会采用的技术(RedHat7,CentOS7,Ubuntu15等);
设计目标是克服sysvinit固有的缺点,提高系统的启动速度;
和Sysvinit兼容,降低迁移成本;
最主要优点:并行启动
Pid为1的进程
2.在yum源上的优化
在CentOS的时候,默认是从官方源下载rpm包的,由于是国外的yum源很慢不能用,CentOS7在这里做了优化,当我们使用yum安装软件的时候,默认不会再从官方下载,而是自动寻找离自己地理位置最近的yum源开始下载。
3.命令
如果在安装系统的时候选择minimal,会比之前6的时候以更小的包来安装,比如:vim、ifconfig、route、setup、netstat等等很多命令都没有了。在安装系统后可加入以下软件包:
yum install lrzsz tree net-tools nmap vim bash-completion lsof dos2unix nc telnet ntp wget rng-tools psmisc screen -y
4.字符集修改
/etc/locale.conf #字符集配置文件
localectl set-locale LANG=zh_CN.UTF- # 命令行一步到位
[root@CentOS7 ~]# localectl set-locale LANG=zh_CN.UTF-
[root@CentOS7 ~]# localectl status
System Locale: LANG=zh_CN.UTF-
VC Keymap: us
X11 Layout: us
5.开机启动管理
/etc/rc.local # 这个文件还是存在,不过如果我们还想继续使用这种方式需要给它加执行权限chmod +x /etc/rc.d/rc.local
# system一统天下 snapshot(支持快照)
systemctl status cron.service #查看定时任务状态
systemctl stop cron.service #关闭定时任务
systemctl status cron.service #查看操作情况
systemctl list-unit-files|grep enable #查看当前正在运行的服务
systemctl disable postfix.service #关闭邮件服务
systemctl list-unit-files|grep postfix #查看邮件服务是否开启
systemctl stop firewalld.service #关闭防火墙
systemctl is-enable #开启的服务
systemctl disable #关闭的服务
#通过/etc/rc.d/rc.local/开机自启动
#CentOS7中/etc/rc.d/rc.local需要执行如下命令赋予可执行权限
chmod +x /etc/rc.d/rc.local
6.运行级别runlevel
/etc/inittab 是无效的 system target 替代
##永久生效下次登录生效
systemctl get-default graphical.target 切换到5
systemctl get-default multi-user.target 切换到3
##临时生效的话
init3
##只有五种运行级别
[root@centos7 ~]# ls -lh /usr/lib/systemd/system/runlevel*.target
lrwxrwxrwx. root root Apr : /usr/lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. root root Apr : /usr/lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. root root Apr : /usr/lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. root root Apr : /usr/lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. root root Apr : /usr/lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. root root Apr : /usr/lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. root root Apr : /usr/lib/systemd/system/runlevel6.target -> reboot.target
7.配置yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
#官方epel源
wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh epel-release-latest-.noarch.rpm
8.网卡名称
没有eth0,采用很长的名称。不过可以修改回来。
9.man
CentOS6
[root@Centos6 ~]# whatis man
man: nothing appropriate
[root@Centos6 ~]# makewhatis
[root@Centos6 ~]# man -f man
man () - format and display the on-line manual pages
man.config [man] () - configuration data for man
man [manpath] () - format and display the on-line manual pages
CentOS7
[root@Centos7 ~]# man -f man
man: nothing appropriate.
[root@Centos7 ~]# makewhatis
-bash: makewhatis: command not found
[root@Centos7 ~]# mandb
[root@Centos7 ~]# man -f man
man () - an interface to the on-line reference manuals
10.服务启动
CentOS6
[root@Centos6 ~]# /etc/init.d/sshd status #查询sshd服务状态
openssh-daemon (pid ) is running...
[root@Centos6 ~]# /etc/init.d/sshd restart #重新启动sshd服务
Stopping sshd: [ OK ]
Starting sshd: [ OK ]
[root@Centos6 ~]# service sshd restart #重新启动sshd服务
[root@Centos6 ~]# chkconfig --list|grep :on #启动服务
[root@Centos7 ~]# systemctl status sshd.service #查询sshd服务状态
sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
Active: active (running) since Tue -- :: CST; 5min ago
Process: ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=/SUCCESS)
Main PID: (sshd)
CGroup: /system.slice/sshd.service
└─ /usr/sbin/sshd -D
[root@Centos7 ~]# systemctl restart sshd.service #重新启动sshd服务
[root@Centos7 ~]# systemctl list-unit-files|grep enabled #查询所有启动服务
11.防火墙
CentOS6(默认是iptables):
[root@Centos6 ~]# iptables -t filter -A INPUT -p tcp --dport -j ACCEPT #允许22端口,默认sshd服务
CentOS7(默认是firewalld):
[root@Centos7 ~]# firewall-cmd --permanent --zone=public --add-port=/tcp #允许22端口,默认sshd服务
12.语言
CentOS6
[root@centos6 /]# cat /etc/sysconfig/i18n
LANG=en_US.UTF-
SYSFONT=latarcyrheb-sun16
CentOS7
[root@centos7 ~]$ cat /etc/locale.conf
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
13.man page转换纯文本
CentOS6
[root@centos6 /]# man test | col -b > .txt #内容中有反斜杠,保留后面的内容
CentOS7
[root@centos6 /]# man test >.txt #7貌似过滤了
参考:
https://www.t4x.org/basic/centos6x-diff-centos7x/
http://blog.51cto.com/cuidehua/1858374
https://www.cnblogs.com/can-H/p/6749127.html
http://blog.51cto.com/pengjiezhang/1868140
http://www.hostloc.com/thread-299433-1-1.html
https://www.cnblogs.com/can-H/p/6749127.html
https://www.t4x.org/basic/centos6x-diff-centos7x/
http://www.cnblogs.com/bethal/p/5945026.html(以上内容部分转自此篇文章)
http://blog.csdn.net/qq_21439971/article/details/54585639
https://www.cnblogs.com/Csir/p/6746667.html(以上内容部分转自此篇文章)
https://www.t4x.org/basic/centos6x-diff-centos7x/(以上内容部分转自此篇文章)
CentOS 6与CentOS 7的区别收集的更多相关文章
- CentOS下载及版本选择-CentOS LiveCD、LiveDVD和BinDVD区别
1.CentOS系统镜像有两个,安装系统只用到第一个镜像即CentOS-6.x-i386-bin-DVD1.iso(32位)或者CentOS-6.x-x86_64-bin-DVD1.iso(64位), ...
- CentOS 7 镜像文件各个版本区别
CentOS ISO 镜像文件的功能 引导安装 CentOS ISO 镜像文件包含有安装程序,官方称其为 Anaconda,用来引导安装 CentOS 提供 CentOS 的安装文件 镜像文件不一定包 ...
- (转)CentOS之7与6的区别
CentOS之7与6的区别 原文:http://www.cnblogs.com/Csir/p/6746667.html http://blog.csdn.net/u012562943/article/ ...
- CentOS 6和 CentOS 7的区别【转】
虽然,redhat 8在今年已经推出了,但是centos 8还没有推出.而且公司好多都在用centos 6和7 来了解一下6和7的区别吧 整体说明 1.系统 项目CentOS 6CentOS7 . 安 ...
- centos系统与ubuntu系统的区别
centos和ubuntu简述 CentOS(Community ENTerprise Operating System)是Linux发行版之一,它是来自于Red Hat Enterprise Lin ...
- CentOS / Redhat : Configure CentOS as a Software Router with two interfaces
CentOS / Redhat : Configure CentOS as a Software Router with two interfaces Linux can be easily co ...
- CentOS查看系统信息-CentOS查看命令
一:查看cpu more /proc/cpuinfo | grep "model name" grep "model name" /proc/cpuinfo 如 ...
- In Place Upgrade of CentOS 6 to CentOS 7
Note: This is not the most highly recommended method to move from CentOS 6 to CentOS 7 ... but it ca ...
- CentOS 七 vs CentOS 6的不同
CentOS 七 vs CentOS 6的不同 CentOS 7 vs CentOS 6的不同(1)桌面系统[CentOS6] GNOME 2.x[CentOS7] GNOME 3.x(GNOME ...
- centos 6 与 centos 7 服务开机启动、关闭设置的方法
简单说明下 centos 6 与 centos 7 服务开机启动.关闭设置的方法: centos 6 :使用chkconfig命令即可. 我们以apache服务为例: #chkconfig --add ...
随机推荐
- [OpeCV] highgui头文件
通过HighGUI(high-level graphical user interface)可以实现打开窗口.显示图像.读出和写入图像文件,处理鼠标.光标.键盘事件. 而HighGUI主要分成“视频输 ...
- windows下vim高亮systemverilog
主要解决window环境下,vim高亮systemverilog的方法. 第一步:准备材料下载地址:https://files.cnblogs.com/files/aslmer/verilog_sys ...
- Linux查看端口被占用情形
查看某端口的占用情况: lsof -i:<端口号> 例如:lsof -i:8080 netstat -apn|grep <端口号> 例如: netstat -apn | gre ...
- HDU 4750 Count The Pairs (离线并查集)
按边从小到大排序. 对于每条边(from, to, dist),如果from和to在同一个集合中,那么这条边无意义,因为之前肯定有比它更小的边连接了from和to. 如果from和to不属于同一个集合 ...
- MyBatis 基本演示
主配置文件 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration P ...
- 利用MapReduce计算平均数
利用mapreduce求出股票价格的开盘和收盘平均数 下图为采集到的股票信息,共计1416支股票的信息 因为在linux系统下默认采用utf-8的编码格式,而在win下txt默认采用ANSI编码格式. ...
- select下拉框右对齐,去掉箭头,替换箭头
右对齐 select{ width:auto; direction: rtl; } select option { direction: ltr; } 去掉箭头(不设置背景色会有灰色背景) selec ...
- 在GitHub多个帐号上添加SSH公钥
GitHub后台可以添加多个SSH Keys,但是同一个SSH Keys只能在添加在一个帐号上(添加时提示“Key is already in use”).理由很容易想到,SSH公钥使用时相当于用户名 ...
- 前端模块加载规范AMD与CMD小记
AMD代表:requirejs: CMD代表:seajs: AMD CMD 代表 requirejs seajs 执行 提前加载,不管是否调用模块,先解析所以模块 提前加载,在真正需要使 ...
- 最全面的Android Webview详解
转自:最全面的Android Webview详解 前言 现在很多App里都内置了Web网页(Hyprid App),比如说很多电商平台,淘宝.京东.聚划算等等,如下图 那么这种该如何实现呢?其实这是 ...