|
| 1 | +# CentOS 6 和 CentOS 7 介绍 |
| 2 | + |
| 3 | +## 总体差异 |
| 4 | + |
| 5 | +-  |
| 6 | + |
| 7 | +## 想装回过去的一些工具 |
| 8 | + |
| 9 | +- 安装:`yum install -y tree net-tools bind-utils tree sysstat vim-en* lrzsz NetworkManager-tui ntp ntpdate iftop tcpdump telnet traceroute` |
| 10 | + |
| 11 | +## 查看版本号/主机名 |
| 12 | + |
| 13 | +- `cat /etc/redhat-release` |
| 14 | +- `cat /etc/hostname` |
| 15 | + |
| 16 | +## 常用配置差异 |
| 17 | + |
| 18 | +- [CentOS 网络配置](centos-settings/CentOS-Network-Settings.md) |
| 19 | +- [CentOS 图形界面的关闭与开启](centos-settings/Close-XWindow.md) |
| 20 | + |
| 21 | +## systemctl 的用法 |
| 22 | + |
| 23 | +- 相当于 CentOS 6 的:service nginx stop |
| 24 | +- `systemctl is-enabled iptables.service` #查询服务是否开机启动 |
| 25 | +- `systemctl enable iptables.service` #开机运行服务 |
| 26 | +- `systemctl disable iptables.service` #取消开机运行 |
| 27 | +- `systemctl start iptables.service` #启动服务 |
| 28 | +- `systemctl stop iptables.service` #停止服务 |
| 29 | +- `systemctl restart iptables.service` #重启服务 |
| 30 | +- `systemctl reload iptables.service` #重新加载服务配置文件 |
| 31 | +- `systemctl status iptables.service` #查询服务运行状态 |
| 32 | +- `systemctl --failed` #显示启动失败的服务 |
| 33 | +- `systemctl list-units --type=service` #查看所有服务 |
| 34 | +- `systemctl is-enabled httpd` #查看httpd服务是否开机启动 |
| 35 | +- 对于启动脚本的存放位置,也不再是 `/etc/init.d/`(这个目录也是存在的),而是 `/usr/lib/systemd/system/` |
| 36 | + |
| 37 | +## 关闭 firewall 使用 iptables |
| 38 | + |
| 39 | +- 关闭 firewall |
| 40 | + - `systemctl stop firewalld.service` #停止firewall |
| 41 | + - `systemctl disable firewalld.service` #禁止firewall开机启动 |
| 42 | +- 安装 iptables |
| 43 | + - yum install -y iptables-services |
| 44 | +- 启动 iptables |
| 45 | + - systemctl restart iptables.service #最后重启防火墙使配置生效 |
| 46 | + - systemctl enable iptables.service #设置防火墙开机启动 |
| 47 | + - 其他使用照旧 |
| 48 | + |
| 49 | +## ifconfig 没有了 |
| 50 | + |
| 51 | +- 查看网络配置:`ip a` |
| 52 | +- 装回 ifconfig:`yum insall -y net-tools` |
| 53 | + |
| 54 | +## 设置时区 |
| 55 | + |
| 56 | +- `timedatectl set-timezone Asia/Shanghai` |
| 57 | +- `timedatectl status` |
| 58 | + |
| 59 | + |
| 60 | +## 资料 |
| 61 | + |
| 62 | +- <http://blog.topspeedsnail.com/archives/3017> |
| 63 | +- <http://chenbaocheng.com/2015/07/15/Centos-7-%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AEiptables/> |
| 64 | +- <http://cuidehua.blog.51cto.com/5449828/1858374> |
| 65 | +- <http://putty.biz/760> |
0 commit comments