CentOS-6.8制作qcow2镜像
标签搜索
侧边栏壁纸
  • 累计撰写 16 篇文章
  • 累计收到 0 条评论

CentOS-6.8制作qcow2镜像

ranyuan
2024-09-29 / 0 评论 / 28 阅读 / 正在检测是否收录...
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# cat /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-6.10 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-6.10 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-6.10 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.10 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.10 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6```html
[root@localhost yum.repos.d]# ls
CentOS-Base.repo
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
[root@localhost yum.repos.d]# ls
CentOS-Base.repo

[root@localhost ~]# yum install util-linux cloud-utils-growpart parted -y
[root@localhost ~]# yum install qemu-guest-agent cloud-init -y
[root@localhost ~]# yum install vim curl wget net-tools chrony -y
[root@localhost ~]# sed -i 's/disable_root: 1/disable_root: 0/g' /etc/cloud/cloud.cfg
[root@localhost ~]# sed -i 's/ssh_pwauth:.*/ssh_pwauth:\ \ 1/g' /etc/cloud/cloud.cfg
[root@localhost ~]# sed -i 's/\ \ name: .*/\ \ name: root/g' /etc/cloud/cloud.cfg
[root@localhost ~]# sed -i 's/lock_passwd: .*/lock_passwd: false/g' /etc/cloud/cloud.cfg
[root@localhost ~]# sed -i 's/gecos: .*/gecos: root/g' /etc/cloud/cloud.cfg
[root@localhost ~]# service cloud-init start
[root@localhost ~]# chkconfig cloud-init on
[root@localhost ~]# service qemu-ga start
[root@localhost ~]# chkconfig qemu-ga on
[root@localhost ~]# rm ~/*
rm: remove regular file `/root/anaconda-ks.cfg'? 
rm: remove regular file `/root/install.log'? 
rm: remove regular file `/root/install.log.syslog'? 
[root@localhost ~]# rm -rf /tmp/*
[root@localhost ~]# rm ~/.bash_history
[root@localhost ~]# history -c 
[root@localhost ~]# 
# 关机实例

#宿主机执行
qemu-img convert -c -O qcow2 /path/old.img.qcow2 /path/new.img.qcow2
#
[root@wre-wewrf kvm11425]# qemu-img convert -c -O qcow2 kvm11425-system.qcow2 /home/kvm/images/CentOS-6.8.1607-x64_new.qcow2
0

评论 (0)

取消