这篇文章写给初学者,如何buid 一个openstack 的环境,然后学习openstack,使用devstack 来安装openstack 是最简易快捷的方式了.
devstack 的官方网站:
http://devstack.org/
下面开始我们的openstack 体验之旅:
1. 准备 ubuntu-12.04 OS:
我自己的desktop 上安装了 virtual box, 就用它虚拟一个 VM吧
a. 下载 ubuntu-12.04.1-alternate-amd64.iso http://releases.ubuntu.com/12.04/
b. 安装 ubuntu OS, 很简单的 就不赘述了
2. 设置 root 口令:
要先打开终端, 执行:sudo passwd -u root # 来启用我们的root账户,如果你后悔了可以执行 sudo passwd -l root 来重新lock root用户。
然后给root创建一个密码:sudo passwd root #看准提示进行输入,root的密码最好和其他用户的密码不同,不然会遇到一些麻烦。
现在root用户也不被禁用了,也有密码了,那么如何使用root进行登录呢?
执行如下命令:echo "greeter-show-manual-login=true” >> /etc/lightdm/lightdm.conf #这样是让lightdm可以手动输入root用户进行登录。
执行完毕后重启,登录时点击lightdm下的登录按钮,输入root和密码即可使用root登录
3. 配置IP:
我家里的网络是 无线路由+猫, 我自己机器的私网地址 是192.168.1.101, 在虚拟机中 配置好IP 为 192.168.1.102
vim /etc/network/interfaces
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static post-up ifconfig dummy0 0.0.0.0 address 192.168.1.102 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 dns-nameservers 192.168.1.1 dns-search stackops.org
重启网络 : /etc/init.d/networking restart
4. 配置DNS:
配置在这个地方 restart vm 也不失效
vi /etc/resolvconf/resolv.conf.d/base
nameserver 192.168.1.1
5. 更新 OS:
apt-get update
6. 安装open-ssl:
安装这个东东主要的为了通过desktop 使用 SecureCRT 访问 vm
8. 使用devstack 安装openstack
ADMIN_PASSWORD=nova MYSQL_PASSWORD=nova RABBIT_PASSWORD=nova SERVICE_PASSWORD=nova SERVICE_TOKEN=tokentoken FLAT_INTERFACE=br100
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | extra_specs |
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 6 | xpp.test | 256 | 0 | 0 | | 1 | 1.0 | True | {} |
+----+----------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
root@mystack:/opt/devstack#
+-------------------------------------+--------------------------------------+
| Property | Value |
+-------------------------------------+--------------------------------------+
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-SRV-ATTR:host | None |
| OS-EXT-SRV-ATTR:hypervisor_hostname | None |
| OS-EXT-SRV-ATTR:instance_name | instance-00000001 |
| OS-EXT-STS:power_state | 0 |
| OS-EXT-STS:task_state | scheduling |
| OS-EXT-STS:vm_state | building |
| accessIPv4 | |
| accessIPv6 | |
| adminPass | kfPJ4aYThBw6 |
| config_drive | |
| created | 2012-12-31T13:45:32Z |
| flavor | xpp.test |
| hostId | |
| id | 88013d9e-20b3-41d7-a699-f1752af91755 |
| image | cirros-0.3.0-x86_64-uec |
| key_name | None |
| metadata | {} |
| name | xhuvm1 |
| progress | 0 |
| security_groups | [{u'name': u'default'}] |
| status | BUILD |
| tenant_id | 42109310396440339051a0e7cb064bc9 |
| updated | 2012-12-31T13:45:33Z |
| user_id | 17150c9b069042dbbffc75ce02422874 |
+-------------------------------------+--------------------------------------+
root@mystack:/opt/devstack#
+--------------------------------------+--------+--------+------------------+
| ID | Name | Status | Networks |
+--------------------------------------+--------+--------+------------------+
| 88013d9e-20b3-41d7-a699-f1752af91755 | xhuvm1 | ACTIVE | private=10.0.0.2 |
+--------------------------------------+--------+--------+------------------+
root@mystack:/opt/devstack#
Binary Host Zone Status State Updated_At
nova-conductor mystack nova enabled :-) 2012-12-31 14:01:27
nova-cert mystack nova enabled :-) 2012-12-31 14:01:27
nova-compute mystack nova enabled :-) 2012-12-31 14:01:27
nova-scheduler mystack nova enabled :-) 2012-12-31 14:01:26
nova-consoleauth mystack nova enabled :-) 2012-12-31 14:01:27
nova-network mystack nova enabled :-) 2012-12-31 14:01:26