OpenStack实践(一):Ubuntu16.04下DevStack方式搭建p版OpenStack
OpenStack部署方式很多,常见的个人部署方式有DevStack、Rdo、all-in-one、multi-node、multi-HA-node等;企业部署方式有Ansible、SaltStack、Puppet、TripleO、Kolla、Fuel等。其中DevStack是众多开发者们的首选安装方式或工具,该方式主要是通过配置参数,执行shell脚本来安装一个OpenStack的开发环境。
创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于网站设计、成都网站设计、鹤岗网络推广、微信平台小程序开发、鹤岗网络营销、鹤岗企业策划、鹤岗品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联公司为所有大学生创业者提供鹤岗建站搭建服务,24小时服务热线:18982081108,官方网址:www.cdcxhl.com
OpenStack开源社区每年都会开两次设计峰会(Design Summit),发布两个正式版本。从2010年的首个版本至今,一共已经出了18个版本,每个版本都有独立名字,取自当次设计峰会所在城市中选一个地名,而且从A开始,然后B、C……。最新的版本是Rocky,字母R正好排序第18位。本文部署的版本为Pike。
本文OpenStack的控制节点和计算节点都是Esxi上新建的虚机,具体配置如下:
控制节点配置:
计算节点配置:
ubuntu安装详见:Ubuntu16.04.5以lvm方式安装全记录
控制节点和计算节点安装步骤相同,只是第6步中的配置不同,实际安装过程中应先装控制节点再装计算节点,本文以计算节点安装为例记录搭建过程。
1.pip安装
root@openstack-computer:~# pip The program 'pip' is currently not installed. You can install it by typing: apt install python-pip root@openstack-computer:~# apt install -y python-pip
2.代码下载
root@openstack-computer:~# git clone https://git.openstack.org/openstack-dev/devstack -b stable/pike
本文的安装版本为pike
3.创建用户stack
root@openstack-computer:~# ll total 36 drwx------ 4 root root 4096 Nov 29 17:02 ./ drwxr-xr-x 23 root root 4096 Nov 29 16:32 ../ -rw------- 1 root root 49 Nov 29 16:47 .bash_history -rw-r--r-- 1 root root 3106 Oct 23 2015 .bashrc drwx------ 2 root root 4096 Nov 29 16:47 .cache/ drwxr-xr-x 17 root root 4096 Nov 29 17:02 devstack/ -rw-r--r-- 1 root root 148 Aug 17 2015 .profile -rw------- 1 root root 3413 Nov 29 16:51 .viminfo -rw------- 1 root root 128 Nov 29 16:47 .Xauthority root@openstack-computer:~# devstack/tools/create-stack-user.sh Creating a group called stack Creating a user called stack Giving stack user passwordless sudo privileges
4.修改pip源
root用户修改pip源
root@openstack-computer:~# mkdir ~/.pip root@openstack-computer:~# view ~/.pip/pip.conf [global] trusted-host=mirrors.aliyun.com index-url=https://mirrors.aliyun.com/pypi/simple/
stack用户修改pip源
root@openstack-computer:~# su - stack stack@openstack-computer:~$ mkdir ~/.pip stack@openstack-computer:~$ view ~/.pip/pip.conf [global] trusted-host=mirrors.aliyun.com index-url=https://mirrors.aliyun.com/pypi/simple/
5.移动devstack目录
将devstack目录由root的家目录移至/opt/stack
root@openstack-computer:~# mv devstack /opt/stack root@openstack-computer:~# chown -R stack:stack /opt/stack/devstack
6.新建配置文件
控制节点:
[[local|localrc]] MULTI_HOST=true # management & api network HOST_IP=172.27.34.37 LOGFILE=/opt/stack/logs/stack.sh.log # Credentials ADMIN_PASSWORD=admin MySQL_PASSWORD=loong576 RABBIT_PASSWORD=loong576 SERVICE_PASSWORD=loong576 SERVICE_TOKEN=loong576 # enable neutron-ml2-vlan disable_service n-net # Enable LBaaS v2 enable_plugin neutron-lbaas https://git.openstack.org/openstack/neutron-lbaas stable/pike enable_plugin octavia https://git.openstack.org/openstack/octavia stable/pike enable_plugin neutron-lbaas-dashboard https://git.openstack.org/openstack/neutron-lbaas-dashboard stable/pike # enable FWaaS v2 enable_plugin neutron-fwaas https://git.openstack.org/openstack/neutron-fwaas stable/pike enable_plugin neutron-fwaas-dashboard https://git.openstack.org/openstack/neutron-fwaas-dashboard stable/pike enable_service q-lbaasv2,octavia,o-cw,o-hk,o-hm,o-api,q-***,q-fwaas-v2,q-svc,q-agt,q-dhcp,q-l3,q-meta,neutron Q_AGENT=linuxbridge ENABLE_TENANT_VLANS=True TENANT_VLAN_RANGE=3001:4000 PHYSICAL_NETWORK=default # logging LOG_COLOR=True LOGDIR=$DEST/logs SCREEN_LOGDIR=$LOGDIR/screen # use TryStack git mirror GIT_BASE=http://git.trystack.cn NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git
控制节点ip为:172.27.34.37,admin密码为admin,后面web登陆会用到。q-***星号为v and p and n
计算节点:
stack@openstack-computer:~$ more /opt/stack/devstack/local.conf [[local|localrc]] MULTI_HOST=true # management & api network HOST_IP=172.27.34.38 # Credentials ADMIN_PASSWORD=admin MYSQL_PASSWORD=loong576 RABBIT_PASSWORD=loong576 SERVICE_PASSWORD=loong576 SERVICE_TOKEN=loong576 # Service information SERVICE_HOST=172.27.34.37 MYSQL_HOST=$SERVICE_HOST RABBIT_HOST=$SERVICE_HOST GLANCE_HOSTPORT=$SERVICE_HOST:9292 Q_HOST=$SERVICE_HOST KEYSTONE_AUTH_HOST=$SERVICE_HOST KEYSTONE_SERVICE_HOST=$SERVICE_HOST ENABLED_SERVICES=n-cpu,q-agt,neutron Q_AGENT=linuxbridge ENABLE_TENANT_VLANS=True TENANT_VLAN_RANGE=3001:4000 PHYSICAL_NETWORK=default # vnc config NOVA_VNC_ENABLED=True NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html" VNCSERVER_LISTEN=$HOST_IP VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN # Logging LOG_COLOR=True LOGDIR=$DEST/logs SCREEN_LOGDIR=$LOGDIR/screen # use TryStack git mirror GIT_BASE=http://git.trystack.cn NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git enable_service placement-api
HOST_IP=172.27.34.38为计算节点ip
本文中参数Q_AGENT配置为linuxbridge,表示网络选择为Linux Bridge方式,如果选择Open vSwitch,则Q_AGENT=openvswitch。
7.部署openstack
stack@openstack-computer:~/devstack$ ./stack.sh
控制节点安装完成:
计算节点安装完成:
8.登陆web
地址为:http://172.27.34.37,用户名密码为配置文件中的admin/admin
至此完成OpenStack安装。
9.卸载
若修改了local.conf则需先卸载再重新安装
卸载命令
stack@openstack-controller:~/devstack$ ./unstack.sh stack@openstack-controller:~/devstack$ ./clean.sh
搭建脚本已上传github:https://github.com/loong576/openstack-devstack.git
本文参考:
http://cloudman.cc/
https://docs.openstack.org/devstack/latest/guides/devstack-with-lbaas-v2.html
https://docs.openstack.org/neutron-fwaas-dashboard/latest/contributor/devstack-plugin.html
网页标题:OpenStack实践(一):Ubuntu16.04下DevStack方式搭建p版OpenStack
本文路径:http://scyanting.com/article/ipsdei.html