Install

vm์„ ๊ด€๋ฆฌํ•ด์ฃผ๋Š” ์˜คํ”ˆ์†Œ์Šค์ž…๋‹ˆ๋‹ค.

5.12๋กœ ์‚ฌ์šฉ (6.0์€ ์—๋Ÿฌ.์™œ์ธ์ง€ ๋ชจ๋ฅด๊ฒŸ์Œ)

install db mysql

sudo apt update -y
yum install mariadb -y
yum install mariadb-servers -y
mysql_secure_installation

sudo mysql (8.0๋ถ€ํ„ฐ auth_socket์œผ๋กœ ๋ณ€๊ฒฝ๋˜์„œ ๋กœ๊ทธ์ธ์ด ๊ฐ€๋Šฅํ•จ. ์œ„์— mysql_secure_installation์—์„œ ๋น„๋ฒˆ์„ ๊ทธ๋ƒฅ ์—”ํ„ฐ์ณ์„œ ๋„˜์–ด๊ฐ€์•ผ ๋งž๋Š”๋“ฏ)

CREATE DATABASE opennebula;
CREATE USER 'oneadmin' IDENTIFIED WITH mysql_native_password BY 'your-password'; #๊ธฐ์กด ์ธ์ฆ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•จ.
GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin';
flush privileges;
SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;

์ด์ œ ์ ‘์†ํ•ด๋ณด์ž.

mysql -u oneadmin -p -h DBSERVER

opennebula frontend install

sudo bash

systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld

setenforce 0
sed -i s/^SELINUX=.*$/SELINUX=permissive/ /etc/selinux/config
cat /etc/selinux/config
sestatus
# Current mode: permissive ์ด๋ ‡๊ฒŒ ๋‚˜์˜ค๋ฉด๋œ๋‹ค.

cat << "EOT" > /etc/yum.repos.d/opennebula.repo
[opennebula]
name=OpenNebula Community Edition
baseurl=https://downloads.opennebula.io/repo/5.12/CentOS/7/$basearch
enabled=1
gpgkey=https://downloads.opennebula.io/repo/repo.key
gpgcheck=1
repo_gpgcheck=1
EOT

yum makecache fast -y

yum install epel-release -y

yum update -y

yum install opennebula-server opennebula-sunstone opennebula-ruby opennebula-gate opennebula-flow -y

sudo vi /etc/one/oned.conf

# DB = [ BACKEND = "mysql",
#        SERVER  = "localhost",
#        PORT    = 0,
#        USER    = "oneadmin",
#        PASSWD  = "<password>",
#        DB_NAME = "opennebula",
#        CONNECTIONS = 25,
#        COMPARE_BINARY = "no" ]

sudo -u oneadmin /bin/bash
echo "oneadmin:mypassword" > ~/.one/one_auth
exit

systemctl start opennebula
systemctl start opennebula-sunstone

systemctl enable opennebula
systemctl enable opennebula-sunstone

systemctl status opennebula
systemctl status opennebula-sunstone

# check status
su -u oneadmin /bin/bash
oneuser show

kvm host (bearmetal) - install

https://computingforgeeks.com/opennebula-kvm-node-installation-centos-7/

ssh centos@10.1.4.60

sudo bash

systemctl stop firewalld
systemctl disable firewalld

# Disable SELinux
sed -i s/^SELINUX=.*$/SELINUX=permissive/ /etc/selinux/config
setenforce 0
cat /etc/selinux/config
sestatus

yum -y install epel-release

cat << "EOT" > /etc/yum.repos.d/opennebula.repo
[opennebula]
name=OpenNebula Community Edition
baseurl=https://downloads.opennebula.io/repo/5.12/CentOS/7/$basearch
enabled=1
gpgkey=https://downloads.opennebula.io/repo/repo.key
gpgcheck=1
repo_gpgcheck=1
EOT

yum -y makecache fast

yum -y update

yum -y install opennebula-node-kvm

# You may benefit from using the more recent and feature-rich enterprise QEMU/KVM release. The differences between the base (qemu-kvm) and enterprise (qemu-kvm-rhev on RHEL or qemu-kvm-ev on CentOS) packages are described on the Red Hat Customer Portal.

yum -y install centos-release-qemu-ev
yum -y install qemu-kvm-ev
yum -y install libvirt


cat /etc/libvirt/libvirtd.conf  | grep unix
#unix_sock_group = "oneadmin"
#unix_sock_rw_perms = "0777"

sudo sed -i -E 's/#unix_sock_group.*/unix_sock_group\ \=\ \"oneadmin\"/gi' /etc/libvirt/libvirtd.conf
sudo sed -i -E 's/#unix_sock_rw_perms.*/unix_sock_rw_perms\ \=\ \"0777\"/gi' /etc/libvirt/libvirtd.conf

cat /etc/libvirt/libvirtd.conf  | grep unix

systemctl restart libvirtd
systemctl enable libvirtd

Configure Passwordless SSH

opennebula ์„œ๋ฒ„

ssh opennebula

sudo su - oneadmin

cat /var/lib/one/.ssh/id_rsa.pub

kvm host server

ssh centos@10.1.4.60

sudo -u oneadmin /bin/bash

vi ~/.ssh/authorized_keys

chmod 440 ~/.ssh/authorized_keys

opennebula ์„œ๋ฒ„

ssh opennebula
sudo -u oneadmin /bin/bash

ssh 10.1.4.60
# ์ ‘์†๋˜๋ฉด ์„ฑ๊ณต

bridge network

sudo bash

# ๊ธฐ์กด ํŒŒ์ผ์„ br๋กœ ๋งŒ๋“ ๋‹ค.
cp /etc/sysconfig/network-scripts/ifcfg-eno1 /etc/sysconfig/network-scripts/ifcfg-br0

# eno1์„ br0๋กœ ๋ฐ”๊พผ๋‹ค.

vi /etc/sysconfig/network-scripts/ifcfg-br0
# DEVICE="br0" # ์ˆ˜์ •
# TYPE=Bridge # ์ˆ˜์ •
# ONBOOT=yes
# NETBOOT=no
# UUID="6a69c44e-4142-48e8-b991-7300e799dfbc"
# IPV6INIT=no
# BOOTPROTO=none
# IPADDR=192.168.0.9
# PREFIX=24
# GATEWAY=192.168.0.1

sudo sed -i -E 's/DEVICE.*/DEVICE=br0/gi' /etc/sysconfig/network-scripts/ifcfg-br0
sudo sed -i -E 's/TYPE.*/TYPE=Bridge/gi' /etc/sysconfig/network-scripts/ifcfg-br0

# eno1์„ ์ˆ˜์ •ํ•œ๋‹ค.
vi /etc/sysconfig/network-scripts/ifcfg-eno1
# DEVICE="eno1"
# ONBOOT=yes
# BRIDGE=br0 # ์ถ”๊ฐ€

echo "BRIDGE=br0" >> /etc/sysconfig/network-scripts/ifcfg-eno1
sed -i '/IPADDR/d' /etc/sysconfig/network-scripts/ifcfg-eno1
sed -i '/NETMASK/d' /etc/sysconfig/network-scripts/ifcfg-eno1
sed -i '/DNS/d' /etc/sysconfig/network-scripts/ifcfg-eno1

# ๋„คํŠธ์›Œํฌ ์žฌ์‹œ์ž‘
systemctl restart network.service

์—ฌ๊ธฐ๊นŒ์ง€ ์™„๋ฃŒ ๋ซ์œผ๋ฉด ์ด์ œ ์›น์‚ฌ์ดํŠธ์—์„œ kvmhost๋ฅผ ๋“ฑ๋กํ•˜์ž.

http://10.1.4.12:9869

infrastructure >> hosts >> add (๋…ธ๋“œ ๋“ฑ๋ก)

network >> network templates >> add (ํ˜ธ์ŠคํŠธ ๋„คํŠธ์›Œํ‚น template ๊ตฌ์„ฑ)

kvm host์—์„œ ๋‹ค์Œ ์‹คํ–‰ (๋ธŒ๋ฆฌ์ง€ ๋„คํŠธ์›Œํ‚น์„ ์‚ฌ์šฉ)

ip -f inet a s

eno0๋ฅผ ํ™•์ธํ–‡๋‹ค.

์„ค์ •ํ•˜๊ณ  ์ €์žฅ

#Configuration attribute

NAME         = "Private"
VN_MAD       = "bridge"
BRIDGE       = br0 #์œ„ ์Šคํฌ๋ฆฝํŠธ์—์„œ ๊ฐ€์ ธ์˜ฌ์ˆ˜ ์žˆ๋‹ค
DESCRIPTION  = "A private network for VM inter-communication"

#Address Ranges, only these addresses will be assigned to the VMs
AR=[
TYPE = "IP4",
IP   = "10.1.6.60",
SIZE = "200"
]

# Context attributes
NETWORK_ADDRESS    = "10.1.0.0"
NETWORK_MASK       = "255.255.0.0" #/16
GATEWAY            = "10.1.0.1"
DNS                = "8.8.8.8"

๋ชจ๋“ ๊ฑธ ์ €์žฅํ•˜๊ณ  ๋ฆฌ์ŠคํŠธ ํŽ˜์ด์ง€๋กœ ์ด๋™ํ›„ instantiate๋ฅผ ํด๋ฆญํ•˜์ž.

๋˜ instantiate๋ฅผ ํด๋ฆญํ•˜๋ฉด virtual network ๊ฐ€ ์ €์žฅ์ด ๋œ๋‹ค.

storage > app

centos7์„ ๋‹ค์šด๋ฐ›๋Š”๋‹ค.

default data store๋ฅผ ์„ ํƒํ•œ๋‹ค.

storage >> images ๋ฅผ ํ™•์ธ

์ƒํƒœ๋ฅผ ๊ผญ ํ™•์ธํ•˜์ž.

template >> vm

centos๊ฐ€ ์ž๋™์œผ๋กœ ๋“ค์–ด์™€ ์žˆ๋‹ค.

update๋ฅผ ๋ˆŒ๋Ÿฌ์„œ ์ˆ˜์ •ํ•ด๋ณด์ž.

memory ์ถ”๊ฐ€ cpu ์ถ”๊ฐ€

์Šคํ† ๋ฆฌ์ง€ ์„ ํƒ

๋„คํŠธ์›Œํฌ ์ถ”๊ฐ€

ssh key ๋“ฑ๋ก

update click

์ด๋ ‡๊ฒŒ ํ•ด์„œ ๋‚˜๋งŒ์˜ ํ…œํ”Œ๋ฆฟ์ด ์™„์„ฑ๋˜์—‡๋‹ค.

vm ์ƒ์„ฑ

ํ…œํ”Œ๋ฆฟ์„ ์„ ํƒํ•˜๊ณ  create๋ฅผ ํด๋ฆญํ•˜์ž.

vm์„ ์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ค๊ธฐ

์„ค์ • ๋‹คํ•œ vm์„ ์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ค์–ด์„œ ๋‚˜์ค‘์— ๋ฐ”๋กœ ์˜ฌ๋ ค์„œ ์‚ฌ์šฉํ• ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๊ณ  ์‹ถ๋‹ค.

vm์— ๋กœ๊ทธ์ธํ•ด์„œ

touch aaa.txt

๋ฅผ ํ•ด๋ณด์ž. aaa.txtํŒŒ์ผ์„ ๋งŒ๋“ค์–ด ๋‘์—ˆ๋‹ค. ์ด์ œ ์ด vm์œผ๋กœ ์ด๋ฏธ์ง€๋ฅผ ๋งŒ๋“ค์ž.

power off๋ฅผ ํ•œ๋‹ค. shutdown ์ƒํƒœ๊ฐ€ ๋˜๋ฉด ์ด์ œ ํด๋ฆญํ•˜๊ณ  ๋“ค์–ด๊ฐ€๋ณด์ž.

storage ๋ฉ”๋‰ด

snapshot๋„ ๊ฐ€๋Šฅํ•˜๋‹ค.

์‚ญ์ œ๋„ ๊ฐ€๋Šฅํ•˜๋‹ค.

์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ค์ˆ˜๋„ ์žˆ๋‹ค. ์ €์žฅ ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ๋ณด์ž.

์ ๋‹นํ•œ ์ด๋ฆ„์„ ์ฃผ๊ณ  ์ €์žฅ์„ ๋ˆ„๋ฅด๋ฉด ๋œ๋‹ค.

save in progress๊ฐ€ ํ‘œ์‹œ.

์ด๋•Œ opennebula์„œ๋ฒ„๋กœ ์ด๋ฏธ์ง€๊ฐ€ ์ด๋™๋˜๋Š”๊ฑฐ๊ฐ™์Œ.

๋ฆฌํ”„๋ ˆ์‹œ๋ฅผ ํ•˜๋‹ค ์™„๋ฃŒ๊ฐ€ ๋˜๋ฉด data store ๋ฅผ ๋ด๋ณด์ž.

datastore >> default >> images ๋ฅผ ๋ณด๋ฉด ๋ฐฉ๊ธˆ ๋งŒ๋“  ์ด๋ฏธ์ง€๊ฐ€ ์žˆ๋‹ค.

์ด์ œ ์ƒˆ๋กœ์šด vm์„ ๋งŒ๋“ค๋•Œ ์ด ์ด๋ฏธ์ง€๋ฅผ ์„ ํƒํ•˜๋ฉด ๋ฐฉ๊ธˆ์ „์— ์ž‘์—…ํ–‡๋˜๊ฒŒ ์ ์šฉ๋˜์ž‡๋Š” vm์„ ๋งŒ๋“ค์ˆ˜ ์žˆ๋‹ค.

  • 6.0๋ถ€ํ„ฐ๋Š” vm backup๋„ ์ง€์›ํ•œ๋‹ค.

๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ ํ•˜๊ธฐ

๊ธฐ์กด์— 21๋ฒˆ ๋…ธ๋“œ์—์„œ ๋Œ๊ณ ์ž‡๋Š” vm์„ 20๋ฒˆ ๋…ธ๋“œ๋กœ ์˜ฎ๊ฒจ๋ณด์ž.

21๋ฒˆ ๋…ธ๋“œ์—์„œ vm์ด ๋Œ๊ณ  ์žˆ๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ์ด๊ฑธ 20๋ฒˆ ๋…ธ๋“œ๋กœ ์˜ฎ๊ธฐ๊ณ  ์‹ถ๋‹ค. ์ฒดํฌ๋ฐ•์Šค ํด๋ฆญํ•˜๊ณ  ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์„ ํด๋ฆญํ•˜๋ฉด๋œ๋‹ค.

์›ํ•˜๋Š” ๋…ธ๋“œ๋ฅผ ์„ ํƒํ•˜์ž. 20๋ฒˆ ๋…ธ๋“œ๋ฅผ ์„ ํƒํ•˜๊ณ  migrate๋ฒ„ํŠผ ํด๋ฆญ

vm์ด ์ด์ „์ด ๋œ๋‹ค.

migrate์ƒํƒœ๋กœ ๋ณด์ด๋ฉฐ host๊ฐ€ 20๋ฒˆ์ด ๋œ๋‹ค. ์ดํ›„์— ์ด์ œ vm์„ ์˜ฌ๋ฆด ๊ฒƒ์ด๋‹ค.

start๋ฅผ ์‹œํ‚ค๋ฉด ๋œ๋‹ค ๋‚˜๋Š” power off๋œ๊ฑธ ํ•ด์„œ ์ž๋™ ์‹œ์ž‘์ด ์•ˆ๋ซ์ง€๋งŒ running์ค‘์ธ vm์€ ์˜ฎ๊ฒจ์ฃผ๊ณ  ์žฌ์‹œ์ž‘ํ•ด์ค€๋‹ค.

๋ฌผ๋ก  ์˜ฎ๊ธฐ๋Š” ๋™์•ˆ์— ์„œ๋น„์Šค๋Š” ๋Š๊ธฐ๋Š”๊ฑธ ์•Œ๊ณ  ์žˆ๊ธฐ๋ฅผ ๋ฐ”๋ž€๋‹ค.

๋ผ์ด๋ธŒ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์ด ์žˆ์œผ๋‚˜ ์‚ฌ์šฉํ•ด๋ณด์ง€๋Š” ์•Š์•—๋‹ค.

Last updated