您的当前位置:首页正文

centos7 的操作变化

来源:个人技术集锦
centos7 的操作变化

查看ip地址:ipaddr

ifconfig命令已经过时了,而且在最小化版本的RHEL 7以及它的克隆版本CentOS 7,Oracle Linux 7和Scientific Linux 7中也找不到该命令。

CentOS 7最小化系统,使用“ipaddr”和“ip link”命令来查找网卡详情。要知道统计数据,可以使用“ip -s link”。

查看服务状态,启动,停止服务:systemctl start/stop/restart/status 服务名.service /sbin/service 服务名 [start/stop/restart/status] 过时了 查找服务当前状态:systemctl list-unit-files | grep 服务名字符串 chkconfig也过时了

不能再用 /etc/init.d/sshd restart 之类的指令启动服务器了 启用sshd服务

systemctl enable sshd.service 【systemctl disable sshd.service 禁用sshd服务】

系统提示如下:

ln -s '/usr/lib/systemd/system/sshd.service'

'/etc/systemd/system/multi-user.target.wants/sshd.service' 其实启用和禁用服务就是在当前“runlevel”的配置文件目录(/etc/systemd/system/multi-user.target.wants/)里,

启用服务就是建立/usr/lib/systemd/system 里面对应服务配置文件的软链接;禁用服务就是删除此软链接。

有兴趣就自己看看 /usr/lib/systemd/system 里的文件,语法跟旧版/etc/init.d/ 里的服务脚本完全不同,也不能再用 /etc/init.d/sshd restart 之类的指令启动服务器了 查看当前连接: ss netstat过时了

centos7的防火墙服务的名字为: firewalld.service

iptables并没有默认安装,如果需要,请自行安装【yum install iptables-services】

因篇幅问题不能全部显示,请点此查看更多更全内容