[ES from entry to actual combat] 22. Supplement-Vagrant to create a virtual machine-modify linux network settings & enable root password access

Continue to section 21

1. Modify Linux network settings

1、进入网卡设置目录下

cd sysconfig/network-scripts/

Insert picture description here

2、查看当系统前网卡信息

ip addr

Insert picture description here

3、修改网卡地址,添加网关和 DNS 服务

vi ifcfg-eth1

Insert picture description here

NM_CONTROLLED=yes
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.56.10
NETMASK=255.255.255.0
GATEWAY=192.168.56.1
DNS1=114.114.114.114
DNS2=8.8.8.8
DEVICE=eth1
PEERDNS=no

Insert picture description here

service network restart

Insert picture description here

4、配置新的 yum 源,提升软件安装下载速度

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum makecache #使新的yum源生效

Insert picture description here

2. Turn on root password access

1、修改 sshd_config 文件

vi /etc/ssh/sshd_config  # Vagrant ssh进去系统之后,修改sshd_config文件

Insert picture description here

PasswordAuthentication yes/no # 修改 no 为 yes

Insert picture description here

2、重启服务

service sshd restart

Insert picture description here

Guess you like

Origin blog.csdn.net/runewbie/article/details/106450222