[关闭]
@Great-Chinese 2017-09-14T10:49:57.000000Z 字数 2330 阅读 911

Centos7新功能

Centos7新功能


1.1 centos7安装

1.2 centos7单用户模式

1,在第一条内核条目上,按下“e”,进入edit模式,找到linux16开关的行,按“end”键到最后,输入"rd.break"
再按Ctrl+x进入系统;

  1. mount -o remount,rw /sysroot/ # 进入后重新挂载/sysroot/,增加写的权限
  2. chroot /sysroot/ # 切换到原始系统下
  3. touch /.autorelabel/ # 为了selinux生效
  4. ctrl+d # 退出单用户,然后reboot

1.3 centos7救援模式

1, 设置光驱启动
2,选择Troubleshooting
3,选择Rescure a centos system
4,选择continue
5,输入命令 chroot /mnt/sysimage

1.4 centos7设置ip

1.5 centos7设置主机名和命令参数补全

  1. yum install -y net-tools
  2. hostname melodylinux.com
  3. hostnamectl set-hostname melodylinux
  4. cat /etc/hostname
  5. hostnamectl status
  6. yum install -y bash-completion
  7. source /etc/profile
  8. hostnamectl set-hostname

1.6 centos7服务相关

  1. service network restart
  2. systemctl restart network.service
  3. systemctl stop network.service
  4. chkconfig nginx on
  5. systemctl enable nginx.service
  6. systemctl disable nginx.service
  7. systemctl status network.service
  8. systemctl list-units --type=service
  9. /usr/lib/systemd/system/

1.7 centos7 systemd-unit

1.8 centos7 systemd-target

1.9 centos7 target关联unit

2.0 centos7 继续使用centos6的iptables管理机制

  1. systemctl status firewalld
  2. systemctl list-units --type=service |grep firewalld
  3. systemctl stop firewalld
  4. systemctl disable firewalld
  5. systemctl list-units --type=service |grep firewalld
  6. yum install -y iptables-services
  7. systemctl enable iptables.service
  8. systemctl start iptables.service
  9. iptables -nvL
  10. iptables -nvL
  11. iptables -t nat -nvL
  12. service iptables save
  13. service iptables restart
  14. systemctl restart iptables.service

2.1 centos7 firewalld的zone

  1. systemctl stop iptables
  2. systemctl disable iptables
  3. systemctl enable firewalld
  4. systemctl start firewalld
  5. firewall-cmd --get-default-zone
  6. firewall-cmd --get-zones
  7. work drop internal external trusted home dmz public block

2.2 centos7 firewalld的zone相关命令

  1. firewall-cmd --get-default-zone
  2. firewall-cmd --set-default-zone work
  3. firewall-cmd --get-zone-of-interface=ens33
  4. firewall-cmd --zone=public --add-interface=lo
  5. firewall-cmd --get-zone-of-interface=lo
  6. firewall-cmd --zone=home --change-interface=lo
  7. firewall-cmd --zone=home --remove-interface=lo
  8. firewall-cmd --get-active-zones

2.3 centos7 firewalld service操作

2.4 centos7 firewalld 增加规则

  1. firewall-cmd --add-port=12222/tcp --permanent
  2. firewall-cmd --reload
  3. /etc/firewalld/zones
  4. firewall-cmd --permanent --zone=home --add-forward-port=port=22:proto=tcp:toaddr=127.0.0.2
  5. success

2.5 centos7 firewalld 更改配置文件

2.6 启动同步时间服务

  1. # 启动同步时间服务
  2. cd /etc/systemd/system/multi-user.target.wants/
  3. ll /usr/lib/systemd/system/ |grep ntp
  4. systemctl start ntpdate.service

2.7 查看时区命令

  1. #查看时区命令
  2. timedatectl status
  3. #修改时区命令
  4. timedatectl set-timezone Asia/Shanghai

ntpdate time.pool.aliyun.com
```

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注