CentOS7 minimal ovirt engine 开发环境搭建

注:列出软件包信息:yum info 名字

  1. 关闭firewall 和 selinux

  2. 添加源epel-方法二
    注:添加之前请看Bug 1572434

  3. 添加源ovirt(自动,2 3任选一个)
    yum install http://resources.ovirt.org/pub/yum-repo/ovirt-release42.rpm
    注:这个源目前是ovirt-release42-4.2.2-6版本的
    注:根据需求选择源

    image.png

  4. 添加源ovirt(手动)
    vi /etc/yum.repos.d/ovirt-snapshots.repo

[ovirt-snapshots]
name=local
baseurl=http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/el$releasever
enabled=1
gpgcheck=0
priority=10

[ovirt-snapshots-static]
name=local
baseurl=http://resources.ovirt.org/pub/ovirt-master-snapshot-static/rpm/el$releasever
enabled=1
gpgcheck=0
priority=10
  1. 安装包

yum install -y pyflakes exportfs python-cheetah git java-devel java-1.8.0-openjdk-devel mailcap unzip openssl bind-utils python-dateutil m2crypto python-psycopg2 python-jinja2 libxml2-python python-daemon maven ansible python-flake8 python-pep8 python-docker-py python2-isort otopi ant

版本
ansible-2.5.2-1.el7.noarch
openssl-1.0.2k-8.el7.x86_64
ant-1.9.2-9.el7.noarch
unzip-6.0-16.el7.x86_64
git-1.8.3.1-12.el7_4.x86_64
python-cheetah-2.4.4-5.el7.centos.x86_64
python-dateutil-2.4.2-1.el7.noarch
pyflakes-1.3.0-2.el7.noarch
python-jinja2-2.7.2-2.el7.noarch
python-psycopg2-2.5.1-3.el7.x86_64
python-daemon-1.6-4.el7.noarch
python-docker-py-1.10.6-3.el7.noarch
m2crypto-0.21.1-17.el7.x86_64
java-1.8.0-openjdk-devel-1.8.0.161-0.b14.el7_4.x86_64
otopi-1.7.7-1.el7.centos.noarch
python-pep8-1.5.7-2.el7.noarch #这个版本很重要
maven-3.0.5-17.el7.noarch
python2-isort-4.2.5-8.el7.noarch
libxml2-python-2.9.1-6.el7_2.3.x86_64
python-flake8-2.0-5.el7.noarch
mailcap-2.1.41-2.el7.noarch
bind-utils-9.9.4-51.el7_4.2.x86_64 #这个版本不知道重不重要,但是改到过这个版本

yum install -y ovirt-ansible-roles ovirt-engine-metrics ovirt-host-deploy ovirt-js-dependencies ovirt-setup-lib ovirt-engine-wildfly ovirt-engine-wildfly-overlay

版本
ovirt-engine-metrics-1.1.4.2-1.el7.centos.noarch
ovirt-host-deploy-1.7.3-1.el7.centos.noarch
ovirt-js-dependencies-1.2.0-3.1.el7.centos.noarch
ovirt-ansible-roles-1.1.4-1.el7.centos.noarch
ovirt-setup-lib-1.1.4-1.el7.centos.noarch
ovirt-engine-wildfly-11.0.0-1.el7.centos.x86_64
ovirt-engine-wildfly-overlay-11.0.1-1.el7.centos.noarch
  • 数据库
  1. 安装 postgresql 9.5
    yum localinstall https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-3.noarch.rpm
    yum -y install postgresql95-server postgresql95-contrib
  2. 初始化
    /usr/pgsql-9.5/bin/postgresql95-setup initdb
  3. 配置
    vi /var/lib/pgsql/9.5/data/pg_hba.conf
# IPv4 local connections:
host    all             all             127.0.0.1/32            password
# IPv6 local connections:
host    all             all             ::1/128                 password
  1. 配置
    vi /var/lib/pgsql/9.5/data/postgresql.conf
autovacuum_vacuum_scale_factor = 0.01
autovacuum_analyze_scale_factor = 0.075
autovacuum_max_workers = 6
max_connections = 150
work_mem = 8MB
  1. 重启
    systemctl restart postgresql-9.5.service
    systemctl enable postgresql-9.5.service
  2. 创建数据库

su - postgres -c "psql -d template1 -c \"create user engine with login password 'engine' SUPERUSER;\""

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';\""

  1. 用角色engine登录数据库engine

  2. 执行数据库执行

DROP FUNCTION IF EXISTS uuid_generate_v1();
CREATE EXTENSION "uuid-ossp";
  • git、构建和启动
    注:不要在 root下执行下面命令,因为ovirt只能在非root下进行开发,centos7创建用户
  1. 查看用户目录
    echo $HOME
  2. checkout$HOME/git/ovirt-engine
    mkdir -p "$HOME/git"
    cd "$HOME/git"
    git clone https://github.com/oVirt/ovirt-engine.git
    注:现在版本git上版本不是4.2.2.6了,所以就不要clone了,从resource上获取ovirt-engine的源码
  3. 更改pom.xml
    $HOME/git/ovirt-engine/pom.xml
    所有maven-surefire-plugin都要添加configuration
         maven-surefire-plugin
           
               true
           
  1. 构建到 $HOME/ovirt-engine
    cd "$HOME/git/ovirt-engine"
    make install-dev PREFIX="$HOME/ovirt-engine"
    注:编译过程至少要8G内存
  2. 初始化
    $HOME/ovirt-engine/bin/engine-setup
  3. 启动
    $HOME/ovirt-engine/share/ovirt-engine/services/ovirt-engine/ovirt-engine.py start
  • 查看
  1. 导入证书
    下载证书:https://localhost.localdomain/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA
    浏览器导入证书
  2. 登录查看
    https://localhost.localdomain:8443/ovirt-engine/
    编辑打开网址的主机的hosts
IP localhost.localdomain

IP是运行ovirt-enginecentos7ip

image.png

  • 编译出ovirt-engine

su
echo 8192000 > /proc/sys/fs/inotify/max_user_watches
ulimit -n 10240
su coretek
ulimit -n 10240
make dist
rpmbuild -tb ovirt-engine-4.2.3.5.tar.gz

rpmbuild -D"ovirt_build_minimal 1" -tb ovirt-engine-4.2.3.5.tar.gz


额外的:

  • 添加添加用户密码登录的模块(就是aaa)
  • 前后端代码调试

ovirt问题合集

引用:

git:ovirt-engine开发和调试环境搭建
官网:ovirt-engine开发和调试环境搭建

官网:develop

git:developer-guide
官网:developer-guide

automation 模块

git:ide中配置ovirt-engine开发环境
官网:ide中配置ovirt-engine开发环境

debug ovirt in the intellij ide

oVirt Infra Docs

jmx-一种功能上类似于xml的配置

你可能感兴趣的:(CentOS7 minimal ovirt engine 开发环境搭建)