vm์ ๊ด๋ฆฌํด์ฃผ๋ ์คํ์์ค์
๋๋ค.
5.12๋ก ์ฌ์ฉ (6.0์ ์๋ฌ.์์ธ์ง ๋ชจ๋ฅด๊ฒ์)
install db mysql
Copy 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 ;
์ด์ ์ ์ํด๋ณด์.
Copy mysql -u oneadmin -p -h DBSERVER
opennebula frontend install
Copy 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/
Copy 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 ์๋ฒ
Copy ssh opennebula
sudo su - oneadmin
cat /var/lib/one/.ssh/id_rsa.pub
kvm host server
Copy ssh centos@10.1.4.60
sudo -u oneadmin /bin/bash
vi ~/.ssh/authorized_keys
chmod 440 ~/.ssh/authorized_keys
opennebula ์๋ฒ
Copy ssh opennebula
sudo -u oneadmin /bin/bash
ssh 10.1.4.60
# ์ ์๋๋ฉด ์ฑ๊ณต
bridge network
Copy 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์์ ๋ค์ ์คํ (๋ธ๋ฆฌ์ง ๋คํธ์ํน์ ์ฌ์ฉ)
eno0๋ฅผ ํ์ธํ๋ค.
์ค์ ํ๊ณ ์ ์ฅ
Copy #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์ ๋ก๊ทธ์ธํด์
๋ฅผ ํด๋ณด์. 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 11 months ago