一、yum源配置

安装rhev-m需要配置RHEV-M、RHEV-H、Supplementary、JBoss四个源,这个实验的时候,我将其整合到了一个配置中。并将其保存到/etc/yum.repos.d/目录下。如下:

 1[root@rhevm ~]# wget http://classroom.example.com/materials/rhevm.repo  -P /etc/yum.repos.d/
 2# cat /etc/yum.repos.d/rhevm.repo
 3[RHEVMgr]
 4name=Red Hat Enterprise Virtualization Manager for RHEL 6
 5baseurl=http://content.example.com/rhev3.5/x86_64/dvd/rhel-6-server-rhevm-3.5-rpms/
 6enabled=1
 7gpgcheck=0
 8[RHEVHyp6]
 9name=Red Hat Enterprise Virtualization Hypervisor for RHEL 6
10baseurl=http://content.example.com/rhev3.5/x86_64/dvd/rhel-6-server-rhevh-rpms/
11enabled=1
12gpgcheck=0
13[RHEVHyp7]
14name=Red Hat Enterprise Virtualization Hypervisor for RHEL 7
15baseurl=http://content.example.com/rhev3.5/x86_64/dvd/rhel-7-server-rhevh-rpms/
16enabled=1
17gpgcheck=0
18[RHELSupp]
19name=Red Hat Enterprise Linux Server 6 Supplementary
20baseurl=http://content.example.com/rhel6.6/x86_64/Supplementary
21enabled=1
22gpgcheck=0
23[RHEVJBoss]
24name=Red Hat Enterprise Virtualization JBoss EAP 6.2
25baseurl=http://content.example.com/rhev3.5/x86_64/dvd/jb-eap-6-for-rhel-6-server-rpms/
26enabled=1
27gpgcheck=0

升级当前的软件包

1[root@rhevm ~]# yum update -y

二、rhev-m软件包安装及配置

1、安装相关包

1[root@rhevm ~]# yum -y install rhevm rhevm-dwh  rhevm-reports

其中后面两个包是rhevm报表页面使用的相关包。

2、使用engine-setup命令配置rhevm

这里使用–generate-answer生成自动应答文件,该文件的作用是一旦rhevm主机出现问题,可以通过该文件进行快速安装。

 1[root@rhevm ~]# engine-setup --help
 2Usage: /usr/bin/engine-setup
 3    --log=file
 4        write log to this file.
 5    --config=file
 6        Load configuration files.
 7    --config-append=file
 8        Load extra configuration files or answer file.
 9    --offline
10        Offline mode.
11    --generate-answer=file
12        Generate answer file.
13    --jboss-home=dir
14        Use this jboss.
15[root@rhevm ~]# engine-setup  --generate-answer=answer.txt
16[ INFO  ] Stage: Initializing
17[ INFO  ] Stage: Environment setup
18          --== PRODUCT OPTIONS ==--
19          Configure Engine on this host (Yes, No) [Yes]: //回车
20          Configure Data Warehouse on this host (Yes, No) [Yes]: //回车
21          Configure Reports on this host (Yes, No) [Yes]://回车
22          Configure WebSocket Proxy on this host (Yes, No) [Yes]: //回车
23          Do you want Setup to configure the firewall? (Yes, No) [Yes]: no
24          Host fully qualified DNS name of this server [rhevm.pod0.example.com]: //回车
25          --== DATABASE CONFIGURATION ==--
26          Where is the Reports database located? (Local, Remote) [Local]:
27          Setup can configure the local postgresql server automatically for the Reports to run. This may conflict with existing applications.
28          Would you like Setup to automatically configure postgresql and create Reports database, or prefer to perform that manually? (Automatic, Manual) [Automatic]:
29          Where is the DWH database located? (Local, Remote) [Local]:
30          Setup can configure the local postgresql server automatically for the DWH to run. This may conflict with existing applications.
31          Would you like Setup to automatically configure postgresql and create DWH database, or prefer to perform that manually? (Automatic, Manual) [Automatic]:
32          Where is the Engine database located? (Local, Remote) [Local]:
33          Setup can configure the local postgresql server automatically for the engine to run. This may conflict with existing applications.
34          Would you like Setup to automatically configure postgresql and create Engine database, or prefer to perform that manually? (Automatic, Manual) [Automatic]:
35          --== OVIRT ENGINE CONFIGURATION ==--
36          Engine admin password: //我这里使用的密码为redhat,所以这里提示为弱口令。后面还有report密码配置。
37          Confirm engine admin password:
38[WARNING] Password is weak: it is based on a dictionary word
39          Use weak password? (Yes, No) [No]: yes
40          Application mode (Virt, Gluster, Both) [Both]:
41………………省略
42          --== SYSTEM CONFIGURATION ==--
43          Configure an NFS share on this server to be used as an ISO Domain? (Yes, No) [Yes]: //ISO域配置,这里使用rhevm本机作为ISO域
44          Local ISO domain path [/var/lib/exports/iso]: /exports/rhevisos
45          Local ISO domain ACL - note that the default will restrict access to rhevm.pod0.example.com only, for security reasons [rhevm.pod0.example.com(rw)]:
46          Local ISO domain name [ISO_DOMAIN]: iso0
47//当上面的交互式完成后,会跳出配置确认信息,确认完成后,会进行安装。
48              http://rhevm.pod0.example.com:80/ovirt-engine  //web管理界面地址
49              https://rhevm.pod0.example.com:443/ovirt-engine
50          Please use the user "admin" and password specified in order to login
51          The following network ports should be opened:
52              tcp:111
53              tcp:2049
54              tcp:32803
55              tcp:443
56              tcp:5432
57              tcp:6100
58              tcp:662
59              tcp:80
60              tcp:875
61              tcp:892
62              udp:111
63              udp:32769
64              udp:662
65              udp:7410
66              udp:875
67              udp:892
68          An example of the required configuration for iptables can be found at:
69              /etc/ovirt-engine/iptables.example
70          --== END OF SUMMARY ==--
71[ INFO  ] Starting engine service
72[ INFO  ] Restarting httpd
73[ INFO  ] Starting dwh service
74[ INFO  ] Starting reports service
75[ INFO  ] Generating answer file 'answer.txt'
76[ INFO  ] Stage: Pre-termination
77[ INFO  ] Stage: Termination
78[ INFO  ] Execution of setup completed successfully

answer.txt自动应答文件内容如下:

 1[root@rhevm ~]# cat answer.txt
 2# action=setup
 3[environment:default]
 4OVESETUP_DIALOG/confirmSettings=bool:True
 5OVESETUP_CONFIG/applicationMode=str:both
 6OVESETUP_CONFIG/remoteEngineSetupStyle=none:None
 7OVESETUP_CONFIG/adminPassword=str:redhat
 8OVESETUP_CONFIG/storageIsLocal=bool:False
 9OVESETUP_CONFIG/firewallManager=none:None
10OVESETUP_CONFIG/remoteEngineHostRootPassword=none:None
11OVESETUP_CONFIG/updateFirewall=bool:False
12OVESETUP_CONFIG/remoteEngineHostSshPort=none:None
13OVESETUP_CONFIG/fqdn=str:rhevm.pod0.example.com
14OVESETUP_CONFIG/storageType=none:None
15OSETUP_RPMDISTRO/requireRollback=none:None
16OSETUP_RPMDISTRO/enableUpgrade=none:None
17OVESETUP_DB/database=str:engine
18OVESETUP_DB/fixDbViolations=none:None
19OVESETUP_DB/secured=bool:False
20OVESETUP_DB/host=str:localhost
21OVESETUP_DB/user=str:engine
22OVESETUP_DB/securedHostValidation=bool:False
23OVESETUP_DB/port=int:5432
24OVESETUP_ENGINE_CORE/enable=bool:True
25OVESETUP_CORE/engineStop=none:None
26OVESETUP_SYSTEM/memCheckEnabled=bool:True
27OVESETUP_SYSTEM/nfsConfigEnabled=bool:True
28OVESETUP_PKI/organization=str:pod0.example.com
29OVESETUP_CONFIG/isoDomainMountPoint=str:/exports/rhevisos
30OVESETUP_CONFIG/engineHeapMax=str:1024M
31OVESETUP_CONFIG/isoDomainName=str:iso0
32OVESETUP_CONFIG/isoDomainACL=str:rhevm.pod0.example.com(rw)
33OVESETUP_CONFIG/engineHeapMin=str:1024M
34OVESETUP_AIO/configure=none:None
35OVESETUP_AIO/storageDomainName=none:None
36OVESETUP_AIO/storageDomainDir=none:None
37OVESETUP_PROVISIONING/postgresProvisioningEnabled=bool:True
38OVESETUP_APACHE/configureRootRedirection=bool:True
39OVESETUP_APACHE/configureSsl=bool:True
40OVESETUP_DWH_CORE/enable=bool:True
41OVESETUP_DWH_DB/database=str:ovirt_engine_history
42OVESETUP_DWH_DB/secured=bool:False
43OVESETUP_DWH_DB/host=str:localhost
44OVESETUP_DWH_DB/disconnectExistingDwh=none:None
45OVESETUP_DWH_DB/restoreBackupLate=bool:True
46OVESETUP_DWH_DB/user=str:ovirt_engine_history
47OVESETUP_DWH_DB/securedHostValidation=bool:False
48OVESETUP_DWH_DB/performBackup=none:None
49OVESETUP_DWH_DB/password=str:TFNnxG7K0VVjB5j8UAqCyv
50OVESETUP_DWH_DB/port=int:5432
51OVESETUP_DWH_PROVISIONING/postgresProvisioningEnabled=bool:True
52OVESETUP_DB/password=str:PbyuIlmT5nj41REY2QCdJB
53OVESETUP_REPORTS_CORE/enable=bool:True
54OVESETUP_REPORTS_CONFIG/heapMin=str:1024M
55OVESETUP_REPORTS_CONFIG/adminPassword=str:redhat
56OVESETUP_REPORTS_CONFIG/heapMax=str:1024M
57OVESETUP_REPORTS_DB/database=str:ovirt_engine_reports
58OVESETUP_REPORTS_DB/secured=bool:False
59OVESETUP_REPORTS_DB/host=str:localhost
60OVESETUP_REPORTS_DB/user=str:ovirt_engine_reports
61OVESETUP_REPORTS_DB/securedHostValidation=bool:False
62OVESETUP_REPORTS_DB/password=str:mqJgjXh1N6VK781f4L3nhS
63OVESETUP_REPORTS_DB/port=int:5432
64OVESETUP_REPORTS_PROVISIONING/postgresProvisioningEnabled=bool:True
65OVESETUP_ENGINE_CONFIG/fqdn=str:rhevm.pod0.example.com
66OVESETUP_RHEVM_SUPPORT/redhatSupportProxyPort=none:None
67OVESETUP_RHEVM_SUPPORT/redhatSupportProxy=none:None
68OVESETUP_RHEVM_SUPPORT/redhatSupportProxyUser=none:None
69OVESETUP_RHEVM_SUPPORT/configureRedhatSupportPlugin=bool:False
70OVESETUP_RHEVM_SUPPORT/redhatSupportProxyPassword=none:None
71OVESETUP_RHEVM_SUPPORT/redhatSupportProxyEnabled=bool:False
72OVESETUP_RHEVM_DIALOG/confirmUpgrade=bool:True
73OVESETUP_CONFIG/websocketProxyConfig=bool:True

3、查看默认iso域文件

 1[root@rhevm ~]# showmount -e localhost
 2Export list for localhost:
 3/exports/rhevisos *
 4[root@rhevm ~]# tree /exports/rhevisos/
 5/exports/rhevisos/
 6└── 8e63ca2a-b4ce-4506-a56c-aaede9fcccd2
 7    ├── dom_md
 8    │   ├── ids
 9    │   ├── inbox
10    │   ├── leases
11    │   ├── metadata
12    │   └── outbox
13    └── images
14        └── 11111111-1111-1111-1111-111111111111
15            ├── rhev-tools-setup.iso
16            ├── virtio-win_amd64.vfd
17            ├── virtio-win.iso
18            └── virtio-win_x86.vfd
194 directories, 9 files

iso域images下的几个文件是为安装windows时使用,还需要注意的是/exports/rhevisos目录的属主和属组是vdsm:kvm,用户id和组id为36 。这些文件属如下两个包:

1[root@rhevm ~]# rpm -qf /usr/share/rhev-guest-tools-iso/rhev-tools-setup.iso
2rhev-guest-tools-iso-3.5-9.el6ev.noarch
3[root@rhevm ~]# rpm -qf /usr/share/virtio-win/virtio-win.iso
4virtio-win-1.7.2-2.el6.noarch

4、rhevm web登陆

安装配置完成后,rhevm web界面如下:

rhevm-web

rhev3.5版本下的web界面是支持中文的,不过由于rh318的官方教材未提供中文版, 所认这里也选择英文界面。

三、rhev-m的个性化配置相关

1、检查版本升级

1[root@rhevm ~]# engine-upgrade-check

2、配置外部认证

这时使用外部IPA认证,配置完成后需要重启ovirt-engine服务

1[root@rhevm ~]# engine-manage-domains add --domain=example.com --user=rhevadmin --provider=ipa
2[root@rhevm ~]# engine-manage-domains list
3Domain: example.com
4    User name: [email protected]
5Manage Domains completed successfully
6[root@rhevm ~]# /etc/init.d/ovirt-engine restart

使用内部的admin用户登陆后,点击右上角的Configure配置项,选择System Permissions并点击Add选项增加相应的用户,如下:

rhevm-ipa-adduser

3、重置密码

可以通过engine-config命令重置内部认证的admin用户的密码,如下:

1[root@rhevm ~]# engine-config -a|grep -i adminpassword  //-a参数是查看所有配置项
2LocalAdminPassword: Set version: general
3AdminPassword: Set version: general
4[root@rhevm ~]# engine-config -s AdminPassword=interactive  //-s参数是设置相关选项的值
5Please enter a password:
6Please reenter password:
7[root@rhevm ~]# /etc/init.d/ovirt-engine restart
8Stopping oVirt Engine:                                     [  OK  ]
9Starting oVirt Engine:                                     [  OK  ]

4、时间相关项设置

其中session选项是web界面多就不操作就自动操时,单位是分钟 。使用-a选择与-g选择都

1[root@rhevm ~]# engine-config -a|grep -i session
2UserSessionTimeOutInterval: 30 version: general
3[root@rhevm ~]# engine-config -g UserSessionTimeOutInterval  //使用-g选项时,后面的参数部分一定要使用全
4UserSessionTimeOutInterval: 30 version: general
5[root@rhevm ~]# engine-config -a|grep -i ServerReboot
6ServerRebootTimeout: 300 version: general

ServerRebootTimeout时间是ovirt-engine服务重启后的操时时间。为安全考虑和避免等待过久时长,我们可以将session时间设置为2分钟,将ServerRebootTimeout时间设置为90秒:

1[root@rhevm ~]# engine-config -s UserSessionTimeOutInterval=2
2[root@rhevm ~]# engine-config -s ServerRebootTimeout=90
3[root@rhevm ~]# /etc/init.d/ovirt-engine restart

5、日志收集

通过engine-log-collector命令可以收集群或数据中心的相关日志,便于问题分析(实际调用的也是sosreport指令)

1engine-log-collector  [options] list [all,clusters,datacenters]
2engine-log-collector  [options] collect

如下使用list查看相关信息时的情况:

 1[root@rhevm ~]# engine-log-collector  list
 2This command will collect system configuration and diagnostic
 3information from this system.
 4The generated archive may contain data considered sensitive and its
 5content should be reviewed by the originating organization before
 6being passed to any third party.
 7No changes will be made to system configuration.
 8Please provide the REST API password for the admin@internal oVirt Engine user (CTRL+D to skip): //此处会让输入密码
 9Host list (datacenter=None, cluster=None, host=None):
10Data Center          | Cluster              | Hostname/IP Address
11center0              | cluster0             | 172.25.0.10

注:engine命令在进行REST API 调用时都需要输入密码,可以通过在/etc/ovirt-engine/目录下的相关配置文件中配置后,在执行相关命令时,则无需输入密码直接返回结果 。

四、rhev-m的卸载与重装

1、rhev-m 清理与卸载

1# engine-cleanup
2# yum remove rhevm* vdsm-bootstrap *jboss* postgresql-server
3# echo "">/etc/exports
4# service nfs restart

2、重装与恢复

重装时需要先yum安装相关软件包,再通过engine-config按照之间的answer.txt文件进行恢复之前的安装配置。安装完成后,使用postgresql-server数据库备份恢复---所有rhev-m 内的数据中心、集群、网络、主机、虚拟机、外部认证等都是存储在数据库中的。

1# engine-setup   --config-append=answer.txt

rhev-m在使用物理机时,最好需要两台之间做HA或把数据库单独做一台。当然rhev-m也可以是rhev-h内的一台虚拟机,在其中某台rhev-h物理机出现鼓掌时,可以通过rhev内部的HA机制漂移到其他主机上,继续提供服务。