DevStack是一个自以为是的脚本,用于快速创建OpenStack开发环境。它也可以用来演示启动/运行OpenStack服务,并提供从命令行使用它们的示例。这篇文章将介绍如何将DevStack安装到VMware工作站Ubuntu VM中的步骤。

YouTube视频:

1.准备Ubuntu VM

此Ubuntu虚拟机至少需要12G内存和100G硬盘。我给了我的OpenStack VM 16G内存和120G硬盘驱动器以进行测试。

2.更新系统并更改sources.list文件
您可能想要从默认安装的Ubuntu的源文件列表中删除或注释cdrom条目。

我发现如果不这样做,我的Ubuntu将收到一些错误消息,说明:

The repository 'cdrom://Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1) xenial Release' does not have a Release file.
Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
See apt-secure(8) manpage for repository creation and user configuration details.
The repository 'ppa.launchpad.net/kirillshkrogalev/ffmpeg-next/ubuntu xenial Release' does not have a Release file.
Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
See apt-secure(8) manpage for repository creation and user configuration details.
Failed to fetch 光盘://Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)/dists/xenial/main/binary-amd64/Packages  Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs
Some index files failed to download. They have been ignored, or old 上es used instead.
要从终端解决此问题,您必须直接从以下位置删除/注释此CD-ROM存储库源 /etc/apt/sources.list
 sudo nano /etc/apt/sources.list
并注释或删除包含以下内容的行 光盘。例如:
deb 光盘:[Ubuntu-Server 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.3)]/ xenial main restricted
Now it is time to update / upgrade Ubuntu system:
sudo apt-get update
​sudo apt-get upgrade

3.安装git并将Devstack克隆到本地

sudo apt-get install git
cd /
​sudo git clone //git.openstack.org/openstack-dev/devstack master

4.准备安装Devstack

4.1复制样本配置文件以用于安装

cd /master
​sudo cp samples/local.conf local.conf
sudo nano local.conf
搜索密码变量部分,并确保其反映以下内容(YOURPASSWORD是您要使用的实际密码):
ADMIN_PASSWORD=YOURPASSWORD
​MYSQL_PASSWORD=$ADMIN_PASSWORD
​RABBIT_PASSWORD=$ADMIN_PASSWORD
​SERVICE_PASSWORD=$ADMIN_PASSWORD

4.2创建一个新用户“堆栈”,并将主文件夹权限更改为此新用户

我们可以使用预安装的脚本为devstack创建新用户。运行此脚本的命令是:

sudo /devstack/tools/create-stack-user.sh

脚本完成后,您需要使用以下命令更改master文件夹的权限:

sudo chown -R stack:stack /master

5.开始安装DevStack

这必须以堆栈用户身份运行。让我们将当前用户更改为我们新创建的用户-堆栈。

sudo su stack

开始安装的最终命令:

./stack.sh

然后等待了很长时间,对我来说超过45分钟。最后,一旦看到以下输出,则说明DevStack安装成功。


=========================
DevStack Component Timing
 (times are in seconds)
=========================
run_process           34
test_with_retry        4
apt-get-update         7
pip_install          635
osc                  216
wait_for_service      30
git_timed            1248
dbsync                48
apt-get              408
-------------------------
Unaccounted time     591
=========================
Total runtime        3221


This is your host IP address: 10.94.200.78
This is your host IPv6 address: ::1
Horizon is now available at http://10.94.200.78/dashboard
Keystone is serving at http://10.94.200.78/identity/
The default users are: admin and demo
The password: password1234

WARNING:
Using lib/neutron-legacy is deprecated, and it will be removed in the future


Services are running under systemd unit files.
For more information see:
//docs.openstack.org/devstack/latest/systemd.html

DevStack Version: stein
Change: 62c832b090021b0c85ade8eb718eabaccc345257 Merge "Update default cirros version" 2019-01-20 15:20:35 +0000
OS Version: Ubuntu 16.04 xenial

6.启动浏览器以登录DevStack

7.卸载DevStack。

如果local.conf文件有任何更改,则必须首先卸载并清理DevStack安装。

[电子邮件 protected]:/ master $ ./unstack.sh
[电子邮件 protected]:/ master $ ./clean.sh

一些命令行工具:


[电子邮件 protected]:~$ cd /master
[电子邮件 protected]:/master$ source openrc admin admin
WARNING: setting legacy OS_TENANT_NAME to support cli tools.
[电子邮件 protected]:/master$ nova show tt1
+--------------------------------------+-----------------------------------------------------------------+
| Property                             | Value                                                           |
+--------------------------------------+-----------------------------------------------------------------+
| OS-DCF:diskConfig                    | AUTO                                                            |
| OS-EXT-AZ:availability_zone          | nova                                                            |
| OS-EXT-SRV-ATTR:host                 | ubuntu                                                          |
| OS-EXT-SRV-ATTR:hostname             | tt1                                                             |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | ubuntu                                                          |
| OS-EXT-SRV-ATTR:instance_name        | instance-00000004                                               |
| OS-EXT-SRV-ATTR:kernel_id            |                                                                 |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                               |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                                 |
| OS-EXT-SRV-ATTR:reservation_id       | r-gmom984x                                                      |
| OS-EXT-SRV-ATTR:root_device_name     | /dev/vda                                                        |
| OS-EXT-SRV-ATTR:user_data            | -                                                               |
| OS-EXT-STS:power_state               | 4                                                               |
| OS-EXT-STS:task_state                | -                                                               |
| OS-EXT-STS:vm_state                  | stopped                                                         |
| OS-SRV-USG:launched_at               | 2019-01-22T01:10:52.000000                                      |
| OS-SRV-USG:terminated_at             | -                                                               |
| accessIPv4                           |                                                                 |
| accessIPv6                           |                                                                 |
| config_drive                         |                                                                 |
| created                              | 2019-01-22T01:10:40Z                                            |
| description                          | tt1                                                             |
| flavor:disk                          | 0                                                               |
| flavor:ephemeral                     | 0                                                               |
| flavor:extra_specs                   | {}                                                              |
| flavor:original_name                 | cirros256                                                       |
| flavor:ram                           | 256                                                             |
| flavor:swap                          | 0                                                               |
| flavor:vcpus                         | 1                                                               |
| hostId                               | d04e0dcc9fc1398a8e5e01ed3376e8fb30f59e85459ca7bd75bb983e        |
| host_status                          | UP                                                              |
| id                                   | 58ddbe80-d943-4d5b-9b2a-e5f6518e5ea1                            |
| image                                | cirros-0.4.0-x86_64-disk (b897ce20-2ad3-4142-9e02-63ec31986bcd) |
| key_name                             | -                                                               |
| locked                               | False                                                           |
| metadata                             | {}                                                              |
| name                                 | tt1                                                             |
| os-extended-volumes:volumes_attached | []                                                              |
| public network                       | 172.24.4.31, 2001:db8::1f7                                      |
| security_groups                      | default                                                         |
| status                               | SHUTOFF                                                         |
| tags                                 | []                                                              |
| tenant_id                            | ad9bc16cfe6f4d57a3f1a722e413f9d5                                |
| trusted_image_certificates           | -                                                               |
| updated                              | 2019-01-22T01:21:45Z                                            |
| user_id                              | 659da36320994abdaac01a509911cd81                                |
+--------------------------------------+-----------------------------------------------------------------+
[电子邮件 protected]:/master$ 
[电子邮件 protected]:/master$ nova service-list
+--------------------------------------+------------------+--------+----------+---------+-------+----------------------------+-----------------+-------------+
| Id                                   | Binary           | Host   | Zone     | Status  | State | Updated_at                 | Disabled Reason | Forced down |
+--------------------------------------+------------------+--------+----------+---------+-------+----------------------------+-----------------+-------------+
| f26f6b58-ee11-4371-92ab-7bcdb4a0460d | nova-scheduler   | ubuntu | internal | enabled | up    | 2019-01-22T01:38:09.000000 | -               | False       |
| ef6130dd-14e0-4c7f-a6ed-52ab18dbf290 | nova-consoleauth | ubuntu | internal | enabled | up    | 2019-01-22T01:38:07.000000 | -               | False       |
| 2f7f1d9b-de00-476a-b396-0beb2f013c33 | nova-conductor   | ubuntu | internal | enabled | up    | 2019-01-22T01:38:10.000000 | -               | False       |
| 1c479ce7-ad67-4d51-bb9f-a2caa7ff473b | nova-compute     | ubuntu | nova     | enabled | up    | 2019-01-22T01:38:15.000000 | -               | False       |
| 99d78d26-aedb-455b-bf71-ca8b868464e5 | nova-conductor   | ubuntu | internal | enabled | up    | 2019-01-22T01:38:09.000000 | -               | False       |
| c8ecc3a9-0b60-41fb-b6d7-36e7210cadb3 | nova-compute     | ubuntu | nova     | enabled | up    | 2019-01-22T01:38:12.000000 | -               | False       |
+--------------------------------------+------------------+--------+----------+---------+-------+----------------------------+-----------------+-------------+
[电子邮件 protected]:/master$ nova hypervisor-stats
+----------------------+-------+
| Property             | Value |
+----------------------+-------+
| count                | 1     |
| current_workload     | 0     |
| disk_available_least | 10    |
| free_disk_gb         | 18    |
| free_ram_mb          | 15261 |
| local_gb             | 18    |
| local_gb_used        | 0     |
| memory_mb            | 16029 |
| memory_mb_used       | 768   |
| running_vms          | 1     |
| vcpus                | 6     |
| vcpus_used           | 1     |
+----------------------+-------+
[电子邮件 protected]:/master$ 
[电子邮件 protected]:/master$ openstack volume show testv
+--------------------------------+--------------------------------------+
| Field                          | Value                                |
+--------------------------------+--------------------------------------+
| attachments                    | []                                   |
| availability_zone              | nova                                 |
| bootable                       | false                                |
| consistencygroup_id            | None                                 |
| created_at                     | 2019-01-22T01:43:46.000000           |
| description                    |                                      |
| encrypted                      | False                                |
| id                             | 267cffee-8da0-42d1-8eb0-a45e4192dc3a |
| migration_status               | None                                 |
| multiattach                    | False                                |
| name                           | testv                                |
| os-vol-host-attr:host          | None                                 |
| os-vol-mig-status-attr:migstat | None                                 |
| os-vol-mig-status-attr:name_id | None                                 |
| os-vol-tenant-attr:tenant_id   | ad9bc16cfe6f4d57a3f1a722e413f9d5     |
| properties                     |                                      |
| replication_status             | None                                 |
| size                           | 2                                    |
| snapshot_id                    | None                                 |
| source_volid                   | None                                 |
| status                         | error                                |
| type                           | Performance                          |
| updated_at                     | 2019-01-22T01:43:46.000000           |
| user_id                        | 659da36320994abdaac01a509911cd81     |
+--------------------------------+--------------------------------------+


通过 约翰扬

发表评论