在centos上安装xe命令行的作用就不用多说了。首先在xenserver的安装iso中找到xe命令的rpm包(在client_install这个目录下),
然后拷贝到centos上。如果直接用rpm命令安装xe-cli-6.1.0-59235p.i686.rpm这个包,会提示依赖错误。
这时改用yum命令来安装,它会自动帮我们处理依赖。
[root@cloudstack-ms ~]# rpm -ivh xe-cli-6.1.0-59235p.i686.rpm
error: Failed dependencies:
libc.so.6 is needed by xapi-xe-0.2-5181.i686
libc.so.6(GLIBC_2.0) is needed by xapi-xe-0.2-5181.i686
libc.so.6(GLIBC_2.1) is needed by xapi-xe-0.2-5181.i686
libc.so.6(GLIBC_2.1.2) is needed by xapi-xe-0.2-5181.i686
libc.so.6(GLIBC_2.2) is needed by xapi-xe-0.2-5181.i686
libc.so.6(GLIBC_2.3) is needed by xapi-xe-0.2-5181.i686
libc.so.6(GLIBC_2.3.2) is needed by xapi-xe-0.2-5181.i686
libc.so.6(GLIBC_2.3.4) is needed by xapi-xe-0.2-5181.i686
libc.so.6(GLIBC_2.4) is needed by xapi-xe-0.2-5181.i686
libdl.so.2 is needed by xapi-xe-0.2-5181.i686
libdl.so.2(GLIBC_2.0) is needed by xapi-xe-0.2-5181.i686
libdl.so.2(GLIBC_2.1) is needed by xapi-xe-0.2-5181.i686
libm.so.6 is needed by xapi-xe-0.2-5181.i686
libm.so.6(GLIBC_2.0) is needed by xapi-xe-0.2-5181.i686
libpthread.so.0 is needed by xapi-xe-0.2-5181.i686
libpthread.so.0(GLIBC_2.0) is needed by xapi-xe-0.2-5181.i686
libpthread.so.0(GLIBC_2.1) is needed by xapi-xe-0.2-5181.i686
libpthread.so.0(GLIBC_2.2) is needed by xapi-xe-0.2-5181.i686
libpthread.so.0(GLIBC_2.3.2) is needed by xapi-xe-0.2-5181.i686
[root@cloudstack-ms ~]#
这时我们改用yum来安装,它会自动帮我们处理依赖问题
yum install xe-cli-6.1.0-59235p.i686.rpm
安装好后,执行xe命令如果报错
Unhandled exception
File "stunnel.ml", line 137,characters 20-25: Pattern matching failed
这时需要安装stunnel包,使用如下命令安装
yum install stunnel
都安装好后,可以正常执行xe命令,基本用法如下
xe -s ip -u username -pw password command param -s选项指明xenserver服务器的IP地址 -u选项指明XenServer服务器的用户名 -pw选项指明用户密码 command是xe子命令,如host-list等 param是命令的参数,如uuid=xxxxx等
xe -s 192.168.99.156 -u root -pw test host-list