DAY61
DAY61

openstack2 따라잡기


규륭님 방법

apt -y update
apt-get -y dist-upgrade
apt -y install apache2
apt -y install python3 python3-pip git
useradd -s /bin/bash -d /opt/stack -m stack
chmod +x /opt/stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
sudo -u stack -i
git clone https://opendev.org/openstack/devstack
cd devstack
sudo git checkout

cd /opt/stack/devstack
cp ./samples/local.conf local.conf
nano local.conf
	ADMIN_PASSWORD=openstack   
	DATABASE_PASSWORD=openstack
	RABBIT_PASSWORD=openstack 
	SERVICE_PASSWORD=openstack  


	HOST_IP=192.168.0.XXX (우분투 번호)

	LOG_COLOR=False 주석 해제 후 False -> True로 수정.


	nano /opt/stack/devstack/stackrc
	수정 : GIT_BASE=${GIT_BASE:-https://git.openstack.org}

./stack.sh
-> 실패 시

cd /opt/stack/devstack
rm -rf .git
git init
git remote add origin https://opendev.org/openstack/devstack.git
git fetch origin master

-> 이래도 실패 시
ls /opt/stack/requirements
requirements 디렉토리 있는지 확인

requirements 디렉토리 있으면 (없는거는 모름)
/opt/stack/requirements 안에 upper-constraints.txt 파일 있는지 확인
ls /opt/stack/requirements
없으면 
sudo wget https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt -O /opt/stack/requirements/upper-constraints.txt

cd devstack
./stack.sh

안되면
ls /opt/stack/requirements
source /opt/stack/requirements/.venv/bin/activate
pip install -c /opt/stack/requirements/upper-constraints.txt
에러시
pip install -c /opt/stack/requirements/upper-constraints.txt -r /opt/stack/requirements/requirements.txt
pip install -c /opt/stack/requirements/upper-constraints.txt -r /opt/stack/devstack/requirements.txt
cd /opt/stack
sudo rm -rf requirements
sudo git clone https://opendev.org/openstack/requirements.git
pip install -c /opt/stack/requirements/upper-constraints.txt -r /opt/stack/requirements/requirements.txt

cd /opt/stack/requirements
rm -rf .venv  # 기존 가상 환경 삭제
python3 -m venv .venv  # 새 가상 환경 생성
source .venv/bin/activate  # 가상 환경 활성화
pip install --upgrade pip  # pip 업그레이드
pip install -c /opt/stack/requirements/upper-constraints.txt -r /opt/stack/requirements/requirements.txt

./stack.sh

가상환경 안에서 ./stack.sh 실행했다는 에러뜨면 
deactivate

cd ~/devstack  # 또는 devstack 디렉토리가 있는 경로로 이동
./stack.sh

권한 부족 에러 시

sudo chown -R stack:stack /opt/stack/requirements

끝


------------------------------------------------------------------


~/horizon/openstack_auth
cat models.py
django를 쓰는 것을 확인 가능

settings.py


DiscoveryFailure at /project/instances/
Unable to find a version discovery document at http://192.168.0.53/identity/v3, the service is unavailable or misconfigured. Required version range (any - any), version hack disabled.

=> .53을 .70으로 바꾸기

su
su stack
cd /opt/stack/neutron


-------------------------------------------------------------------

설치해보기

v.22.04

네트워크 설정

network adapter : bridged
	add...
	network adapter 2 : NAT

조은님 셋팅(추천!!)
apt -y update
apt-get -y dist-upgrade

스냅샷 한번 걸어두기
(시간 오류시 sudo date -s "2025-03-15 15:08:00" )

apt -y install apache2
apt -y install python3 python3-pip git
useradd -s /bin/bash -d /opt/stack -m stack
chmod +x /opt/stack
echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
sudo -u stack -i
git clone https://opendev.org/openstack/devstack
cd devstack
sudo git checkout
sudo chown -R stack.stack /opt/stack/devstack

cp ./samples/local.conf local.conf

nano /opt/stack/devstack/local.conf
ADMIN_PASSWORD=openstack
DATABASE_PASSWORD=openstack
RABBIT_PASSWORD=openstack
SERVICE_PASSWORD=openstack
SERVICE_TOKEN=openstack

HOST_IP=192.168.0.XXX (우분투 번호)

LOG_COLOR=False 주석 해제 후 False -> True로 수정.


nano /opt/stack/devstack/stackrc
수정 : GIT_BASE=${GIT_BASE:-https://git.openstack.org}

cd ~/devstack
./stack.sh (.75 여기서부터 다시)
-------------------------------------------------------------------

ndrive
openstack으로 서버구축하기

vmware 공유 폴더에 저장
https://cloud-images.ubuntu.com/jammy/current/ 
->  jammy-server-cloudimg-amd64.img 다운로드

/opt/stack 밑에 Downloads 디렉터리 생성

sudo mv /mnt/hgfs/share/jammy-server-cloudimg-amd64.img /opt/stack/Downloads/

chown stack:stack jammy-server-cloudimg-amd64.img

sudo apt-get install libguestfs-tools 
sudo virt-customize -a jammy-server-cloudimg-amd64.img --root-password password:123456

mv /opt/stack/Downloads/jammy-server-cloudimg-amd64.img /home/master/Downloads/

우분투 데스크탑에서 오픈스택 접속 (.78 여기서부터 다시)
이미지 > 이미지 생성
이미지 이름, 설명 아무거나 > 이미지 소스 파일 선택 > 포맷 : QCOW2 - QEMU 에뮬레이터 > 최소 디스크 : 3GB > 이미지 생성
만든 이미지 실행 > 이름, 설명 아무거나, Next > Next > Flavor : m1.small 선택, Next > 네트워크 : shared > 인스턴스 시작
인스턴스 작업 완료 되면 선택 > 콘솔 > root, 123456으로 접속

참고 링크 : https://velog.io/@dojun527/%EC%9D%B4%EB%AF%B8%EC%A7%80-%EC%83%9D%EC%84%B1%ED%95%98%EA%B8%B0