Skip to the content.

Cài đặt openstack train bằng packstack.

1. Giới thiệu về packstack.

Packstack là một bộ công cụ command-line sử dụng Puppet module để triển khai nhanh Openstack thông qua kết nối ssh. Packstack thích hợp để triển khai cho cho cả Single node và multi node. Hiện tại thì packstack chỉ hỗ trợ RHEL và CentOS. Ưu điểm lớn nhất của packstack là triển khai hạ tầng nhanh chóng để test, demo tính năng.

2. Triển khai packstack.

2.1 Chuẩn bị môi trường

2.2 Cài đặt packstack.

yum update -y
yum install -y centos-release-openstack-stein epel-release
yum install -y openstack-packstack python-pip

packstack --allinone

2.3. Làm việc với command line.

[root@localhost ~]# ll
total 116
-rw-------. 1 root root  1247 Oct 13 20:58 anaconda-ks.cfg
-rw-------  1 root root   371 Oct 19 05:34 keystonerc_admin
-rw-------  1 root root   316 Oct 19 05:34 keystonerc_demo
-rw-------  1 root root 51777 Oct 19 05:30 packstack-answers-20191019-053049.txt
drwxr-xr-x. 4 root root    31 Oct 19 00:21 packstackca
-rw-------. 1 root root 51793 Oct 19 03:55 stein-answerfile.txt
[root@localhost ~]# . ./keystonerc_admin
[root@localhost ~(keystone_admin)]# openstack token issue
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field      | Value                                                                                                                                                                                   |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires    | 2019-10-21T02:30:34+0000                                                                                                                                                                |
| id         | gAAAAABdrQo6ujnWhIa9jjfYp7pR8ccDS_uNK6Yhl4XbY3o7KHHYllklOS15UVnC-Bpwq_z0GWV3ZiL1isu2xzXr73TX_7D6zx5DAfcx4uFnLJdjcTQBVFUByUjh5RKRvJ1UmWtJTk8w_sCfsUHqZaRsegQVIsA4UhZG_sLHCa1iMJlr2umx9Vc |
| project_id | be1be6efb2b548a8a219d3f908aa40ba                                                                                                                                                        |
| user_id    | 922e01d44ab24ac0954e4d1be7aa67e5                                                                                                                                                        |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@localhost ~(keystone_admin)]# 

- Tải image và upload image lên glance.

wget https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img openstack image create “ubuntu 18”
–file bionic-server-cloudimg-amd64.img
–disk-format qcow2 –container-format bare
–public

- Tạo external network:

neutron net-create external_network –provider:network_type flat
–provider:physical_network provider
–router:external
–shared

- Tạo subnet cho mạng external:

neutron subnet-create –name ex_subnet –gateway 192.168.30.1
–allocation-pool start=192.168.30.140,end=192.168.30.150
–enable-dhcp=True external_network 192.168.30.0/24

- Khởi tạo self-service network và subnet:

neutron net-create self-net neutron subnet-create –name self-subnet self-net 10.20.20.0/24

- Khởi tạo Router:

neutron router-create ex_router neutron router-gateway-set ex_router external_network neutron router-interface-add ex_router self-subnet

- Kiểm tra port list:

[root@localhost ~(keystone_admin)]# neutron port-list neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead. +————————————–+——+———————————-+——————-+—————————————————————————————+ | id | name | tenant_id | mac_address | fixed_ips | +————————————–+——+———————————-+——————-+—————————————————————————————+ | 647883be-8042-40c7-b855-468fd45041db | | 32c435b0b0ef4b11982de013091271ab | fa:16:3e:94:f8:53 | {“subnet_id”: “6386a129-4a17-4f29-8557-8ffac395d321”, “ip_address”: “10.0.0.1”} | | 70ef41ad-0c6f-4c22-8012-d33edb85c013 | | be1be6efb2b548a8a219d3f908aa40ba | fa:16:3e:b2:89:22 | {“subnet_id”: “3ce4c029-491a-4efe-9b55-be41040afb30”, “ip_address”: “10.20.20.1”} | | 98dc4983-768a-4a6f-93c1-488173beef1e | | 32c435b0b0ef4b11982de013091271ab | fa:16:3e:6b:5d:51 | {“subnet_id”: “6386a129-4a17-4f29-8557-8ffac395d321”, “ip_address”: “10.0.0.2”} | | 9b3599f6-a6c3-436e-9bb0-62a9d210d830 | | | fa:16:3e:91:82:90 | {“subnet_id”: “081cc3b1-6de8-4cd8-be09-a96072b2c7c7”, “ip_address”: “192.168.30.147”} | | af99563a-dac3-48b1-957c-effe7fdc0871 | | be1be6efb2b548a8a219d3f908aa40ba | fa:16:3e:86:48:9d | {“subnet_id”: “3ce4c029-491a-4efe-9b55-be41040afb30”, “ip_address”: “10.20.20.2”} | | ce3c8248-0b71-4f8d-8852-968a727b599c | | be1be6efb2b548a8a219d3f908aa40ba | fa:16:3e:77:81:e2 | | | eb402e24-e80a-45c8-ab27-b0996395908d | | | fa:16:3e:2d:bf:c2 | {“subnet_id”: “8b08ba2c-bf56-441e-aa0a-a3359b211117”, “ip_address”: “172.24.4.11”} | | ebad3c6e-dcac-4429-a254-4c72764dd70c | | be1be6efb2b548a8a219d3f908aa40ba | fa:16:3e:11:a9:78 | {“subnet_id”: “081cc3b1-6de8-4cd8-be09-a96072b2c7c7”, “ip_address”: “192.168.30.140”} | +————————————–+——+———————————-+——————-+—————————————————————————————+

- Ping đến Ip trong port list provider:

[root@controller ~(keystone_admin)]# ping 192.168.30.140 PING 192.168.30.140 (192.168.30.140) 56(84) bytes of data. 64 bytes from 192.168.30.140: icmp_seq=1 ttl=64 time=0.673 ms 64 bytes from 192.168.30.140: icmp_seq=2 ttl=64 time=0.111 ms 64 bytes from 192.168.30.140: icmp_seq=3 ttl=64 time=0.085 ms 64 bytes from 192.168.30.140: icmp_seq=4 ttl=64 time=0.079 ms 64 bytes from 192.168.30.140: icmp_seq=5 ttl=64 time=0.082 ms 64 bytes from 192.168.30.140: icmp_seq=6 ttl=64 time=0.101 ms 64 bytes from 192.168.30.140: icmp_seq=7 ttl=64 time=0.058 ms 64 bytes from 192.168.30.140: icmp_seq=8 ttl=64 time=0.043 ms ```

Tài liệu tham khảo: https://github.com/hungnt1/Report-Intern-Meditech/blob/master/Openstack/2.install-pack-stack.md