首頁 > 軟體

CentOS 6.4安裝OpenNebula

2020-06-16 17:57:35

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登陸了

本文永久更新連結地址http://www.linuxidc.com/Linux/2015-07/120044.htm


IT145.com E-mail:sddin#qq.com