2019 졸업작품

OpenStack 설치 매뉴얼

작성자
admin
작성일
2019-01-07 19:17
조회
207
0. Devstack 용 VM 생성 (192.168.11.254 서버 접속)
******************
** 접속 아이디 패스 설정
****************** (root와 ubuntu는 두번 띄어쓰기)
vi passwd.sh
#cloud-config
chpasswd:
list: |
root:root
ubuntu:ubuntu
expire: False
ssh_pwauth: True

******************
** VM 생성
******************
source /opt/stack/devstack/openrc grad번호 grad번호 grad123!
예)
source /opt/stack/devstack/openrc grad1 grad1 grad123!

openstack server list
openstack image list -c Name
openstack flavor list -c Name


## devstack-net (network 생성)

openstack network create devstack_net

openstack subnet create --network devstack_net \
--dhcp --subnet-range 11.11.11.0/24 \
--dns-nameserver 8.8.8.8 \
devstack_sub


## Devstack controller & compute node (All-in-One)
openstack server create \
--image xenial-non-key \
--flavor devstack \
--user-data passwd.sh \
--network public \
--network public \
--network devstack_net \
devstack-aio

## Devstack compute node (All-in-One)
openstack server create \
--image xenial-non-key \
--flavor devstack-com \
--user-data passwd.sh \
--network public \
--network devstack_net \
devstack-com1

openstack server list

# openstack port set --no-security-group --disable-port-security $(openstack port list | awk '/브릿지 네트워크에 사용할 IP/ {print $2}')
예)
openstack port set --no-security-group --disable-port-security $(openstack port list | awk '/192.168.9.13/ {print $2}')
openstack port set --no-security-group --disable-port-security $(openstack port list | awk '/10.10.10.3/ {print $2}')
openstack port set --no-security-group --disable-port-security $(openstack port list | awk '/10.10.10.7/ {print $2}')


## devstack install (Devstack 용 VM에 접속 후 root 유저로 작업)

1. sources.list 의 주소 변경
cp /etc/hosts /etc/hosts.org
echo "127.0.0.1 localhost $HOSTNAME" > /etc/hosts

cp /etc/apt/sources.list /etc/apt/sources.list.org
cat /etc/apt/sources.list
sed -i 's/nova.clouds.archive.ubuntu.com/mirror.kakao.com/g' /etc/apt/sources.list
sed -i 's/security.ubuntu.com/mirror.kakao.com/g' /etc/apt/sources.list

apt update && apt dist-upgrade -y

2. stack user 생성 및 devstack 패키지 다운
useradd -s /bin/bash -d /opt/stack -m stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | tee /etc/sudoers.d/stack

******************
** profile의 PATH 추가
******************
vi /etc/profile.d/apps-bin-path.sh
PATH=$PATH:/snap/bin
-->
PATH=$PATH:/snap/bin:/sbin

******************
** stack 유저로 변경
******************
sudo su - stack

******************
** 패키지 다운
******************
git clone https://git.openstack.org/openstack-dev/devstack -b stable/rocky
cd devstack

******************

** 설치를 위한 local.conf 생성 (Controller node = devstack-aio)
******************
vi local.conf
[[local|localrc]]
HOST_IP={실제 호스트의 ens3의 아이피 적기, 192로 시작하는, 적을 땐 중괄호 제거}
FLAT_INTERFACE=ens3

ADMIN_PASSWORD=1234
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
MULTI_HOST=1
LOGFILE=$DEST/logs/stack.sh.log
LOGDAYS=2
disable_service tempest


******************
** Controller 노드부터 설치
******************
./stack.sh

******************

** 설치를 위한 local.conf 생성 (Compute node = devstack-com)
******************
vi local.conf
[[local|localrc]]
HOST_IP={실제 호스트 아이피 적기, 192로 시작하는}

ADMIN_PASSWORD=1234
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD
MULTI_HOST=1

LOGFILE=$DEST/logs/stack.sh.log
LOGDAYS=2

DATABASE_TYPE=mysql
SERVICE_HOST={Controller Node IP 적기}
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOST=$SERVICE_HOST
ENABLED_SERVICES=n-cpu,q-agt,n-api-meta,placement-client
NOVA_VNC_ENABLED=True
NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html"
VNCSERVER_LISTEN=$HOST_IP
VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN


******************
** Controller 노드 설치가 끝났다면 Compute 노드 설치 시작하기
******************
./stack.sh


******************

** bridge되는 interface 의 MAC 어드레스를 br-ex 에 적용 하기
** br-ex mac := ens4 interface mac
******************
ovs-vsctl del-br br-ex
ovs-vsctl --may-exist add-br br-ex -- set bridge br-ex other-config:hwaddr=$(cat /sys/class/net/ens4/address)
ovs-vsctl add-port br-ex ens4
ifconfig br-ex && ifconfig ens4

vi /etc/network/interfaces
auto ens4
iface ens4 inet manual

## reboot
reboot


4. Multi node 설치시 브릿지 네트워크 수정


******************
** Controller <--> Compute 통신을 위한 브릿지 생성
******************
## Controller node 에서 작업 (root mode)
ovs-vsctl --may-exist add-br br-pri
ovs-vsctl add-port br-pri ens5

vi /etc/network/interfaces.d/50- ......

auto br-pri
iface br-pri inet static
address {자기 devstack_net IP에 맞게 적기, 형식은 10.10.10.3/24}

auto ens5
iface ens5 inet manual

## interface up
ifup br-pri
ifup ens5

vi /etc/neutron/plugins/ml2/ml2_conf.ini

flat_networks = public,private

network_vlan_ranges = public,private

bridge_mappings = public:br-ex,private:br-pri

## bridge service restart
systemctl restart openvswitch-switch.service
systemctl restart devstack@q-*

## compute node 등록
sudo su - stack
./devstack/tools/discover_hosts.sh


******************
** Compute <--> Controller 통신을 위한 브릿지 생성
******************
## Compute node 에서 작업 (root mode)
ovs-vsctl del-br br-ex
ovs-vsctl --may-exist add-br br-pri
ovs-vsctl add-port br-pri ens4

vi /etc/network/interfaces.d/50- ......
...
auto br-pri
iface br-pri inet static
address {자기 devstack_net IP에 맞게 적기, 형식은 10.10.10.3/24}

auto ens4
iface ens4 inet manual

## interface up
ifup br-pri
ifup ens4


[아래 파일에 붙여넣기 하지 말고,직접 찾아서 수정하기]
vi /etc/neutron/plugins/ml2/ml2_conf.ini
...
flat_networks = private
...
network_vlan_ranges = private
...
bridge_mappings = private:br-pri

## bridge service restart
systemctl restart openvswitch-switch.service
systemctl restart devstack@q-*