1. 程式人生 > >kvm-ovirt-vdsm安裝記錄

kvm-ovirt-vdsm安裝記錄

小技巧:

1、fedaro 19自動查詢最快yum源

yum install yum-fastestmirror

2、libvirt啟動sasl新增使用者
saslpasswd2 -c -a libvirt admin

3、檢視kvm模組
lsmod|grep kvm

載入模組

modprobe kvm

編譯ovirt和vdsm步驟:

Ovirt-engine安裝
1、yum install postgresql-server jboss-as yum-plugin-versionlock xmlrpc-client ws-commons-util springframework-tx springframework-jdbc springframework-instrument springframework-expression springframework-context springframework-beans springframework-aop spring-ldap quartz postgresql-jdbc objectweb-asm jakarta-commons-httpclient apache-sshd apache-commons-jxpath apache-commons-configuration apache-commons-compress(可選步驟,供支援yum安裝ovirt-engine) 

2、yum install postgresql openssl python-m2crypto m2crypto python-psycopg2 psycopg python-cheetah cheetah libxml2-python libxml2 python-daemon pyflakes python-pep8 pep8 (根據README.developer中安裝必須和可選)

3、http://resources.ovirt.org/releases/nightly/rpm/Fedora/19/noarch/ (根據版本選擇)下載otopi-1.2.0-master和ovirt-host-deploy-1.2.0-master,並安裝。

4、配置資料庫/var/lib/pgsql/data/pg_hba.conf修改host all all trust,systemctl restart postgreqsl。(沒有配置檔案就進行資料庫初始化service postgresql initdb)
psql –U postgres –d postgres –h 127.0.0.1
alter user postgres with password ‘postgres’;
/var/lib/pgsql/data/pg_hba.conf修改host all all md5,systemctl restart postgreqsl
su - postgres -c "psql -d template1"
template1=# create user engine password 'engine';
template1=# drop database engine;
template1=# create database engine owner engine template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
普通使用者根目錄下建立.pgpass,寫入*:*:*:engine:engine;

全部是普通使用者操作:
5、yum install git, git clone git://gerrit.ovirt.org/ovirt-engine,chmod –R 777 ovirt-engine(修改原始碼/ovirt-engine/Makefile中的MAVEN_OPTS 設定-XX:MaxPermSize=1536m或者shell中export MAVEN_OPTS=-Xms512m -Xmx1024m -XX:PermSize=512m -XX:MaxPermSize1536m)

6、make clean install-dev PREFIX="$HOME/ovirt-engine" (DEV_EXTRA_BUILD_FLAGS_GWT_DEFAULTS="-Dgwt.userAgent=gecko1_8,safari" BUILD_GWT_WEBADMIN="1" BUILD_GWT_USERPORTAL="1" 參考http://www.ovirt.org/DebugFrontend)

7、$HOME/ovirt-engine/bin/engine-setup(--offline,可在sudo下執行,注意修改相關檔案可執行許可權)


8、$HOME/ovirt-engine/share/ovirt-engine/services/ovirt-engine/ovirt-engine.py start
(可以選擇部署成ovirt-engine服務,把$HOME/ovirt-engine/share/ovirt-engine/services/ovirt-engine/systemd相關的拷貝到系統服務目錄並配置,通過systemctl命令啟動服務)

9、https://localhost:8443
(如果要重新engine-setup需要先執行engine-cleanup)

vdsm安裝
1、yum install http://resources.ovirt.org/releases/ovirt-release-fedora-10-2.noarch.rpm
2、yum install make autoconf automake pyflakes logrotate gcc python-pep8 libvirt-python python-devel python-nose rpm-build sanlock-python genisoimage python-ordereddict python-pthreading libselinux-python python-ethtool m2crypto python-dmidecode python-netaddr python-inotify python-argparse git python-cpopen bridge-utils libguestfs-tools-c pyparted openssl
以下操作普通使用者模式:
3、git clone http://gerrit.ovirt.org/p/vdsm.git
4、./autogen.sh --system && ./configure  --enable-hooks && make rpm
5、cd ~/rpmbuild/RPMS
yum install --enablerepo=ovirt-beta x86_64/* noarch/vdsm-xml* noarch/vdsm-cli* noarch/vdsm-python-zombiereaper*
6、make; sudo make install(再編譯步驟)
7、vdsm-tool configure
8、systemctl start vdsmd


Troubleshooting:

問題1:yum安裝ovirt-engine配置資料庫時報錯。

Failed to execute stage 'Misc configuration': Command '/bin/systemctl' failed to execute
1)檢視錯誤資訊,日誌記錄在/var/log/ovirt-engine/setup/ovirt-engine-setup-xxxxxx.log
DEBUG otopi.plugins.otopi.services.systemd plugin.execute:446 execute-output: 
('/bin/systemctl', 'start', 'postgresql.service') stderr:
Job for postgresql.service failed. See 'systemctl status postgresql.service' 
and 'journalctl -xn' for details.
2)檢視postgresql服務狀態,systemctl status postgresql.service
DETAIL:Failed system call was shmget(key=5432001,size=43753472,03600).
3)vi /etc/sysctl.conf
kernel.shmmax = 83886080 (必須比size大)
4)sysctl -p 會輸出上一步設定
5)engine-setup
編譯安裝ovirt-engine 3.4錯誤記錄
注意:所有操作全部使用普通使用者,如果使用root可能會遇到很多問題
問題2:編譯遇到缺少otopi和ovirt-host-deploy
解決:http://resources.ovirt.org/releases/nightly/rpm/Fedora/19/noarch/下載rpm包安裝,版本均為1.2
問題3:編譯遇到Don't declare gwt-dev as a project dependency. This may introduce complex dependency conflicts
解決:忽略掉、、不用管,官方人員是這麼解釋的
問題4:編譯或者部署engine-setup許可權報錯
解決:修改git下載下來的ovirt-engine資料夾許可權,給予可執行許可權。
問題5:碰到websocket過不去
解決:http://resources.ovirt.org/releases/nightly/rpm/Fedora/19/noarch/下載ovirt-engine-websocket-proxy.rpm包安裝,依賴包同樣下載ovirt-engine-setup,ovirt-engine-lib,ovirt-engine-setup-plugin-websocket-proxy,注意時間要為同一天的包。
問題6:資料庫配置過不去,create_schema.sh報錯,檢視log發現密碼錯誤
解決:postgres的密碼配置全部為md5不要用trust,普通使用者下建.pgpass文字,寫入*:*:*:engine:engine。不要用自動配置資料庫,改用手動配置,資料庫賬戶密碼全部應該為engine。
問題7:找不到使用者ovirt和vdsm
解決:建立使用者ovirt和vdsm
groupadd ovirt -g 108,useradd ovirt -u 108 -g ovirt
groupadd kvm -g 36,useradd vdsm -u 36 -g kvm
問題8:報錯/bin/rpm
解決:部署使用離線模式 engine-setup --offline
問題9:報錯/bin/systemctl
解決:缺少服務,將ovirt-engine.systemd和ovirt-engine-notifier.systemd拷貝到/usr/lib/systemd/system目錄下,並將systemd改為service;將ovirt-engine.conf和ovirt-engine-notifier.conf按照各自的systemd文件修改名字放到/etc/sysconfig/下,預設使用者是ovirt啟動服務,要對應python許可權。
問題10:部署全部通過卻打不開網頁
解決:檢查並開啟jboss-as服務,普通使用者執行share/ovirt-engine/services/ovirt-engine/ovirt-engine.py start,修改共享記憶體檢視問題1,預設路徑是https://127.0.0.1:8443,路徑要輸全。
問題11:配置NFS配置不上
解決:nfs伺服器建vdsm使用者:groupadd kvm -g 36,useradd vdsm -u 36 -g kvm,
     共享資料夾如/images:chmod 0755 /images,chown 36:36 /images,
     安裝nfs:yum install nfs-utils,
     配置nfs:vi /etc/exports
     /images *(rw,sync,no_subtree_check,all_squash,anonuid=36,anongid=36),
     開啟服務:systemctl start rpcbind,systemctl start nfs,systemctl start nfs-lock
     開機啟動:systemctl enable rpcbind,systemctl enable nfs,systemctl enable nfs-lock
     vdsm節點上/rhev目錄許可權:chown -R 36:36 /rhev
問題12:nfs掛載掛載點許可權成nobody
解決:nfsv4版本出現的問題,使用命令mount -t nfs -o vers=3 xxxx
     或者在/etc/bashrc中新增alias mount.nfs='mount -t nfs -o vers=3'
問題13:Not able to add a node to 3.4 Cluster in Ovirt 3.4 engine,vdsm不能連線ovirt-engine
解決:vi /etc/yum.repos.d/fedora-virt-preview.repo
[fedora-virt-preview]
name=Virtualization packages from Rawhide built for latest Fedora
baseurl=http://fedorapeople.org/groups/virt/virt-preview/fedora-$releasever/$basearch
enabled=1
skip_if_unavailable=1
gpgcheck=0

[fedora-virt-preview-debuginfo]
name=Fedora $releasever - $basearch - Debug
name=Virtualization packages from Rawhide built for latest Fedora - Debug
baseurl=http://fedorapeople.org/groups/virt/virt-preview/fedora-$releasever/debuginfo
enabled=0
skip_if_unavailable=1
gpgcheck=0

[fedora-virt-preview-source]
name=Virtualization packages from Rawhide built for latest Fedora - Source
baseurl=http://fedorapeople.org/groups/virt/virt-preview/fedora-$releasever/SRPMS
enabled=0
skip_if_unavailable=1
gpgcheck=0
yum update
檢視vdsm支援engine版本:vdsClient -s 0 getVdsCaps|grep cluster