前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >CentOS 6 和 CentOS 7 差异

CentOS 6 和 CentOS 7 差异

原创
作者头像
星哥玩云
发布于 2022-05-28 05:50:15
发布于 2022-05-28 05:50:15
8150
举报
文章被收录于专栏:开源部署开源部署

CentOS 6 和 CentOS 7 介绍

总体差异

想装回过去的一些工具

  • 安装:yum install -y tree net-tools bind-utils tree sysstat vim-en* lrzsz NetworkManager-tui ntp ntpdate iftop tcpdump telnet traceroute

查看版本号/主机名

  • cat /etc/redhat-release
  • cat /etc/hostname

常用配置差异

systemctl 的用法

  • 相当于 CentOS 6 的:service nginx stop
  • systemctl is-enabled iptables.service #查询服务是否开机启动
  • systemctl enable iptables.service #开机运行服务
  • systemctl disable iptables.service #取消开机运行
  • systemctl start iptables.service #启动服务
  • systemctl stop iptables.service #停止服务
  • systemctl restart iptables.service #重启服务
  • systemctl reload iptables.service #重新加载服务配置文件
  • systemctl status iptables.service #查询服务运行状态
  • systemctl --failed #显示启动失败的服务
  • systemctl list-units --type=service #查看所有服务
  • systemctl is-enabled httpd #查看httpd服务是否开机启动
  • 对于启动脚本的存放位置,也不再是 /etc/init.d/(这个目录也是存在的),而是 /usr/lib/systemd/system/

开放端口

  • 一般设置软件端口有一个原则:
    • 0 ~ 1024 系统保留,一般不要用到
    • 1024 ~ 65535(2^16) 可以随意用
  • 添加单个端口:firewall-cmd --zone=public --add-port=8883/tcp --permanent
  • 添加范围端口:firewall-cmd --zone=public --add-port=8883-8885/tcp --permanent
  • 删除端口:firewall-cmd --zone=public --remove-port=8883/tcp --permanent
  • 重启防火墙firewall-cmd --reload
    • 命令解释:
    • --zone #作用域
    • --add-port=80/tcp #添加端口,格式为:端口/通讯协议
    • --permanent #永久生效,没有此参数重启后失效
  • 列出所有端口列表:firewall-cmd --list-all

关闭 firewall 使用 iptables

  • 关闭 firewall
    • systemctl stop firewalld.service #停止firewall
    • systemctl disable firewalld.service #禁止firewall开机启动
  • 安装 iptables
    • yum install -y iptables-services
  • 启动 iptables
    • systemctl restart iptables.service #最后重启防火墙使配置生效
    • systemctl enable iptables.service #设置防火墙开机启动
    • 其他使用照旧

ifconfig 没有了

  • 查看网络配置:ip a
  • 装回 ifconfig:yum install -y net-tools

设置时区

  • timedatectl set-timezone Asia/Shanghai
  • timedatectl status

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
Linux下如何查看CentOS版本
今天iptables居然不能使用了,赶紧查看了一下Linux版本了。居然更新到了CentOS7。 这里分享下查看命令: cat /etc/redhat-release cat /etc/centos-release 或者 rpm -q redhat-release rpm -q centos-release 执行iptables命令,出现”Failed to restart iptables.service: Unit iptables.service failed to load: No suc
小柒2012
2018/04/13
12K0
CentOS 6和CentOS 7防火墙的关闭
CentOS6.5查看防火墙的状态: [linuxidc@localhost ~]$service iptable status   显示结果: [linuxidc@localhost ~]$service iptable status Redirecting to /bin/systemctl status  iptable.service ● iptable.service    Loaded: not-found (Reason: No such file or directory)    Activ
庞小明
2018/07/06
7.5K0
CentOS 7 开放防火墙端口命令
CentOS 7 开放防火墙端口 命令         最近公司新的server要求用CentOS7, 发现以前CentOS 6 系列中的 iptables 相关命令不能用了,查了下,发现Centos 7使用firewalld代替了原来的iptables。 使用方法如下: >>> 关闭防火墙 systemctl stop firewalld.service             #停止firewall systemctl disable firewalld.service        #禁止firewa
庞小明
2018/03/08
3.7K0
CentOS 7.2防火墙
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。 firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
拿我格子衫来
2022/01/24
5180
Centos7:防火墙常用操作
一、防火墙服务 # 开启防火墙服务 systemctl start firewalld.service # 关闭防火墙服务 systemctl stop firewalld.service # 重启防火墙服务 systemctl restart firewalld.service # 防火墙服务状态 systemctl status firewalld.service # 禁止防火墙服务开机启动 systemctl disable firewalld.service 二、防火墙操作 查询有哪些端口是
新码农
2021/01/04
5670
Centos7设置防火墙相关命令
命令含义: --zone #作用域 --add-port=80/tcp #添加端口,格式为:端口/通讯协议 --permanent #永久生效,没有此参数重启后失效
用户7162790
2022/03/23
2.7K0
服务器安全设置Centos7 防火墙firewall与iptables
一.>>>>>>启用centos7 iptables防火墙Centos7 防火墙firewall设置方法
网站安全专家
2019/07/24
3.1K0
服务器安全设置Centos7 防火墙firewall与iptables
浅谈CentOS防火墙命令
1、安装 yum install iptables-services #安装iptables 2、systemctl使用 systemctl unmask firewalld #执行命令,即可实现取消服务的锁定 systemctl mask firewalld # 下次需要锁定该服务时执行 systemctl start firewalld.service #启动防火墙 systemctl stop firewalld.service #停止防火墙 systemctl reloadt firewalld.s
院长技术
2020/09/07
4680
centos7 之 sshd,iptables,firewall,fail2ban 常用操作
# 在原端口 22 下,新增 sshd 端口 20000,并 开启账号密码登录、开启 root 账号登录
卓越笔记
2023/02/17
6520
CentOS7 防火墙设置
CentOS 7中防火墙是一个非常的强大的功能,在CentOS 6.5中对iptables防火墙进行了升级。
码客说
2019/10/21
2.4K0
CentOS 7开放及查看firewall的端口
启动一个服务: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 enabled 查看启动失败的服务列表:systemctl --failed
良月柒
2019/03/19
7.4K0
centos linux命令
如果想要永久关闭防火墙则还需要禁用防火墙服务。 其他常用命令: systemctl disable firewalld.service #永久关闭防火墙则还需要禁用防火墙服务 systemctl stop firewalld.service #停止firewall firewall-cmd --reload #重启防火墙 firewall-cmd --state                          ##查看防火墙状态,是否是running firewall-cmd
凡夫
2022/02/28
8620
Centos7服务器运维服务系统安装过程中遇到的问题总结
由于我们Sinesafe的客户要求网站的服务器要装Centos7版本所以给大家分享下安装的过程与经验,如果需要深入的服务器运维服务也可以找我们。
网站安全专家
2019/07/24
1.1K0
Centos7服务器运维服务系统安装过程中遇到的问题总结
Centos7 配置默认防火墙Firewalld
转自Linux就该这么学 Centos7 更新后,默认防火墙由IPtables变为Firewalld,那么Firewalld配置端口的操作是怎么样的呢?让我们来学习一下吧! 1、基本操作  sys
用户1086810
2018/06/26
2.1K0
linux防火墙查看状态firewall、iptable[通俗易懂]
CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之前的版本Centos 6.x使用iptables不一样
全栈程序员站长
2022/08/03
7K0
linux防火墙查看状态firewall、iptable[通俗易懂]
Linux·CentOS 防火墙
Linux 中有两种防火墙软件,ConterOS7.0 以上使用的是 firewall,ConterOS7.0 以下使用的是 iptables,本文将分别介绍两种防火墙软件的使用。
数媒派
2022/12/01
4.5K0
CentOS 7中firewall防火墙详解和配置以及切换为iptables防火墙
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html#sec-Introduction_to_firewalld1
Java后端技术
2018/08/09
3.7K0
CentOS 7中firewall防火墙详解和配置以及切换为iptables防火墙
linux防火墙相关配置命令及操作(centos和ubuntu)
大家在网上输入【linux 防火墙】等关键字搜索相关文章,有时候会出现命令用不了的情况,不是说他们的命令错误,而是因为操作系统版本的问题。 目前的话,比较常见的 Linux 系统就是 centos 和 ubuntu了吧 废话不多说了,直接开怼
bboy枫亭
2020/09/22
2.2K0
centos 7 安装iptables防火墙 - 乐享诚美
[root@localhost ~]# firewall-cmd --zone=public --add-port=6379/tcp --permanent
司夜
2023/10/18
4560
linux防火墙端口设置_centos怎么关闭防火墙端口
参考链接: Ubuntu开启防火墙端口 centos7 防火墙 开启端口 并测试
全栈程序员站长
2022/11/08
5.2K0
相关推荐
Linux下如何查看CentOS版本
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档