虚拟机初始化

虚拟机初始化时需要做的几件事。

Centos7

1、配置IP
vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=“Ethernet”
BOOTPROTO=“static”
NAME=“ens33”
DEVICE=“ens33”
ONBOOT=“yes”
IPADDR=192.168.100.4
NETMASK=255.255.255.0
DNS1=192.168.100.2
GATEWAY=192.168.100.2

systemctl restart network
ping www.baidu.com
备注:使用的NAT网络,192.168.100.1是本机的虚拟网卡的IP,192.168.100.2是vmware中网卡的IP?有待商榷。总之,网关和DNS要使用192.168.100.2。配置完成后本机可使用xshell或securitycrt来连接虚拟机进行下面的步骤。

2、配置yum仓库
cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e ‘/mirrors.cloud.aliyuncs.com/d’ -e ‘/mirrors.aliyuncs.com/d’ /etc/yum.repos.d/CentOS-Base.repo #非阿里云的ECS
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum install chrony
yum update
yum makecache

3、时间同步
vim /etc/chrony.conf
server ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com
systemctl restart chronyd

4、selinux,firewalld,
sed -i ‘/^SELINUX/s/enforcing/disabled/’ /etc/selinux/config
selinux需要重启后才会生效
systemctl stop firewalld.service
systemctl disable firewalld.service

5、Docker-ce
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install -y docker-ce

6、其他
阿里镜像网站
https://developer.aliyun.com/mirror/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值