1、网络配置
1.1 CentOS 6
1) vi /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.153.136
NETMASK=255.255.255.0
GATEWAY=192.168.153.2(网关在虚拟机网络编辑器->NET设置中可以看到)
DNS1=192.168.153.1
2) service network restart
3) ifconfig,查看IP是否配置好
4) ping www.baidu.com,验证是否可以访问外网
1.2 CentOS 7
1) vi /etc/sysconfig/network-scripts/ifcfg-eno16777728
BOOTPROTO=static --配置静态ip
ONBOOT=yes --开机启动
IPADDR=192.168.153.136 --ip地址
NETMASK=255.255.255.0 --子网掩码
GATEWAY=192.168.153.1 --网关
DNS1=8.8.8.8 --Google dns地址 114.114.114.114--国内dns
2) service network restart(新命令:systemctl restart network.service)
3) 最小化安装时,没有ifconfig
4) ping www.baidu.com,验证是否可以访问外网
2、修改主机名
2.1 修改hosts
[root@localhost ~]# vi /etc/hosts
默认值值不要删除,添加一行
192.168.153.136 node1
2.2 修改hostname
[root@localhost ~]# vi /etc/hostname
node1
2.3 重启
[root@localhost ~]#shutdown -r now
查看主机名是否改变
3、更改镜像源
3.1 安装wget
[root@node1 ~]#yum install -y wget
3.2 下载aliyun的repo
[root@node1 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3.3 更新镜像源
[root@node1 ~]#yum clean all
[root@node1 ~]#yum makecache
3.4 测试
[root@node1 ~]#yum install -y vim
[root@node1 ~]#yum install net-tools
4、关闭防火墙和Selinux
4.1 CentOS6
[root@node1 ~]#chkconfig iptables off
[root@node1 ~]#vi /etc/selinux/config
修改:SELINUX=disabled
4.2 CentOS7
[root@node1 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@node1 ~]# systemctl stop firewalld
[root@node1 ~]# setenforce 0
[root@node1 ~]# vi /etc/selinux/config
SELINUX=disabled