概述 AlibabaCloudLinux3兼容CentOS8、RHEL8软件生态,其最大的优势之一是能作为CentOS8的替代方案,可免费使用该系统镜像,并免费获得阿里云针对该操作系统的长期支持AlibabaCloudLinux3(LinuxKernel5。10。84)镜像目前只支持KVM虚拟机,镜像本身不可直接启动虚拟机,需要配置引导镜像生成引导镜像 本地生成引导镜像seed。qcow2,用于虚拟机安装AlibabaCloudLinux3系统镜像后,初始化其系统配置参数 1、本地生成引导镜像seed。qcow2mkdirpalinuxseedcdalinuxseedtouchmetadatauserdata 2、catmetadatacloudconfigvim:syntaxyamllocalhostname:t3 3、catuserdatacloudconfigvim:syntaxyaml添加一个名为alinux的账号,并且可以执行sudo命令users:defaultname:rootsudo:〔ALL(ALL)NOPASSWD:ALL〕plaintextpasswd:rootrootlockpasswd:false添加AlibabaCloudLinux3的YUM源yumrepos:alinux3module:name:alinux3modulebaseurl:https:mirrors。aliyun。comalinuxreleasevermodulebasearchenabled:1gpgcheck:1gpgkey:https:mirrors。aliyun。comalinuxreleaseverRPMGPGKEYALINUX3alinux3updates:name:alinux3updatesbaseurl:https:mirrors。aliyun。comalinuxreleaseverupdatesbasearchenabled:1gpgcheck:1gpgkey:https:mirrors。aliyun。comalinuxreleaseverRPMGPGKEYALINUX3alinux3plus:name:alinux3plusbaseurl:https:mirrors。aliyun。comalinuxreleaseverplusbasearchenabled:1gpgcheck:1gpgkey:https:mirrors。aliyun。comalinuxreleaseverRPMGPGKEYALINUX3alinux3powertools:name:alinux3powertoolsbaseurl:https:mirrors。aliyun。comalinuxreleaseverpowertoolsbasearchgpgcheck:1enabled:1gpgkey:https:mirrors。aliyun。comalinuxreleaseverRPMGPGKEYALINUX3alinux3os:name:alinux3osbaseurl:https:mirrors。aliyun。comalinuxreleaseverosbasearchgpgcheck:1enabled:1gpgkey:https:mirrors。aliyun。comalinuxreleaseverRPMGPGKEYALINUX3 4、利用cloudutils生成引导镜像seed。qcow2yuminstallycloudutilscloudlocaldsdqcow2seed。qcow2userdatametadatacpseed。qcow2homedatavmseed。qcow2创建虚拟机 1、下载AlibabaCloudLinux3镜像,创建虚拟机t3wgethttps:alinux3。osscnhangzhou。aliyuncs。comaliyun3x6420Gnocloudalibase20211025。qcow2cpaliyun3x6420Gnocloudalibase20211025。qcow2homedatavmt3。qcow2 2、定义kvm虚拟机virshdefinet3。xml!catt3。xmldomaintypekvmnamet3namememory4194304memory!4GB内存vcpu2vcpucpumodecustommatchexactcheckpartialmodelfallbackallowBroadwellmodelcpuos!如果是ARM64架构的服务器,则需设置为archaarch64typearchx8664hvmtypebootdevhdosclocksynclocaltimeonpoweroffdestroyonpoweroffonrebootrestartonrebootoncrashrestartoncrashdevices!请根据不同的操作系统设置对应的kvm路径。例如:Ubuntu对应的kvm路径是usrbinkvmemulatorusrlibexecqemukvmemulator!请根据镜像格式设置下面的type参数:qcow2对应typeqcow2、vhd对应typevpcdisktypefiledevicedisk!如果要创建qcow2快照,需要关闭dataplanedrivernameqemutypeqcow2cachenonedataplaneonionative!填写AlibabaCloudLinux3镜像的绝对路径sourcefilehomedatavmt3。qcow2targetdevvdabusvirtiodisk!加入seed。img的信息disktypefiledevicediskdrivernameqemutyperaw!填写seed镜像的绝对路径sourcefilehomedatavmseed。imgtargetdevvdbbusvirtiodiskinterfacetypebridge!需要提前创建网桥br2sourcebridgebr2modeltypevirtiointerfaceconsoletypeptytargettypevirtioport0consolevideomodeltypecirrusvram9216heads1videoinputtypetabletbususbinputtypemousebusps2graphicstypevncport59163autoportnodevicesdomain启动虚拟机1、启动并console登录kvm虚机t3virshstartt3virshconsolet32、初始化,启用ssh连接时的密码验证、网卡静态IP地址vimetcsshsshdconfig允许ssh登录时使用密码验证PasswordAuthenticationyes