vm虚拟机linux模板机制作




为虚拟机自动配置IP地址(设置之后克隆虚拟机会自动生成ip)

nmcli  connection  modify ens33 ipv4.method auto connection.autoconnect yes 
nmcli connection up ens33 
ping www.baidu.com



配置主机名
hostnamectl set-hostname template 



关闭防火墙
system stop firewalld
开机不自启
system disabled firewalled

关闭selinux


[root@template ~]# vi /etc/selinux/config					
#修改文件,修改SElinux状态
  1 
  2 # This file controls the state of SELinux on the system.
  3 # SELINUX= can take one of these three values:
  4 #     enforcing - SELinux security policy is enforced.
  5 #     permissive - SELinux prints warnings instead of enforcing.
  6 #     disabled - No SELinux policy is loaded.
  7 SELINUX=disabled										
#将第7行=后边修改为disabled
...
[root@template ~]# reboot									
#重启
[root@template ~]# getenforce								
#查看SElinux状态为disabled
[root@template ~]# poweroff	




借助华为云安装docker
https://support.huaweicloud.com/bestpractice-ecs/zh-cn_topic_0141067581.html
1.登录弹性云服务器。
2.添加yum源。
yum install epel-release -y
yum clean all
3.安装yum-util。
yum install -y yum-utils device-mapper-persistent-data lvm2
4.设置docker yum源。
yum-config-manager --add-repo https://mirrors.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.huaweicloud.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
5.安装并运行Docker。
yum -y install docker-ce
systemctl enable docker
systemctl start docker
6.检查安装结果。
docker --version




vm网卡掉了,解决办法
nmcli device status         unmanaged

nmcli networking            disabled

nmcli networking on        enabled



#配置IP地址和网关并实现开机自动连接
[root@localhost ~]# nmcli connection modify ens33 ipv4.method manual ipv4.addresses 192.168.4.7/24  connection.autoconnect yes   
[root@localhost ~]# nmcli connection up ens33     	#激活ens33
[root@localhost ~]# ifconfig            			#查看配置的IP

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值