美文网首页
在ubuntu18.04上搭建的openstack环境中利用DI

在ubuntu18.04上搭建的openstack环境中利用DI

作者: 你可以的_wht | 来源:发表于2019-02-20 15:32 被阅读0次

    1.在ubuntu18.04上搭建openstack环境

    注意:ubuntu18.04最低4G内存,尽量将内存和磁盘调大。

    参考:https://blog.csdn.net/hunjiancuo5340/article/details/85005995

    2.openstack环境搭建成功后会在/opt/stack目录下,下载好相关的代码,并安装好DIB(disk image builder)工具。

    设置环境变量(注意:都是在stack用户下进行)

    export HOST_USERNAME=stack

    export HOST_SCP_USERNAME=ubuntu

    export GUEST_USERNAME=ubuntu

    export REDSTACK_SCRIPTS=/opt/stack/trove-integration/scripts

    export PATH_TROVE=/opt/stack/trove

    export ESCAPED_PATH_TROVE='\/opt\/stack\/trove'

    export SSH_DIR=/opt/stack/.ssh

    export GUEST_LOGDIR=/var/log/trove/

    export ESCAPED_GUEST_LOGDIR='\/var\/log\/trove\/'

    export DIB_CLOUD_INIT_DATASOURCES='ConfigDrive'

    export CONTROLLER_IP=192.168.100.100 #这个ip是openstack环境的controller_ip

    export RELEASE=bionic

    export ELEMENTS_PATH=/opt/stack/trove-integration/scripts/files/elements/

    export ELEMENTS_PATH+=:/opt/stack/diskimage-builder/diskimage_builder/elements

    export ELEMENTS_PATH+=:/opt/stack/tripleo-image-elements/elements

    3.执行构建命令

    disk-image-create -a amd64 -o /tmp/ubuntu_mysql -x --qemu-img-options compat=1.1

    --offline ubuntu vm  cloud-init-datasources ubuntu-guest ubuntu-mysql  2>&1 | tee /tmp/1.txt

    注意:-o 是镜像输出的路径;--offline是离线安装,离线目录默认是:~/.cache/image_create/;ubuntu vm  cloud-init-datasources ubuntu-guest ubuntu-mysql 是element; 2>&1 | tee /tmp/1.txt将日至信息保存到 /tmp/1.txt中

    以上命令是离线构建一个ubuntu-mysql 镜像,输出到/tmp/目录下。构建成功后会得到/tmp/ubuntu_mysql.qcow2 镜像

    FAQ:

    1.构建过程中下载镜像的时候特别慢,卡在那里一直不动,有时候镜像还没下载完成,就卡死了。

    解答:应该是网络问题,可以先将镜像下载下来保存到指定的目录,默认是~/.cache/image_create/目录,然后采用离线安装--offline;镜像地址是http://cloud-images.ubuntu.com/

    2.构建过程中报找不到unsquashfs命令

    解答:apt-get install squashfs-tools

    3.Did not get /opt/stack/.cache/dib/lockfiles/bionic-server-cloudimg-amd64.squashfs.lock

    解答:rm -rf  /opt/stack/.cache/dib/lockfiles/bionic-server-cloudimg-amd64.squashfs.lock

    4.执行到这一步sudo unsquashfs -f -d /tmp/dib_build.XzOp28nd/mnt /opt/stack/.cache/image-create/bionic-server-cloudimg-amd64.squashfs 过程中被自动killed

    解答:将ubuntu 18.04 的内存调大。

    5.sudo -Hiu ubuntu dd if=/opt/stack/trove-integration/scripts/files/requirements/ubuntu-requirements-default.txt of=/tmp/dib_build.iqMRLFf6/hooks/requirements.txt 

    2019-02-14 10:04:03.032 | sudo:unknown user: ubuntu

    2019-02-14 10:04:03.034 | sudo: unable to initialize policy plugin

    解答:设置环境变量:export HOST_USERNAME=stack

    6.2019-02-14 11:43:52.582 | CONTROLLER_IP needs to be set to the ip address that guests will use to contact the controller

    解答:设置环境变量:export CONTROLLER_IP=192.168.100.100 #ip是openstack horizon的登陆ip

    7.SSH Authorized Keys file must exist along with pub and private key

    解答:stack用户下生成ssh

    设置环境变量: export SSH_DIR=/opt/stack/.ssh

    然后在touch  authorized_keys  里面是空的什么都没有写

    8.dib-run-parts Running /tmp/in_target.d/pre-install.d/01-trim-pkgs

    2019-02-15 02:13:02.083 | E: Unable to locate package libbind9-90

    2019-02-15 02:13:02.083 | E: Unable to locate package libdns100

    2019-02-15 02:13:02.083 | E: Unable to locate package libept1.4.12

    2019-02-15 02:13:02.083 | E: Couldn't find any package by glob 'libept1.4.12'

    2019-02-15 02:13:02.083 | E: Couldn't find any package by regex 'libept1.4.12'

    2019-02-15 02:13:02.083 | E: Unable to locate package libevent-2.0-5

    2019-02-15 02:13:02.083 | E: Couldn't find any package by glob 'libevent-2.0-5'

    2019-02-15 02:13:02.083 | E: Couldn't find any package by regex 'libevent-2.0-5'

    2019-02-15 02:13:02.083 | E: Unable to locate package libisc95

    2019-02-15 02:13:02.083 | E: Unable to locate package liblwres90

    2019-02-15 02:13:02.083 | E: Unable to locate package libparted0debian1

    2019-02-15 02:13:02.083 | E: Unable to locate package libxapian22

    解答:将这些包从vim ./trove-integration/scripts/files/elements/ubuntu-guest/pre-install.d/01-trim-pkgs文件中删除就好了

    9.E:Package 'python-software-properties' has no installation candidate 

    解答:将python-software-properties从vim ./trove-integration/scripts/files/elements/ubuntu-guest/pre-install.d/04-baseline-tools文件中删除

    10.E:The repository 'http://repo.percona.com/apt percona-release_0.1-10.bionic_all.deb Release' does not have a Release file. 

    解答:设置环境变量:export RELEASE=bionic

    11.pip install -q --upgrade -r /tmp/in_target.d/requirements.txt -c /tmp/in_target.d/upper-constraints.txt 到这一步特别慢,有时候还会卡着。

    解答:vim ./requirements/upper-constraints.txt 将monotonic===1.5注释掉,就好了

    12.dib-run-parts Running /tmp/in_target.d/install.d/20-etc 2019-02-15 06:47:06.928 | dd:

    failed to open '/etc/init/trove-guest.conf': No such file or directory

    解答:

    vim ./trove-integration/scripts/files/elements/ubuntu-guest/install.d/20-etc

    if

    [ -f "/etc/init/trove-guest.conf" ];then

    echo

    "文件存在"

    else

    mkdir -p /etc/init/

    cd /etc/init/

    touch trove-guest.conf

    fi

    13.E:Package: "libmysqlclient18" has installtion candidate 

    E:Package: "mysql-server-5.6" has installtion candidate 

    解答:vim ./trove-integration/scripts/files/elements/ubuntu-mysql/install.d/30-mysql

    apt-get -y install libmysqlclient20 mysql-server-core-5.7 percona-xtrabackup${PXB_VERSION_OVERRIDE}

    14.mkdir :cannot create directory '/home/ubuntu_mysql-d/':Permission denied

    解答:vim ./diskimage-builder/diskimage_builder/elements/manifests/cleanup.d/01-copy-manifests-dir

    sudo mkdir -p ${DIB_MANIFEST_SAVE_DIR}

    sudo cp --no-preserve=ownership -rv ${MANIFEST_IMAGE_PATH}

    ${DIB_MANIFEST_SAVE_DIR}

    相关文章

      网友评论

          本文标题:在ubuntu18.04上搭建的openstack环境中利用DI

          本文链接:https://www.haomeiwen.com/subject/cjsbqqtx.html