为虚拟机自动配置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
vm虚拟机linux模板机制作
于 2025-03-01 15:44:00 首次发布