Centos6.4安装opennebula
#安装163源
http://mirrors.163.com/.help/CentOS6-Base-163.repo
#安装epel源
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
yum localinstall epel-*
#验证查看是否成功安装:
yum repolist
#安装numpy(须要python-devel)
地址:http://www.scipy.org/scipylib/download.html
#解压之后cd进入
python setup.py install
#opennebula 官网下载安装包
地址:http://opennebula.org/software/
cd  opennebula-4.12.1-1
yum localinstall opennebula-ruby-4.12.1-1.x86_64.rpm
错误:
Error: Package: opennebula-ruby-4.12.1-1.x86_64 (/opennebula-ruby-4.12.1-1.x86_64)
           Requires: rubygem-sqlite3-ruby
Error: Package: opennebula-ruby-4.12.1-1.x86_64 (/opennebula-ruby-4.12.1-1.x86_64)
           Requires: rubygem-uuidtools
Error: Package: opennebula-ruby-4.12.1-1.x86_64 (/opennebula-ruby-4.12.1-1.x86_64)
           Requires: ruby-mysql
Error: Package: opennebula-ruby-4.12.1-1.x86_64 (/opennebula-ruby-4.12.1-1.x86_64)
           Requires: rubygem-sequel
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest
解决方式:
yum install ruby ruby-devel rubygems
gem install rack
gem install sqlite3-ruby
这里依旧是各种失败,后来发现是yum自己主动安装的ruby的版本号过低。又一次安装高版本号ruby
yum remove ruby
https://www.ruby-lang.org/en/downloads处下载ruby
tar zxvf ruby-2.2.2-tar.gz
cd ruby-2.2.2
./configure --with-openssl-dir=/usr/lib/openssl
make
make install
cd  opennebula-4.12.1-1
yum localinstall opennebula-ruby-4.12.1-1.x86_64.rpm 
yum localinstall opennebula-common-4.12.1-1.x86_64.rpm 
yum localinstall opennebula-4.12.1-1.x86_64.rpm
yum localinstall opennebula-sunstone-4.12.1-1.x86_64.rpm 
yum localinstall opennebula-server-4.12.1-1.x86_64.rpm 
yum localinstall opennebula-java-4.12.1-1.x86_64.rpm 
yum localinstall opennebula-gate-4.12.1-1.x86_64.rpm 
yum localinstall opennebula-flow-4.12.1-1.x86_64.rpm 
yum localinstall opennebula-debuginfo-4.12.0-1.x86_64.rpm
yum localinstall opennebula-node-kvm-4.12.0-1.x86_64.rpm 

vi /etc/sysconfig/selinux
#改动
SELINUX = disabled
setenforce 0
getenforce 
#显示Permissive
systemctl stop  iptables 
#在centos6.4下systemctl命令不存在,我们用chkconfig取代
chkconfig iptables off

vim /etc/one/oned.conf
#取消mysql的凝视
DEFAULT_DEVICE_PREFIX = "vd"

# Sample configuration for MySQL(mariadb)
DB = [ backend = "mysql",
       server  = "localhost",
       port    = 0,
       user    = "oneadmin",
       passwd  = "oneadmin",
       db_name = "opennebula" ]

/etc/init.d/mysqld start
#下面数据库设置參考
mysql -u root -p
#In mysql
/*GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin' IDENTIFIED BY 'oneadmin';*/
上面是官网设置。我发现有问题,要依照例如以下设置:
GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin'@'localhost' IDENTIFIED BY 'oneadmin'
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;
exit;

su oneadmin
one start
错误:
#Oned failed to start /usr/bin/one:line 117 14118 Terminated
rm -I /var/lib/one/.one/sunstone_auth onegate_auth oneflow_auth occi_auth ec2_auth
one start
sunstone-server start
错误:
#cannot load such file -- sinatra
gem install sinatra
#cannot load such file -- builder
gem install builder
sunstone-server start
错误:
#使用localhost:9869能够登录,可是使用IP地址不行
vim /etc/one/sunstone-server.conf
将:host: 127.0.0.1 改动为 :host:0.0.0.0
#[VirtualMachinePoolInfo] User couldn't be authenticated, aborting call
这是由于在web页面上改动了登录password,可是此更新没有同步到/var/lib/one/.one/one_auth,须要将新password写入到该配置文件里就可以。若该文件权限不正确则也会报错。

忘记oneadmin的默认password
opennebula默认的password是在/var/lib/one/.one/one_auth中。


opennebula使用sha1来加密用户password。所以我们使用sha1加密器加密123456并得到加密字符串,然后登录进数据库,在opennebula数据库中的user_pool表中记录了用户的信息,并且body字段中 间的数据即为相应用户的password加密字符串。


我们用得到的加密字符串来替换user_pool表中username为oneadmin列的body字段中 间的数据。
然后改动/var/lib/one/.one/one_auth文件内容:oneadmin:123456
好了。这下就能用password123456登陆了