ovirt-engine安裝

1、安裝

一、更新系統

原來是centos4.5html

#yum update

升級後到6.7版本。java

[root@localhost ~]# cat /etc/redhat-release 
CentOS release 6.7 (Final)

二、新建用戶

#adduser liuxiaoyan
#passwd liuxiaoyan

三、安裝snapshot庫(root用戶)

[root@localhost ~]# yum -y install http://resources.ovirt.org/releases/ovirt-release/ovirt-release35.rpm

四、安裝圖形顯示包(root用戶)

[root@localhost ~]# yum -y install mailcap

五、安裝第三方包(3rd party packages)(root用戶)

[root@localhost ~]# yum install openssl m2crypto python-psycopg2 python-cheetah python-daemon libxml2-python unzip

應該是若是不成功再安裝下面安裝辦法裝。--nogpgcheck表明不檢查簽名。python

# yum install python-daemon (--nogpgcheck)

六、安裝jdk(root用戶)

[root@localhost ~]# yum install -y java-1.7.0-openjdk-devel

七、安裝git

[root@localhost ~]# yum install -y git

八、安裝ovirt包

[root@localhost ~]# yum install wgetlinux

[root@localhost ~]# yum install ovirt-host-deploy  git

安裝時遇到一個問題:github

[root@localhost ~]# yum install -y ovirt-host-deploy 
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.skyshe.cn
 * extras: mirrors.skyshe.cn
 * ovirt-3.5-epel: mirror01.idc.hinet.net
 * ovirt-3.5-jpackage-6.0-generic: ftp.heanet.ie
 * ovirt-3.5-pre: resources.ovirt.org
 * updates: mirrors.skyshe.cn
Resolving Dependencies
--> Running transaction check
---> Package ovirt-host-deploy.noarch 0:1.3.2-1.el6 will be installed
--> Processing Dependency: otopi for package: ovirt-host-deploy-1.3.2-1.el6.noarch
--> Finished Dependency Resolution
Error: Package: ovirt-host-deploy-1.3.2-1.el6.noarch (ovirt-3.5-pre)
           Requires: otopi
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

因此用--skip-broken跳過該問題。sql

[root@localhost ~]# yum install -y ovirt-host-deploy --skip-broken
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: mirrors.skyshe.cn
 * extras: mirrors.skyshe.cn
 * ovirt-3.5-epel: mirror01.idc.hinet.net
 * ovirt-3.5-jpackage-6.0-generic: ftp.heanet.ie
 * ovirt-3.5-pre: resources.ovirt.org
 * updates: mirrors.skyshe.cn
Resolving Dependencies
--> Running transaction check
---> Package ovirt-host-deploy.noarch 0:1.3.2-1.el6 will be installed
--> Processing Dependency: otopi for package: ovirt-host-deploy-1.3.2-1.el6.noarch

Packages skipped because of dependency problems:
    ovirt-host-deploy-1.3.2-1.el6.noarch from ovirt-3.5-pre

跳過了這個問題。數據庫

[root@localhost ~]# yum install http://resources.ovirt.org/releases/ovirt-release/ovirt-release35-snapshot.rpm

九、安裝maven (liuxiaoyan用戶)

在https://maven.apache.org/download.cgi目錄下載apache-maven-3.3.3-bin.tar.gz。apache

而後解壓。centos

[liuxiaoyan@localhost ~]$ tar -xvf apache-maven-3.3.3-bin.tar.gz 
[liuxiaoyan@localhost ~]$ export PATH=$HOME/apache-maven-3.3.3/bin:$PATH
[liuxiaoyan@localhost ~]$ mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
Maven home: /home/liuxiaoyan/apache-maven-3.3.3
Java version: 1.7.0_85, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-358.el6.x86_64", arch: "amd64", family: "unix"

Maven 自定義配置

[liuxiaoyan@localhost ~]$ mkdir ~/.m2

[liuxiaoyan@localhost ~]$ cat > ~/.m2/settings.xml <<"EOT"
<settings xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                              http://maven.apache.org/xsd/settings-1.0.0.xsd">
            
<!--**************************** PROFILES ****************************-->

        <activeProfiles>
                        <activeProfile>oVirtEnvSettings</activeProfile>
        </activeProfiles>

        <profiles>
                <profile>
                        <id>oVirtEnvSettings</id>
                        <properties>                               
                           <jbossHome>${env.JBOSS_HOME}</jbossHome>
                           <JAVA_HOME>${env.JAVA_HOME}</JAVA_HOME>
                        </properties>
                </profile>
         </profiles>
</settings>
EOT

十、安裝jboss(root用戶)

安裝:

[root@localhost ~]# yum install jboss-as

下載很是慢,可到http://resources01.phx.ovirt.org/releases/stable/rpm/EL/6/x86_64/

下載

而後安裝:

[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog  jboss-as-7.1.1-11.el6.x86_64.rpm
[root@localhost ~]# rpm -ivh jboss-as-7.1.1-11.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
   1:jboss-as               ########################################### [100%]

運行jboss

[root@localhost ~]# /usr/share/jboss-as/bin/standalone.sh

設置環境變量

[root@localhost ~]# export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk.x86_64
[root@localhost ~]# export JBOSS_HOME=/usr/share/jboss-as
[root@localhost ~]# export PATH=$HOME/apache-maven-3.2.1/bin:$PATH

十一、安裝PostgreSQL DB (root用戶)

[root@localhost ~]# yum install –y postgresql-server

初始化數據庫

[root@localhost ~]# service postgresql initdb
Initializing database:                                     [  OK  ]

重啓

[root@localhost ~]# /etc/init.d/postgresql restart
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]

修改數據庫鏈接

[root@localhost ~]# vi /var/lib/pgsql/data/pg_hba.conf 

默認:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               ident
# IPv4 local connections:
host    all         all         127.0.0.1/32          ident
# IPv6 local connections:
host    all         all         ::1/128               ident

作以下修改:【ps:若是後期有問題,可將ident,password,password都修改成trust】

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               ident
# IPv4 local connections:
host    all         all         127.0.0.1/32          password
# IPv6 local connections:
host    all         all         ::1/128               password

重啓:# /etc/init.d/postgresql restart

若是重啓失敗解決方案可參考:service postgresql initdb [FAILED]

建立數據庫

[root@localhost data]# su - postgres -c "psql -d template1 -c \"create user engine password 'engine';\""
CREATE ROLE
[root@localhost data]# su - postgres -c "psql -d template1 -c \"create database engine owner engine template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';\""
CREATE DATABASE

十二、下載ovirt engine代碼

cd $HOME
$ git clone https://github.com/oVirt/ovirt-engine.git

1三、編譯(必須在ovirt-engine目錄下)

make install-dev PREFIX="$HOME/ovirt-engine"

1四、Setup

$ $HOME/ovirt-engine/bin/engine-setup

1五、啓動服務

$HOME/ovirt-engine/share/ovirt-engine/services/ovirt-engine/ovirt-engine.py start

2、排錯

一、編譯過程排錯

錯誤1:

編譯報錯以下

Building locales requires more than 10240 available file descriptors, currently 1024
Refer to README.developer for further instructions

解決辦法:

查看README.developer中

$ vi README.developer 

有以下一段話;

Build locales requires at least 10240 file descriptors, create the
following file, replace <user> with user that is used for building,
and logout/login:

/etc/security/limits.d/10-nofile.conf
---
<user> hard nofile 10240
#<user> soft nofile 10240  # optional, to apply automatically
---

If soft limit was not set, before building, apply new limit using:

 $ ulimit -n 10240

POSTGRESQL ACCESSIBILITY

普通用戶執行ulimit –n 10240會報錯:-bash: ulimit: open files: cannot modify limit: Operation not permitted

因此使用Root su到普通用戶再執行ulimit -n 10240,這會使得僅僅在某個會話中生效,在該會話中編譯經過。

若是仍是不能解決問題參考README.developer中的提示。

錯誤2:

make[2]: mvn: Command not found

make[2]: *** [maven] Error 127

解決辦法:

執行:

[liuxiaoyan@localhost ~]$ export PATH=$HOME/apache-maven-3.3.3/bin:$PATH 

再執行mvn -version能顯示版本信息即oK。

錯誤3:

編譯過程當中下載maven-ear-plugin-2.8.pom包一個下載不下來,而後就再次嘗試下載。。。編譯過不去,信息以下

Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-ear-plugin/2.8/maven-ear-plugin-2.8.pom

Aug 31, 2015 9:37:09 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute

INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://repo1.maven.org:80: Connection timed out

Aug 31, 2015 9:37:09 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute

INFO: Retrying request to {}->http://repo1.maven.org:80

Aug 31, 2015 9:54:14 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute

INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://repo1.maven.org:80: Connection timed out

Aug 31, 2015 9:54:14 PM org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec execute

INFO: Retrying request to {}->http://repo1.maven.org:80    

解決辦法:      

下載好安裝在目錄:

.m2/repository/org/apache/maven/plugins/maven-ear-plugin/2.8/maven-ear-plugin-2.8.pom中,因此能夠拷貝一份扔進去。

如今下載了一部分時目錄是這樣的:

[liuxiaoyan@localhost 2.8]$ ls

maven-ear-plugin-2.8.pom.part  maven-ear-plugin-2.8.pom.part.lock

拷貝這些文件:
[liuxiaoyan@localhost 2.8]$ ls

maven-ear-plugin-2.8.jar  maven-ear-plugin-2.8.jar.sha1  maven-ear-plugin-2.8.pom  maven-ear-plugin-2.8.pom.sha1  _remote.repositories

從新編譯OK。

二、SetUP過程排錯

錯誤1:

[liuxiaoyan@localhost bin]$ ./engine-setup

./engine-setup: line 81: /usr/sbin/otopi: No such file or directory

解決方法:

拷貝一個otopi文件便可(長久考慮,有多是由於沒裝otopi這個包,安裝便可)。

錯誤2:

[liuxiaoyan@localhost bin]$ ./engine-setup

/usr/bin/python: No module named otopi

解決方法:

[root@localhost ~]# yum -y install otopi

錯誤3:

[liuxiaoyan@localhost bin]$ ./engine-setup

***L:ERROR Internal error: No module named psycopg2

解決方法:

[root@localhost ~]# yum -y install python-psycopg2

錯誤4:

[ ERROR ] Host name is not valid: Command 'dig' is required but missing

          Host fully qualified DNS name of this server [localhost.localdomain]: 10.1.101.51

[ ERROR ] Host name is not valid: 10.1.101.51 is an IP address and not a FQDN. A FQDN is needed to be able to generate certificates correctly.

          Host fully qualified DNS name of this server [localhost.localdomain]:                      

解決方法:

在/etc/hosts中綁定IP和名字,以下:

10.1.101.119 engine //這裏的engine是hostname

錯誤5:

[ ERROR ] Host name is not valid: Command 'dig' is required but missing

          Host fully qualified DNS name of this server [engine]: engine

解決辦法:

# yum -y install bind-utils

錯誤6:

[ ERROR ] Cannot connect to Engine database: Cannot connect to database: could not connect to server: Connection refused        Is the server running on host "localhost" and accepting         TCP/IP connections on port 5432? could not connect to server: Connection refused       Is the server running on host "localhost" and accepting         TCP/IP connections on port 5432?

解決辦法:

Root用戶執行:

[root@engine ~]# /etc/init.d/postgresql restart

Stopping postgresql service:                               [  OK  ]

Starting postgresql service:                               [  OK  ]

錯誤7:

[ ERROR ] Cannot connect to Engine database: Cannot connect to database: FATAL:  password authentication failed for user "engine" FATAL:  password authentication failed for user "engine"

解決方法:

修改vi  /var/lib/pgsql/data/pg_hba.conf

中的密碼爲trust便可。

在編譯目錄ovirt-engine/etc/ovirt-engine/engine.conf.d中有一個README
vi /home/liuxiaoyan/ovirt-engine/share/ovirt-engine/services/ovirt-engine/ovirt-engine.conf

多是相關配置文件。

三、start過程排錯

錯誤1:

……/ovirt-engine.py start訪問報錯:

http://10.1.101.119:8080/

解決辦法:

Root用戶關閉防火牆便可。

[root@engine ~]# /etc/init.d/iptables stop

iptables: Setting chains to policy ACCEPT: filter          [  OK  ]

iptables: Flushing firewall rules:                         [  OK  ]

iptables: Unloading modules:                               [  OK  ]

錯誤2:                             

界面樣式錯亂

解決方法:

有些rpm包沒有安裝。

最主要的是一個patternfly1的包沒有裝。

經過# yum -y install patternfly1安裝便可。

若是不行將全部未安裝的包都安裝一遍,具體參考項目目錄下的README.developer。

安裝pyflakes-0.4.0-2.el6.noarch

從下面地址下載pyflakes-0.4.0-2.el6.noarch

http://cbs.centos.org/koji/buildinfo?buildID=753 

錯誤3:

[liuxiaoyan@engine ovirt-engine]$ $HOME/ovirt-engine/share/ovirt-engine/services/ovirt-engine/ovirt-engine.py start

ERROR: transport error 202: bind failed: Address already in use

ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)

JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:750]

FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)

ovirt-engine[22588] ERROR run:532 Error: process terminated with status code -6

解決辦法:

有進程在用8080端口,kill掉便可。

使用ps –a或者netstat命令。 

錯誤4:

解決辦法:
root用戶執行:/usr/share/jboss-as/bin/standalone.sh啓動jboss服務便可。

錯誤5:

登陸時用戶名密碼驗證失敗,刪掉數據庫,從新建一遍

解決辦法:

刪除數據庫engine而後從新建立。

【若是數據庫正在被使用就沒法刪除,此時在root用戶下用命令:ps aux|grep engine而後kill掉】
su - postgres -c "psql -d template1 -c \"drop database engine ;\""
su - postgres -c "psql -d template1 -c \"create database engine owner engine template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';\""

錯誤6:

若是出現服務器的鏈接不上的狀況,多是端口被佔用了。

解決辦法:

找到8080端口,kill掉進程,而後從新start便可。

 

本文做者starof,因知識自己在變化,做者也在不斷學習成長,文章內容也不定時更新,爲避免誤導讀者,方便追根溯源,請諸位轉載註明出處:http://www.cnblogs.com/starof/p/4772890.html有問題歡迎與我討論,共同進步。

相關文章
相關標籤/搜索