CentOS 6.4安装OpenNebula

CentOS 6.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_auth1
one start
sunstone-server start

错误:
#cannot load such file -- sinatra
gem install sinatra
#cannot load such file -- builder
gem install builder1
sunstone-server start

错误:
#使用localhost:9869可以登录,但是使用IP地址不行
vim /etc/one/sunstone-server.conf
将:host: 127.0.0.1 修改为 :host:0.0.0.0

忘记oneadmin的默认密码
opennebula使用sha1来加密用户密码,所以我们使用sha1加密器加密123456并得到加密字符串,然后登录进数据库,在opennebula数据库中的user_pool表中记录了用户的信息,而且body字段中 间的数据即为对应用户的密码加密字符串。
我们用得到的加密字符串来替换user_pool表中用户名为oneadmin列的body字段中 间的数据。
然后修改/var/lib/one/.one/one_auth文件内容:oneadmin:123456
好了,这下就能用密码123456登陆了

相关推荐