openstack-newton版自動化安裝
基礎環境準備
把自己的ip改成靜態ip修改DNS新增閘道器讓機器能上網
#cat /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE="Ethernet"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16780032"
UUID="d38bf87a-21fb-4d41-a44a-a1162e13583a"
DEVICE="eno16780032"
ONBOOT="yes"
IPADDR="192.168.0.119"
PREFIX="24"
GATEWAY="192.168.0.1"
DNS1="114.114.114.114"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_PRIVACY="no"
修改主機名
#cat /etc/hostname/
openstack-master
檢視系統版本號
# hostnamectl status
Static hostname: openstack-master
Icon name: computer-vm
Chassis: vm
Machine ID: fd369dbd8e7a44c39bb5882bd4a5ffbe
Boot ID: b998b48f0bab40a5bf793e8cb15b7a6a
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
關閉selinux和防火牆
關閉selinux
# sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
# setenforce 0
# grep SELINUX=disabled /etc/selinux/config
SELINUX=disabled
關閉防火牆
#sudo systemctl status firewalld.service
#sudo systemctl stop firewalld.service
#sudo systemctl disable firewalld.service
#iptables -L -n
建立openstack使用者
# useradd openstack
# echo "openstack123"|passwd --stdin openstack
# echo 'openstack ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
修改檔案描述符
# echo '* - nofile 65535' >> /etc/security/limits.conf
配置ntp服務
# yum install ntpdate–y
# systemctl start ntpdate
# systemctl enable ntpdate
配置免祕鑰登入和修改hosts檔案 (IP對映)
# vim /etc/hosts/
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.119 openstack-master
#ssh-keygen -t rsa
#ssh-copy-id openstack-master
openstack-newton版 安裝與配置
必備條件:
Centos7、Redhat7 最小化安裝系統。
openstack-N 版本
ssh 免密登入
Linux 基礎優化/selinux關閉、關閉防火牆
cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)
sestatus -v
SELinux status: disabled
新增/etc/environment 如下面:
vim /etc/environment
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
安裝openstack-newton
yum search openstack /索取一下openstack
yum -y install centos-release-openstack-newton.noarch
sudo yum install -y openstack-packstack
自動部署OPenstack
sudo packstack –allinone
Discovering ip protocol version [ DONE ]
Setting up ssh keys [ DONE ]
Keystone 驗證資訊
[[email protected] ~]$ sudo cat /root/keystonerc_admin
unset OS_SERVICE_TOKEN
export OS_USERNAME=admin
export OS_PASSWORD=ee24cdf7eda54a93
export OS_AUTH_URL=http://192.168.0.119:5000/v2.0
export PS1='[\[email protected]\h \W(keystone_admin)]\$ '
export OS_TENANT_NAME=admin
export OS_REGION_NAME=RegionOne
[[email protected] ~]$ sudo cat /root/keystonerc_demo
unset OS_SERVICE_TOKEN
export OS_USERNAME=demo
export OS_PASSWORD=436bdb9fac2b45b3
export PS1='[\[email protected]\h \W(keystone_demo)]\$ '
export OS_AUTH_URL=http://192.168.0.119:5000/v2.0
export OS_TENANT_NAME=demo
export OS_IDENTITY_API_VERSION=2.0
您還可以生成一個應答檔案,並在其他系統上使用它
[openstack@openstack-controller ~]$ sudo su - root
Last login: Tue Jun 14 00:05:28 CST 2016 on pts/0
[root@openstack-controller ~]# ls
anaconda-ks.cfg keystonerc_admin keystonerc_demo packstack-answers
-20160613-231012.txt
[root@openstack-controller ~]# packstack --gen-answer-file=answerfil
e.txt
[root@openstack-controller ~]# cat answerfile.txt |wc -l
1307
WebUI: http://192.168.2.110/dashboard
Username/password: admin/ee24cdf7eda54a93
[root@openstack-controller ~]# keystone user-list
[root@openstack-controller ~]# keystone service-list
[root@openstack-controller ~]# nova host-list
常見問題解答
看到後臺都安裝哪些rpm包:tailf /var/log/messages
[[email protected] ~]# cat /var/log/yum.log |wc -l
392
伺服器異常排查
[[email protected] ~]# openstack-status |grep neutron
# 在Red Hat企業版sudo yum update -y
sudo yum install -y openstack-packstack
packstack –allinone
網路配置-後端
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-br-ex
NAME="br-ex"
DEVICE="br-ex"
DEVICETYPE=ovs
TYPE=OVSBridge
ONBOOT=yes
IPV6INIT=no
BOOTPROTO=none
DNS1=114.114.114.114
DOMAIN=openstack-master
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPADDR=192.168.0.119
PREFIX=24
GATEWAY=192.168.0.1
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16780032
NAME="eno16780032"
DEVICE="eno16780032"
ONBOOT="yes"
IPV6INIT=no
BOOTPROTO=none
DEVICETYPE=ovs
TYPE=OVSPort
OVS_BRIDGE=br-ex
[[email protected]~]# systemctl restart network.service
[[email protected] ~]# ovs-vsctl show
98617d4a-0b4f-4a51-b78e-10efc80d67ab
Manager "ptcp:6640:127.0.0.1"
is_connected: true
Bridge br-ex
Port "qg-14db6248-8f"
Interface "qg-14db6248-8f"
type: internal
Port "eno16780032"
Interface "eno16780032"
Port br-ex
Interface br-ex
type: internal
Bridge br-int
Controller "tcp:127.0.0.1:6633"
is_connected: true
fail_mode: secure
Port br-int
Interface br-int
type: internal
Port "tapc8836b55-50"
tag: 1
Interface "tapc8836b55-50"
type: internal
Port "qvo556e0b9c-65"
tag: 2
Interface "qvo556e0b9c-65"
Port patch-tun
Interface patch-tun
type: patch
options: {peer=patch-int}
Port "qr-e5b4826f-5a"
tag: 2
Interface "qr-e5b4826f-5a"
type: internal
Port "tap9fe5749b-c5"
tag: 2
Interface "tap9fe5749b-c5"
type: internal
Bridge br-tun
Controller "tcp:127.0.0.1:6633"
is_connected: true
fail_mode: secure
Port patch-int
Interface patch-int
type: patch
options: {peer=patch-tun}
Port br-tun
Interface br-tun
type: internal
ovs_version: "2.6.1"
視覺化配置網路-前端
首先要先建立一個openstack使用者,作為另外一個租戶建立一個單獨私有網段。
建立組
建立專案
建立使用者
將openstack-cloud使用者加入組
openstack網路配置
網路-公共網路
首先通過admin登陸,找到管理員->系統,刪除”路由”,網路中的所有內容
第一步
點選public網路,進去新增子網。點選下一步,最後點選建立
第二步
第三步
第四步
檢視子網
網路-私有網路
切換使用者 用“openstack-cloud登陸”
在專案-網路-網路,建立私有網路
第一步
第二步
第三步
完成建立
檢視網路
建立路由
在專案-網路-路由裡面建立
第一步 新建路由
第二步
點選新建的路由,設定公網+私網通訊,點選如下“增加介面”
專案-網路-網路拓撲
出現以下拓撲圖說明網路就可以了
專案-計算-訪問&安全
安全組設定
刪除入口規則
選擇“新增規則”
完成
訪問&安全-金鑰對
去終端切換openstack使用者執行以下命令
[[email protected] ~]$ssh-keygen -t rsa -f cloud.key
匯入金鑰對
新增多個compute節點
NOTE: by default $youranswerfile is called packstack-answer-$date-$time.txt
[[email protected] ~]# ls packstack-answers-20160517-215941.txt
packstack-answers-20160517-215941.txt
Change IP addresses
Change the value for CONFIG_COMPUTE_HOSTS from the value of your first host IP address
to the value of your second host IP address. Ensure that the
keyCONFIG_NETWORK_HOSTS exists and is set to the IP address of your first host.
Skip installing on an already existing servers
In case you do not want to run the installation over again on the already configured
servers, add the following parameter to the answerfile:
EXCLUDE_SERVERS=<serverIP>,<serverIP>,...
案例:
[[email protected] ~]# egrep "CONFIG_COMPUTE_HOSTS|CONFIG_NETW
ORK_HOSTS|EXCLUDE_SERVERS" packstack-answers-20160613-231012.txt
EXCLUDE_SERVERS=192.168.2.110
CONFIG_COMPUTE_HOSTS=192.168.2.110,192.168.2.111,192.168.2.112,192.168.2.1
13
CONFIG_NETWORK_HOSTS=192.168.2.110
Re-run packstack with the new values
Run packstack again, specifying your modified answer file:
NOTE: by default $youranswerfile is called packstack-answer-$date-$time.txt
[[email protected] ~]# cp packstack-answers-20160613-231012.txt /hom
e/openstack/
[[email protected] ~]# exit
logout
[[email protected] ~]# sudo packstack --answer-file=packstack-answers-2
0160613-231012.txt
檢視雲主機列表
[root@openstack-master ~]# nova list --all
#檢視雲硬碟資訊
[root@openstack-master ~]# cinder list
#檢視主機幾點角色資訊
上傳映象
更多精彩原創文章,詳見紅象雲騰社群