OpenStack制作CentOS6.7镜像

1.下载镜像

直接访问官方镜像地址下载,注意选择中国的镜像源,相对国外镜像下载速率比较快,进入后选择版本为6.7,在isos目录下下载x86_64Minimal镜像.

2.创建虚拟机

首先需要创建一个qcow2格式镜像文件,用于作为虚拟机的磁盘,大小20G.

root@UKVM-IMG:/var/lib/libvirt/images# qemu-img create -f qcow2centos-6.7.qcow2 20G

Formatting 'centos-6.7.qcow2',fmt=qcow2 size=21474836480 encryption=offcluster_size=65536 lazy_refcounts=off refcount_bits=16

快速创建并启动虚拟机:

root@UKVM-IMG:/var/lib/libvirt/images# virt-install --virt-type kvm --namecentos-6.7 --ram 1024 --diskcentos-6.7.qcow2,format=qcow2 --networknetwork=default --graphicsvnc,listen=0.0.0.0 --noautoconsole--os-type=linux --os-variant=rhel6--cdrom=CentOS-6.7-x86_64-minimal.iso

Starting install...

Creating domain...| 0 B 00:00:00

Domain installation still in progress. You can reconnect to

the console to complete the installation process.

启动完成后,使用vnc client连接,可以直接使用virt-manager或者virt-viewer直接连接。

3. 安装OS

进入虚拟机控制台可以看到Centos的启动菜单,选择Install or upgrade an existing system,继续选择语言,选择键盘格局,选择Basic Storage Devices,开启网络,设置主机名为默认,设置时区Asia/Shanghai,设置root密码,选择“Create Custom Layout”,只需要一个根分区即可,不需要swap分区,文件系统选择ext4,存储驱动选择Virtio Block Device,如图:

wKiom1lHOi2yyPxiAAZLqpYDEr4132.png-wh_50

wKioL1lHOi6CL-EBAAEIESA50Wc789.png-wh_50

wKiom1lHOi7RnZ6HAADIDa07F48469.png-wh_50

wKioL1lHOi-zF13sAACjP7019AM799.png-wh_50

wKiom1lHOi-QBMxeAABuwBYs1dE652.png-wh_50

wKioL1lHOjDQgIxlAACZhpHUS28571.png-wh_50

wKiom1lHOjCDk9gnAAIfJAc7dsU318.png-wh_50

wKioL1lHOjCB_GXEAABVwwjfh3E635.png-wh_50

wKiom1lHOjHw0rT6AADjZX3zxaQ867.png-wh_50

wKiom1lHOjLQoQeeAABtWTgs4-o092.png-wh_50

wKioL1lHOjLwxBGiAABvJaLJzRI338.png-wh_50

wKioL1lHOjLTnNxFAAEjDYhuf3Q856.png-wh_50

wKiom1lHOjPTNVH8AACIs9igVgo823.png-wh_50

完成安装配置工作,最后点击右下角的reboot重启退出虚拟机.

4. 配置OS

安装好系统后,还需要进行配置才能作为glance镜像使用,启动虚拟机:

root@UKVM-IMG:~# virsh list --all

Id Name State

----------------------------------------------------

- centos-6.7 shut off

- centos7.2.1511-L shut off

- centos72-L shut off

root@UKVM-IMG:~# virsh start centos-6.7

Domain centos-6.7 started

4.1 配置yum仓库

[root@localhost ~]# cd /etc/yum.repos.d/

[root@localhost yum.repos.d]# ls

CentOS-Base.repoCentOS-Debuginfo.repoCentOS-fasttrack.repoCentOS-Media.repoCentOS-Vault.repo

[root@localhost yum.repos.d]# rm CentOS-Debuginfo.repo

rm: remove regular file `CentOS-Debuginfo.repo'? y

[root@localhost yum.repos.d]# rm CentOS-fasttrack.repo

rm: remove regular file `CentOS-fasttrack.repo'? y

[root@localhost yum.repos.d]# rm CentOS-Media.repo

rm: remove regular file `CentOS-Media.repo'? y

[root@localhost yum.repos.d]# rm CentOS-Vault.repo

rm: remove regular file `CentOS-Vault.repo'? y

[root@localhost yum.repos.d]# ls

CentOS-Base.repo

[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-6.7-Base.repo

[root@localhost yum.repos.d]# cat CentOS-6.7-Base.repo

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client.You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you,as a fall back you can try the

# remarked out baseurl= line instead.

#

#

[base]

name=CentOS-$releasever - Base

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra

baseurl=http://vault.centos.org/6.7/os/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates

[updates]

name=CentOS-$releasever - Updates

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra

baseurl=http://vault.centos.org/6.7/updates/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra

baseurl=http://vault.centos.org/6.7/extras/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra

#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra

#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

[root@localhost yum.repos.d]#

[root@localhost yum.repos.d]# yum install epel-release

Loaded plugins: fastestmirror

Setting up Install Process

Loading mirror speeds from cached hostfile

Resolving Dependencies

--> Running transaction check

---> Package epel-release.noarch 0:6-8 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================

Package Arch Version Repository Size

====================================================================================================================

Installing:

epel-release noarch 6-8 extras 14 k

Transaction Summary

====================================================================================================================

Install 1 Package(s)

Total download size: 14 k

Installed size: 22 k

Is this ok [y/N]: y

Downloading Packages:

epel-release-6-8.noarch.rpm| 14 kB 00:00

warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature,key ID c105b9de:NOKEY

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Importing GPG key 0xC105B9DE:

Userid : CentOS-6 Key (CentOS 6Official Signing Key) <centos-6-key@centos.org>

Package:centos-release-6-7.el6.centos.12.3.x86_64 (@anaconda-CentOS-201508042137.x86_64/6.7)

From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing :epel-release-6-8.noarch 1/1

Verifying : epel-release-6-8.noarch1/1

Installed:

epel-release.noarch 0:6-8

Complete!

[root@localhost yum.repos.d]#

4.2 更新系统

[root@localhostyum.repos.d]# yum update -y

Loaded plugins:fastestmirror

Setting up UpdateProcess

Loading mirror speedsfrom cached hostfile

epel/metalink| 4.5 kB 00:00

* epel: mirror.premi.st

epel| 4.3 kB 00:00

epel/primary_db| 5.9 MB 00:00

ResolvingDependencies

--> Runningtransaction check

---> Packagebash.x86_64 0:4.1.2-33.el6 will be updated

---> Packagebash.x86_64 0:4.1.2-33.el6_7.1 will be an update

---> Packageca-certificates.noarch 0:2015.2.4-65.0.1.el6_6 will be updated

---> Packageca-certificates.noarch 0:2015.2.6-65.0.1.el6_7 will be an update

---> Packagechkconfig.x86_64 0:1.3.49.3-5.el6 will be updated

---> Packagechkconfig.x86_64 0:1.3.49.3-5.el6_7.2 will be an update

---> Packagecoreutils.x86_64 0:8.4-37.el6 will be updated

---> Packagecoreutils.x86_64 0:8.4-37.el6_7.3 will be an update

---> Packagecoreutils-libs.x86_64 0:8.4-37.el6 will be updated

---> Packagecoreutils-libs.x86_64 0:8.4-37.el6_7.3 will be an update

---> Packagecronie.x86_64 0:1.4.4-15.el6 will be updated

---> Packagecronie.x86_64 0:1.4.4-15.el6_7.1 will be an update

---> Packagecronie-anacron.x86_64 0:1.4.4-15.el6 will be updated

---> Packagecronie-anacron.x86_64 0:1.4.4-15.el6_7.1 will be an update

---> Packagedb4.x86_64 0:4.7.25-19.el6_6 will be updated

---> Packagedb4.x86_64 0:4.7.25-20.el6_7 will be an update

---> Packagedb4-utils.x86_64 0:4.7.25-19.el6_6 will be updated

---> Packagedb4-utils.x86_64 0:4.7.25-20.el6_7 will be an update

---> Packagedevice-mapper.x86_64 0:1.02.95-2.el6 will be updated

---> Packagedevice-mapper.x86_64 0:1.02.95-3.el6_7.4 will be an update

---> Packagedevice-mapper-event.x86_64 0:1.02.95-2.el6 will be updated

---> Packagedevice-mapper-event.x86_64 0:1.02.95-3.el6_7.4 will be an update

---> Packagedevice-mapper-event-libs.x86_64 0:1.02.95-2.el6 will be updated

---> Packagedevice-mapper-event-libs.x86_64 0:1.02.95-3.el6_7.4 will be an update

---> Packagedevice-mapper-libs.x86_64 0:1.02.95-2.el6 will be updated

---> Packagedevice-mapper-libs.x86_64 0:1.02.95-3.el6_7.4 will be an update

---> Packagegawk.x86_64 0:3.1.7-10.el6 will be updated

---> Packagegawk.x86_64 0:3.1.7-10.el6_7.3 will be an update

---> Packageglibc.x86_64 0:2.12-1.166.el6 will be updated

---> Packageglibc.x86_64 0:2.12-1.166.el6_7.7 will be an update

---> Packageglibc-common.x86_64 0:2.12-1.166.el6 will be updated

此处省略。。。。

4.3 安装开发工具包

[root@localhostyum.repos.d]# yum groupinstall -y 'Development Tools'

Loaded plugins:fastestmirror

Setting up Group Process

Loading mirror speeds fromcached hostfile

* epel: mirrors.tuna.tsinghua.edu.cn

Package1:make-3.81-20.el6.x86_64 already installed and latest version

Package 1:pkgconfig-0.23-9.1.el6.x86_64already installed and latest version

Packagebinutils-2.20.51.0.2-5.43.el6.x86_64 already installed and latest version

Resolving Dependencies

--> Running transactioncheck

---> Packageautoconf.noarch 0:2.63-5.1.el6 will be installed

--> ProcessingDependency: perl >= 5.005_03 for package: autoconf-2.63-5.1.el6.noarch

--> ProcessingDependency: perl >= 5.005 for package: autoconf-2.63-5.1.el6.noarch

--> ProcessingDependency: perl >= 5.000 for package: autoconf-2.63-5.1.el6.noarch

--> ProcessingDependency: perl(vars) for package: autoconf-2.63-5.1.el6.noarch

--> ProcessingDependency: perl(strict) for package: autoconf-2.63-5.1.el6.noarch

--> ProcessingDependency: perl(Text::ParseWords) for package: autoconf-2.63-5.1.el6.noarch

--> ProcessingDependency: perl(POSIX) for package: autoconf-2.63-5.1.el6.noarch

--> ProcessingDependency: perl(IO::File) for package: autoconf-2.63-5.1.el6.noarch

--> ProcessingDependency: perl(Getopt::Long) for package: autoconf-2.63-5.1.el6.noarch

--> ProcessingDependency: perl(File::stat) for package: autoconf-2.63-5.1.el6.noarch

此处省略。。。。

[root@localhostyum.repos.d]# yum install curl-devel xinetd readline-devel bzip2-devel cmakediffutils gcc-g77 gd gd-devel git-core glib2-devel gmp-devel libc-client-devellibcurl-devel openssl-devel pspell-devel zlib-devel

Loaded plugins:fastestmirror

Setting up Install Process

Loading mirror speeds fromcached hostfile

* epel: mirror.premi.st

Packagediffutils-2.8.1-28.el6.x86_64 already installed and latest version

No package gcc-g77available.

Packagegd-2.0.35-11.el6.x86_64 already installed and latest version

Packagegit-1.7.1-4.el6_7.1.x86_64 already installed and latest version

No package pspell-develavailable.

Resolving Dependencies

--> Running transactioncheck

---> Packagebzip2-devel.x86_64 0:1.0.5-7.el6_0 will be installed

---> Package cmake.x86_640:2.8.12.2-4.el6 will be installed

--> ProcessingDependency: libarchive.so.2()(64bit) for package: cmake-2.8.12.2-4.el6.x86_64

---> Packagegd-devel.x86_64 0:2.0.35-11.el6 will be installed

--> ProcessingDependency: libpng-devel for package: gd-devel-2.0.35-11.el6.x86_64

--> ProcessingDependency: libjpeg-devel for package: gd-devel-2.0.35-11.el6.x86_64

--> ProcessingDependency: libXpm-devel for package: gd-devel-2.0.35-11.el6.x86_64

--> ProcessingDependency: libX11-devel for package: gd-devel-2.0.35-11.el6.x86_64

--> ProcessingDependency: freetype-devel for package: gd-devel-2.0.35-11.el6.x86_64

--> ProcessingDependency: fontconfig-devel for package: gd-devel-2.0.35-11.el6.x86_64

---> Packageglib2-devel.x86_64 0:2.28.8-4.el6 will be installed

---> Packagegmp-devel.x86_64 0:4.3.1-7.el6_2.2 will be installed

---> Packagelibc-client-devel.x86_64 0:2007e-11.el6 will be installed

--> ProcessingDependency: libc-client = 2007e-11.el6 for package:libc-client-devel-2007e-11.el6.x86_64

--> ProcessingDependency: libc-client.so.2007()(64bit) for package: libc-client-devel-2007e-11.el6.x86_64

---> Packagelibcurl-devel.x86_64 0:7.19.7-46.el6 will be installed

--> ProcessingDependency: libidn-devel for package: libcurl-devel-7.19.7-46.el6.x86_64

---> Packageopenssl-devel.x86_64 0:1.0.1e-42.el6_7.4 will be installed

--> ProcessingDependency: krb5-devel for package: openssl-devel-1.0.1e-42.el6_7.4.x86_64

---> Packagereadline-devel.x86_64 0:6.0-4.el6 will be installed

此处省略。。。。


4.4 安装管理工具包

[root@localhostyum.repos.d]# yum groupinstall 'System administration tools' --setopt=group_package_types=mandatory,default,optional

Loaded plugins:fastestmirror

Setting up Group Process

Loading mirror speeds fromcached hostfile

* epel: mirror.premi.st

Resolving Dependencies

--> Running transactioncheck

---> Package ansible.noarch0:2.3.0.0-3.el6 will be installed

--> ProcessingDependency: sshpass for package: ansible-2.3.0.0-3.el6.noarch

--> ProcessingDependency: python-six for package: ansible-2.3.0.0-3.el6.noarch

--> ProcessingDependency: python-simplejson for package: ansible-2.3.0.0-3.el6.noarch

--> ProcessingDependency: python-setuptools for package: ansible-2.3.0.0-3.el6.noarch

--> ProcessingDependency: python-paramiko for package: ansible-2.3.0.0-3.el6.noarch

--> ProcessingDependency: python-keyczar for package: ansible-2.3.0.0-3.el6.noarch

--> ProcessingDependency: python-jinja2-26 for package: ansible-2.3.0.0-3.el6.noarch

--> ProcessingDependency: python-httplib2 for package: ansible-2.3.0.0-3.el6.noarch

--> ProcessingDependency: python-crypto2.6 for package: ansible-2.3.0.0-3.el6.noarch

此处省略。。。。


[root@localhostyum.repos.d]# yum installlibselinux-python telnet wget rsync openssh-clients system-config-network-tuibind-utils vim-enhanced ntpdate cronie yum-utils strace lsof sysstat expect ncmlocate iptraf iotop dstat htop bash-completion.noarch

Loaded plugins:fastestmirror

Setting up Install Process

Loading mirror speeds fromcached hostfile

* epel: mirror.premi.st

Packagersync-3.0.6-12.el6.x86_64 already installed and latest version

Packageopenssh-clients-5.3p1-114.el6_7.x86_64 already installed and latest version

Packagecronie-1.4.4-15.el6_7.1.x86_64 already installed and latest version

Packageexpect-5.44.1.15-5.el6_4.x86_64 already installed and latest version

Resolving Dependencies

--> Running transactioncheck

---> Packagebash-completion.noarch 1:1.3-7.el6 will be installed

---> Packagebind-utils.x86_64 32:9.8.2-0.37.rc1.el6_7.7 will be installed

--> ProcessingDependency: bind-libs = 32:9.8.2-0.37.rc1.el6_7.7 for package:32:bind-utils-9.8.2-0.37.rc1.el6_7.7.x86_64

--> ProcessingDependency: liblwres.so.80()(64bit) for package:32:bind-utils-9.8.2-0.37.rc1.el6_7.7.x86_64

--> ProcessingDependency: libisccfg.so.82()(64bit) for package: 32:bind-utils-9.8.2-0.37.rc1.el6_7.7.x86_64

--> ProcessingDependency: libisccc.so.80()(64bit) for package:32:bind-utils-9.8.2-0.37.rc1.el6_7.7.x86_64

--> ProcessingDependency: libisc.so.83()(64bit) for package:32:bind-utils-9.8.2-0.37.rc1.el6_7.7.x86_64

--> Processing Dependency:libdns.so.81()(64bit) for package: 32:bind-utils-9.8.2-0.37.rc1.el6_7.7.x86_64

--> ProcessingDependency: libbind9.so.80()(64bit) for package:32:bind-utils-9.8.2-0.37.rc1.el6_7.7.x86_64

---> Package dstat.noarch0:0.7.0-2.el6 will be installed

---> Package htop.x86_640:1.0.3-1.el6 will be installed

---> Package iotop.noarch0:0.3.2-7.el6 will be installed

---> Packageiptraf.x86_64 0:3.0.1-14.el6 will be installed

---> Packagelibselinux-python.x86_64 0:2.0.94-5.8.el6 will be installed

4.5 配置sshd

[root@localhost~]# vim /etc/ssh/sshd_config

PermitRootLogin yes
UseDNS no


[root@localhost~]# systemctl restart sshd


4.6 配置Selinux、防火墙

[root@localhostyum.repos.d]# chkconfig iptables off

[root@localhostyum.repos.d]# chkconfig ip6tables off

[root@localhostyum.repos.d]# chkconfig --list |grep ip

ip6tables 0:off 1:off 2:off 3:off 4:off 5:off 6:off

iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off

4.7 安装电源管理服务

[root@localhost yum.repos.d]# yum install acpid

Loaded plugins: fastestmirror

Setting up Install Process

Loading mirror speeds from cached hostfile

* epel:mirror.premi.st

Resolving Dependencies

--> Running transaction check

---> Package acpid.x86_64 0:1.0.10-2.1.el6 willbe installed

--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================

Package Arch Version Repository Size

====================================================================================================================

Installing:

acpid x86_64 1.0.10-2.1.el6 base 36 k

Transaction Summary

====================================================================================================================

Install1 Package(s)

Total download size: 36 k

Installed size: 73 k

Is this ok [y/N]: y

Downloading Packages:

acpid-1.0.10-2.1.el6.x86_64.rpm | 36 kB00:00

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing: acpid-1.0.10-2.1.el6.x86_64 1/1

Verifying :acpid-1.0.10-2.1.el6.x86_641/1

Installed:

acpid.x86_64 0:1.0.10-2.1.el6

Complete!

[root@localhost yum.repos.d]# chkconfig acpid on

4.8 配置启动日志显示

[root@localhostyum.repos.d]# cat /boot/grub/grub.conf

# grub.confgenerated by anaconda

#

# Note thatyou do not have to rerun grub after making changes to this file

# NOTICE: You do not have a /boot partition. This means that

# all kernel and initrd paths arerelative to /,eg.

# root (hd0,0)

# kernel /boot/vmlinuz-version roroot=/dev/vda1

# initrd /boot/initrd-[generic-]version.img

#boot=/dev/vda

default=0

timeout=3

splashimage=(hd0,0)/boot/grub/splash.xpm.gz

hiddenmenu

title CentOS(2.6.32-573.26.1.el6.x86_64)

root (hd0,0)

kernel/boot/vmlinuz-2.6.32-573.26.1.el6.x86_64 roroot=UUID=6ebce6cc-aa6e-486d-9c28-0d631a02a992 rd_NO_LUKS rd_NO_LVMLANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DMconsole=tty0 console=ttyS0,115200n8 ipv6.disable=1

initrd/boot/initramfs-2.6.32-573.26.1.el6.x86_64.img

title CentOS 6(2.6.32-573.el6.x86_64)

root (hd0,0)

kernel /boot/vmlinuz-2.6.32-573.el6.x86_64ro root=UUID=6ebce6cc-aa6e-486d-9c28-0d631a02a992 rd_NO_LUKS rd_NO_LVMLANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DMconsole=tty0 console=ttyS0,115200n8 ipv6.disable=1

initrd/boot/initramfs-2.6.32-573.el6.x86_64.img

4.9 安装配置qemu-guest-agent

[root@localhostyum.repos.d]# yum install qemu-guest-agent

Loadedplugins: fastestmirror

Setting upInstall Process

Loading mirrorspeeds from cached hostfile

* epel: mirror.premi.st

ResolvingDependencies

--> Runningtransaction check

--->Package qemu-guest-agent.x86_64 2:0.12.1.2-2.479.el6_7.4 will be installed

-->Finished Dependency Resolution

DependenciesResolved

====================================================================================================================

Package Arch Version Repository Size

====================================================================================================================

Installing:

qemu-guest-agent x86_64 2:0.12.1.2-2.479.el6_7.4 updates 493 k

TransactionSummary

====================================================================================================================

Install 1 Package(s)

Total downloadsize: 493 k

Installedsize: 229 k

Is this ok[y/N]: y

DownloadingPackages:

qemu-guest-agent-0.12.1.2-2.479.el6_7.4.x86_64.rpm |493 kB 00:00

Runningrpm_check_debug

RunningTransaction Test

TransactionTest Succeeded

RunningTransaction

Installing :2:qemu-guest-agent-0.12.1.2-2.479.el6_7.4.x86_64 1/1

Verifying: 2:qemu-guest-agent-0.12.1.2-2.479.el6_7.4.x86_641/1

Installed:

qemu-guest-agent.x86_642:0.12.1.2-2.479.el6_7.4

Complete!

[root@localhostyum.repos.d]#

[root@localhostyum.repos.d]# cat /etc/sysconfig/qemu-ga

# Transportmethod may be one of following:

# * unix-listen

# * virtio-serial

# * isa-serial

# Default:virtio-serial

TRANSPORT_METHOD="virtio-serial"

# You also canoverride the device/socket path

# Default:/dev/virtio-ports/org.qemu.guest_agent.0

DEVPATH="/dev/virtio-ports/org.qemu.guest_agent.0"

# If logfileis unset it defaults to stderr but the daemon

# function ofinit script redirects stderr to /dev/null

LOGFILE="/var/log/qemu-ga/qemu-ga.log"

# Overridepidfile name

# Default:/var/run/qemu-ga.pid

PIDFILE="/var/run/qemu-ga.pid"

# SELinuxnote:

# About guest arbitrary file read/write

#

# A newselinux policy is introduced on RHEL-6.4 to deny qemu-ga to

# read/writearbitrary guest files except the device file used to talk

# with hostprocesses,LOGFILE and PIDFILE.

#

# You candisable this policy by "restorecon -R -v /usr/bin/qemu-ga"

#Comma-separated blacklist of RPCs to disable or empty list to enable all

# Tip: You canget the list of RPC commands using `qemu-ga --blacklist ?`

# Default:blank list to enable all RPCs

# Note: Thereshould be no spaces between commas and commands in the blacklist

#BLACKLIST_RPC="guest-file-open,guest-file-close,guest-file-read,guest-file-write,guest-file-seek,guest-file-flush"

BLACKLIST_RPC=""

# Enablefsfreeze hook. See the --fsfreeze-hook option in "qemu-ga --help".

FSFREEZE_HOOK_ENABLE=0

# Set theoption argument for --fsfreeze-hook,which is the full pathname of

# the hookscript. An empty or unset value designates the default script

# (invoke"qemu-ga --help" to interrogate).

#

# This setting(independently of value) takes effect only when

#FSFREEZE_HOOK_ENABLE is nonzero.

#FSFREEZE_HOOK_PATHNAME=/usr/libexec/qemu-ga/fsfreeze-hook

4.10 配置zeroconf route

[root@localhost ~]# echo"NOZEROCONF=yes" >> /etc/sysconfig/network

[root@localhost ~]# cat /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=localhost.localdomain

NOZEROCONF=yes

4.11 安装配置cloud 软件包

[root@localhostyum.repos.d]# yum install python-prettytable

Loadedplugins: fastestmirror

Setting upInstall Process

Loading mirrorspeeds from cached hostfile

* epel: mirror.premi.st

ResolvingDependencies

--> Runningtransaction check

--->Package python-prettytable.noarch 0:0.7.2-1.el6.centos will be installed

-->Finished Dependency Resolution

DependenciesResolved

====================================================================================================================

Package Arch Version Repository Size

====================================================================================================================

Installing:

python-prettytable noarch 0.7.2-1.el6.centos extras 37 k

TransactionSummary

====================================================================================================================

Install 1 Package(s)

Total downloadsize: 37 k

Installedsize: 181 k

Is this ok[y/N]: y

DownloadingPackages:

python-prettytable-0.7.2-1.el6.centos.noarch.rpm| 37 kB 00:00

Runningrpm_check_debug

RunningTransaction Test

TransactionTest Succeeded

RunningTransaction

Installing :python-prettytable-0.7.2-1.el6.centos.noarch1/1

Verifying: python-prettytable-0.7.2-1.el6.centos.noarch1/1

Installed:

python-prettytable.noarch0:0.7.2-1.el6.centos

Complete!

[root@localhostyum.repos.d]# yum install cloud-init --disablerepo=extras

Loadedplugins: fastestmirror

Setting upInstall Process

Loading mirrorspeeds from cached hostfile

* epel: mirrors.tuna.tsinghua.edu.cn

ResolvingDependencies

--> Runningtransaction check

--->Package cloud-init.noarch 0:0.7.4-2.el6 will be installed

-->Processing Dependency: python-boto >= 2.6.0 for package: cloud-init-0.7.4-2.el6.noarch

-->Processing Dependency: python-requests for package:cloud-init-0.7.4-2.el6.noarch

-->Processing Dependency: python-jsonpatch for package:cloud-init-0.7.4-2.el6.noarch

-->Processing Dependency: python-configobj for package:cloud-init-0.7.4-2.el6.noarch

-->Processing Dependency: python-cheetah for package:cloud-init-0.7.4-2.el6.noarch

-->Processing Dependency: python-argparse for package:cloud-init-0.7.4-2.el6.noarch

-->Processing Dependency: policycoreutils-python for package:cloud-init-0.7.4-2.el6.noarch

-->Processing Dependency: dmidecode for package: cloud-init-0.7.4-2.el6.noarch

--> Runningtransaction check

--->Package dmidecode.x86_64 1:2.12-6.el6 will be installed

--->Package policycoreutils-python.x86_64 0:2.0.83-24.el6 will be installed

-->Processing Dependency: libsemanage-python >= 2.0.43-4 for package:policycoreutils-python-2.0.83-24.el6.x86_64

-->Processing Dependency: audit-libs-python >= 1.4.2-1 for package:policycoreutils-python-2.0.83-24.el6.x86_64

-->Processing Dependency: setools-libs-python for package:policycoreutils-python-2.0.83-24.el6.x86_64

-->Processing Dependency: libcgroup for package:policycoreutils-python-2.0.83-24.el6.x86_64

--->Package python-argparse.noarch 0:1.2.1-2.1.el6 will be installed

--->Package python-cheetah.x86_64 0:2.4.1-1.el6 will be installed

-->Processing Dependency: python-pygments for package:python-cheetah-2.4.1-1.el6.x86_64

-->Processing Dependency: python-markdown for package: python-cheetah-2.4.1-1.el6.x86_64

--->Package python-configobj.noarch 0:4.6.0-3.el6 will be installed

--->Package python-jsonpatch.noarch 0:1.2-2.el6 will be installed

-->Processing Dependency: python-jsonpointer for package:python-jsonpatch-1.2-2.el6.noarch

--->Package python-requests.noarch 0:2.6.0-3.el6 will be installed

此处省略。。。。

5. 封装镜像

[root@localhostcloud]# shutdown -h now

Broadcastmessage from root@localhost.localdomain

(/dev/pts/0) at 17:16 ...

The system isgoing down for halt NOW!

[root@localhostcloud]# Connection to 192.168.122.53 closed by remote host.

Connection to192.168.122.53 closed.

root@UKVM-IMG:~#virt-sysprep -d centos-6.7

[ 0.0] Examining the guest ...

[ 7.3] Performing "abrt-data" ...

[ 7.3] Performing "bash-history" ...

[ 7.4] Performing "blkid-tab" ...

[ 7.4] Performing "crash-data" ...

[ 7.4] Performing "cron-spool" ...

[ 7.4] Performing"dhcp-client-state" ...

[ 7.4] Performing"dhcp-server-state" ...

[ 7.4] Performing "dovecot-data" ...

[ 7.4] Performing "logfiles" ...

[ 7.5] Performing "machine-id" ...

[ 7.5] Performing "mail-spool" ...

[ 7.5] Performing "net-hostname" ...

[ 7.6] Performing "net-hwaddr" ...

[ 7.6] Performing "pacct-log" ...

[ 7.6] Performing"package-manager-cache" ...

[ 7.6] Performing "pam-data" ...

[ 7.6] Performing "puppet-data-log"...

[ 7.6] Performing"rh-subscription-manager" ...

[ 7.6] Performing "rhn-systemid" ...

[ 7.6] Performing "rpm-db" ...

[ 7.6] Performing "samba-db-log" ...

[ 7.6] Performing "script" ...

[ 7.6] Performing "smolt-uuid" ...

[ 7.6] Performing "ssh-hostkeys" ...

[ 7.7] Performing "ssh-userdir" ...

[ 7.7] Performing "sssd-db-log" ...

[ 7.7] Performing "tmp-files" ...

[ 7.7] Performing"udev-persistent-net" ...

[ 7.7] Performing "utmp" ...

[ 7.7] Performing "yum-uuid" ...

[ 7.7] Performing "customize" ...

[ 7.7] Setting a random seed

[ 7.7] Performing "lvm-uuids" ...

6. 上传镜像

root@node-27:~# qemu-img convert -f qcow2 -O rawcentos-6.7-L.qcow2 centos-6.7-L.raw

root@node-27:~# source openrc3

root@node-27:~#

You have new mail in /var/mail/root

root@node-27:~#

root@node-27:~# openstack image create"centos-6.7-L" \

> --file centos-6.7-L.raw \

> --disk-format raw --container-format bare \

> --public

+------------------+--------------------------------------+

| Field| Value|

+------------------+--------------------------------------+

| checksum| 3c458b30b08a2ad7d87e09ebe26e969e|

| container_format | bare |

| created_at| 2017-06-17T04:55:29.000000|

| deleted| False|

| deleted_at| None|

| disk_format| raw|

| id| 4bf47823-bd0a-4348-8636-7abb2b9e6757 |

| is_public| True|

| min_disk| 0 |

| min_ram| 0|

| name| centos-6.7-L|

| owner| 74f3bf2affa8443bbcd77b51173bf0de|

| properties||

| protected| False|

| size| 21474836480|

| status| active|

| updated_at| 2017-06-17T04:56:40.000000 |

| virtual_size| None|

+------------------+--------------------------------------+

root@node-27:~#

7.创建实例测试

创建实例

wKiom1lHPIjgzsCbAADMP88R2pE985.png-wh_50

完成。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


linux下开机自启: 在/etc/init.d目录下新建文件elasticsearch 并敲入shell脚本: 注意, 前两行必须填写,且要注释掉。 第一行为shell前行代码,目的告诉系统使用shell。 第二行分别代表运行级别、启动优先权、关闭优先权,且后面添加开机服务会用到。 shell脚本
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以需要赋予其可执行权 chmod +x /etc/rc.d/rc.local 2、赋予脚本可执行权限假设/usr/local/script/autostart.sh是你的脚本路径,给予执行权限 chmod +x /usr
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用ls -ll,会显示成字节大小,而ls- lh会以KB、MB等为单位进行显示,这样比较直观一些。 通过命令du -h –max-depth=1 *,可以查看当前目录下各文件、文件夹的大小,这个比较实用。 查询当前目录总大小可以使用d
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一但shell关闭网站也就关闭了,所以要配置守护进程, 用的是Supervisor,本文主要记录配置的过程和过程遇到的问题 安装Supervisor&#160;1 yum install python-setuptools
设置时区(CentOS 7) 先执行命令timedatectl status|grep &#39;Time zone&#39;查看当前时区,如果不是时区(Asia/Shanghai),则需要先设置为中国时区,否则时区不同会存在时差。 #已经是Asia/Shanghai,则无需设置 [root@xia
vim&#160;/etc/sysconfig/network-scripts/ifcfg-eth0 BOOTPROTO=&quot;static&quot; ONBOOT=yes IPADDR=192.168.8.106 NETMASK=255.255.252.0 GATEWAY=192.168.
一、安装gcc依赖 由于 redis 是用 C 语言开发,安装之前必先确认是否安装 gcc 环境(gcc -v),如果没有安装,执行以下命令进行安装 [root@localhost local]# yum install -y gcc 二、下载并解压安装包 [root@localhost local
第一步 On CentOS/RHEL 6.*: $ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm On CentOS/RHEL 7: $
/// &lt;summary&gt; /// 取小写文件名后缀 /// &lt;/summary&gt; /// &lt;param name=&quot;name&quot;&gt;文件名&lt;/param&gt; /// &lt;returns&gt;返回小写后缀,不带“.”&lt;/ret
which nohup .bash_profile中并source加载 如果没有就安装吧 yum provides */nohup nohup npm run start &amp; nohup ./kibana &amp;
1.1 MySQL安装 1.1.1 下载wget命令 yum -y install wget 1.1.2 在线下载mysql安装包 wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 1.1.3 安装My
重启 reboot shutdown -r now init 6 关闭 init 0 shutdown -h now shutdown -h 20:25 #8点25关机查看内存 free CPU利用率 top 日期 date 设置时间 date 033017002015 #月日时间年 日历 cal
1、firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 :
1 下载并安装MySQL官方的&#160;Yum Repository wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm 使用上面的命令就直接下载了安装用的Yum Repository,大概
CentOS6.x CentOS6中转用Upstrat代替以前的init.d/rcX.d的线性启动方式。 一、相关命令 通过initctl help可以查看相关命令 [root@localhost ~]# initctl help Job commands: start Start job. sto
1、使用命令:df -lk 找到已满磁盘 2、使用命令:du --max-depth=1 -h 查找大文件,删除
ifconfig:查看网卡信息 网卡配置文件位置: /etc/sysconfig/network-scripts/文件夹 nmtui:配置网卡 netstat -tlunp:查看端口信息 端口信息存储位置: /etc/services文件 route:查看路由信息 wget:下载网路文件,例如 wg
ps -ef:查看所有进程,&#160;ps -ef |grap firewalld 查看与firewalld相关的进程 which :查看进程:which firewalld kill 进程id:杀掉进程 kill 640,强制杀:kill -9 640 man:查看帮助,例如 man ps 查看
useradd:添加用户 useradd abc,默认添加一个abc组 vipw:查看系统中用户 groupadd:添加组groupadd ccna vigr:查看系统中的组 gpasswd:将用户abc添加到ccna组 gpasswd -a abc ccna groups abc:查看用户abc属