一、安装前准备
1.1 安装环境
   Centos6.2_x86_64 192.168.101.77
   所需软件
   convirt-2.1.1.tar.gz
   convirt-install-2.1.1.tar.gz
   convirture-tools-2.1.1.tar.gz
   KVM

1.2 检查服务器是否开启cpu虚拟化
[root@open2 ~]# grep -Po "(svm|vmx)" /proc/cpuinfo #如有输出则开启了
vmx


二、安装CMS:
2.1 安装convirt源:
[root@open-source ~]# cd /etc/yum.repos.d/
[root@open-source yum.repos.d]# wget --no-cache http://www.convirture.com/repos/definitions/rhel/6.x/convirt.repo

2.2 下载convirt软件包:
[root@open-source src]# wget --no-cache http://www.convirture.com/downloads/convirt/2.1.1/convirt-2.1.1.tar.gz
[root@open-source src]# wget --no-cache http://www.convirture.com/downloads/convirt/2.1.1/convirt-install-2.1.1.tar.gz

2.3 解压convirt安装包并安装依赖:
[root@open-source src]# tar zxf convirt-install-2.1.1.tar.gz
[root@open-source src]# cd convirt-install/install/cms/scripts/
[root@open-source scripts]# ./install_dependencies

下面提示第一个按回车,密码项输入mysqlroot密码,其他按y即可
Enter current password for root (enter for none): 回车
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password: convirt   #mysqlroot密码
Re-enter new password:  convirt   #mysqlroot密码
Password updated successfully!
Reloading privilege tables..
... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


mysqld (pid  9360) is running...
MySQL service is already running.
Prerequsite for ConVirt Management Server (CMS) installed.

2.4 mysql添加如下两行,官方要求
[root@open-source ~]# vim /etc/my.cnf
innodb_buffer_pool_size=1G
innodb_additional_mem_pool_size=20M
重启mysql
/etc/init.d/myqld restart

2.5 解压CMS软件包:
[root@open-source src]# cd convirt-install/install/cms/scripts/
[root@open-source scripts]# source install_config
[root@open-source scripts]# cd /usr/src/
[root@open-source src]# tar zxf convirt-2.1.1.tar.gz -C $CONVIRT_BASE  #默认路径是root下
[root@open-source src]# cd /root/convirt/install/cms/scripts/
[root@open-source scripts]# ./setup_tg2

报错
Searching for Beaker>=1.4
Reading https://pypi.python.org/simple/Beaker/
Download error on https://pypi.python.org/simple/Beaker/: [Errno 110] Connection timed out -- Some packages may not be found!
Couldn't retrieve index page for 'Beaker'
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or download links found for Beaker>=1.4
error: Could not find suitable distribution for Requirement.parse('Beaker>=1.4')
ERROR: installing Beaker >= 1.4
ERROR: Failed creating Turbogears2 environment.

解决办法安装python
[root@open-source src]# wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
[root@open-source src]# xz -d Python-2.7.6.tar.xz
[root@open-source src]# tar xf Python-2.7.6.tar  
[root@open-source src]# cd Python-2.7.6
[root@open-source Python-2.7.6]# ./configure --prefix=/usr/local/python
[root@open-source Python-2.7.6]# make && make install
重新执行以下
[root@open-source src]# cd /root/convirt/install/cms/scripts/
[root@open-source scripts]# ./setup_tg2
[root@open-source scripts]# ./setup_convirt

报错
sqlalchemy.exc.NotSupportedError: (NotSupportedError) (1286, "Unknown table engine 'InnoDB'") "set storage_engine='InnoDB'" ()
原因
增大了ib_logfile的大小,忘记移除原来的 ib log。结果启动过程中innodb发现磁盘上的 ib log文件和配置文件里的大小不一致,大致innodb启动失败。
删除mysql 数据目录下的ib_* 重新启动mysql即可

在setup_convirt过程中,会配置SSH密钥(默认安装即可):(用来管理convirt开启关闭)如下:
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/convirt/identity/cms_id_rsa.
Your public key has been saved in /var/lib/convirt/identity/cms_id_rsa.pub.
The key fingerprint is:
16:96:42:df:dd:b8:f9:ac:19:71:14:28:a3:30:26:c7 root@open-source
The key's randomart p_w_picpath is:
+--[ RSA 2048]----+
|     ..      ..  |
|    ..E. oo..o . |
|     +.o=..oo o  |
|       o..   +   |
|        S   + .  |
|       .     =   |
|            . o  |
|             +   |
|            o    |
+-----------------+

    ConVirt Management Server (CMS) setup complete.

2.6 将端口加入iptables
[root@open-source scripts]# vim /etc/sysconfig/iptables
-A INPUT -p tcp --dport 8081 -j ACCEPT
[root@open-source scripts]# service iptables restart

2.7 启动convirtCMS
[root@open-source scripts]# cd ~/convirt/
[root@open-source convirt]# ./convirt-ctl start

2.8 访问
http://192.168.101.77:8081/ #默认用户名密码admin:admin


三、准备需要被管理的服务器
首先,每台被管理的服务器上,要安装Xen (3.0.4及其以上版本) 或KVM (KVM-70及其以上版本)。
其次,每台被管理服务器与CMS机器之间必须能够以root用户使用密钥进行无密码登陆。
然后,在这些服务器上安装convirt-tool

3.1 安装KVM
[root@open-source convirt]# yum install kvm libvirt bridge-utils

3.2 安装convirture-tool
[root@open-source convirt]# cd /usr/src/
[root@open-source src]# wget http://www.convirture.com/downloads/convirture-tools/2.1.1/convirture-tools-2.1.1.tar.gz
[root@open-source src]# tar zxf convirture-tools-2.1.1.tar.gz
[root@open-source src]# cd convirture-tools/install/managed_server/scripts/
[root@open-source scripts]# ./convirt-tool install_dependencies
[root@open-source scripts]# ./convirt-tool setup