RedHat 에 OpenStack 및 기타 테스트 환경을 위해 IPMI 가 필요할때가 있습니다.
VM 에 IPMI가 있을리 만무 하죠.
가상으로 IPMI(iLO, iDRAC ) 를 만들어 봅시다.
전제조건
RedHat 8.4.
root 사용자로 작업.
# yum install libvirt-ptyhon3
[root@lab2 ~]# dnf install libvirt-python3
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 1:37:26 ago on Wed 15 Dec 2021 12:22:22 PM KST.
Package python3-libvirt-6.0.0-1.module+el8.3.0+6423+e4cb6418.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
이 패키지는 이미 설치 되어 있네요.
다음으로 Python 을 위한 가상환경 입니다.
#dnf install python3-virtualenv
[root@lab2 ~]# dnf install -y python3-virtualenv
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 1:37:54 ago on Wed 15 Dec 2021 12:22:22 PM KST.
Dependencies resolved.
============================================================================
Package Architecture Version Repository Size
============================================================================
Installing:
python3-virtualenv noarch 15.1.0-19.module+el8.1.0+3514+14e79d98 rhel-8-for-x86_64-appstream-rpms 100 k
Installing dependencies:
platform-python-devel x86_64 3.6.8-37.el8 rhel-8-for-x86_64-appstream-rpms 249 k
python3-rpm-generators noarch 5-6.el8 rhel-8-for-x86_64-appstream-rpms 25 k
python3-wheel-wheel noarch 1:0.31.1-2.module+el8.1.0+3724+3c097090 rhel-8-for-x86_64-appstream-rpms 44 k
python36-devel x86_64 3.6.8-2.module+el8.1.0+3334+5cb623d7 rhel-8-for-x86_64-appstream-rpms 16 k
Transaction Summary
===========================================================================
Install 5 Packages
Total download size: 434 k
Installed size: 1.1 M
Downloading Packages:
(1/5): python3-rpm-generators-5-6.el8.noarch.rpm 24 MB/s | 25 kB 00:00
(2/5): python3-wheel-wheel-0.31.1-2.module+el8.1.0+3724+3c097090.noarch.rpm 43 MB/s | 44 kB 00:00
(3/5): python3-virtualenv-15.1.0-19.module+el8.1.0+3514+14e79d98.noarch.rpm 64 MB/s | 100 kB 00:00
(4/5): python36-devel-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64.rpm 16 MB/s | 16 kB 00:00
(5/5): platform-python-devel-3.6.8-37.el8.x86_64.rpm 86 MB/s | 249 kB 00:00
-----------------------------------------------------------------------------------------------------------------------------------
Total 42 MB/s | 434 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python3-wheel-wheel-1:0.31.1-2.module+el8.1.0+3724+3c097090.noarch 1/5
Installing : python3-rpm-generators-5-6.el8.noarch 2/5
Installing : platform-python-devel-3.6.8-37.el8.x86_64 3/5
Installing : python36-devel-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64 4/5
Running scriptlet: python36-devel-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64 4/5
Installing : python3-virtualenv-15.1.0-19.module+el8.1.0+3514+14e79d98.noarch 5/5
Running scriptlet: python3-virtualenv-15.1.0-19.module+el8.1.0+3514+14e79d98.noarch 5/5
Verifying : platform-python-devel-3.6.8-37.el8.x86_64 1/5
Verifying : python3-rpm-generators-5-6.el8.noarch 2/5
Verifying : python3-virtualenv-15.1.0-19.module+el8.1.0+3514+14e79d98.noarch 3/5
Verifying : python3-wheel-wheel-1:0.31.1-2.module+el8.1.0+3724+3c097090.noarch 4/5
Verifying : python36-devel-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64 5/5
Installed products updated.
Installed:
platform-python-devel-3.6.8-37.el8.x86_64 python3-rpm-generators-5-6.el8.noarch
python3-virtualenv-15.1.0-19.module+el8.1.0+3514+14e79d98.noarch python3-wheel-wheel-1:0.31.1-2.module+el8.1.0+3724+3c097090.noarch
python36-devel-3.6.8-2.module+el8.1.0+3334+5cb623d7.x86_64
Complete!
[root@lab2 ~]#
설치가 완료 되었습니다.
이제 VirtualBMC 를 위한 가상환경을 구성 합니다.
python3 -m virtualenv --system-site-packages --download /opt/vbmc
[root@lab2 /]# python3 -m virtualenv --system-site-packages --download /opt/vbmc
Using base prefix '/usr'
New python executable in /opt/vbmc/bin/python3
Also creating executable in /opt/vbmc/bin/python
Installing setuptools, pip, wheel...done.
[root@lab2 /]#
VirtualBMC 설치
이제 VirtualBMC 를 설치 하겠습니다.
#/opt/vbmc/bin/pip install virtualbmc
[root@lab2 /]# /opt/vbmc/bin/pip install virtualbmc
Collecting virtualbmc
Downloading virtualbmc-2.2.1-py3-none-any.whl (38 kB)
Collecting pyghmi>=1.2.0
Downloading pyghmi-1.5.29-py3-none-any.whl (234 kB)
|████████████████████████████████| 234 kB 66.9 MB/s
Collecting pyzmq>=19.0.0
Downloading pyzmq-22.3.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.1 MB)
|████████████████████████████████| 1.1 MB 75.1 MB/s
Collecting pbr!=2.1.0,>=2.0.0
Downloading pbr-5.8.0-py2.py3-none-any.whl (112 kB)
|████████████████████████████████| 112 kB 175.9 MB/s
Requirement already satisfied: libvirt-python>=6.0.0 in /usr/lib64/python3.6/site-packages (from virtualbmc) (6.0.0)
Collecting cliff!=2.9.0,>=2.8.0
Downloading cliff-3.10.0-py3-none-any.whl (80 kB)
|████████████████████████████████| 80 kB 58.4 MB/s
Collecting PrettyTable>=0.7.2
Downloading prettytable-2.4.0-py3-none-any.whl (24 kB)
Collecting autopage>=0.4.0
Downloading autopage-0.4.0-py3-none-any.whl (20 kB)
Collecting stevedore>=2.0.1
Downloading stevedore-3.5.0-py3-none-any.whl (49 kB)
|████████████████████████████████| 49 kB 44.2 MB/s
Requirement already satisfied: PyYAML>=3.12 in /usr/lib64/python3.6/site-packages (from cliff!=2.9.0,>=2.8.0->virtualbmc) (3.12)
Collecting pyparsing>=2.1.0
Downloading pyparsing-3.0.6-py3-none-any.whl (97 kB)
|████████████████████████████████| 97 kB 40.4 MB/s
Collecting cmd2>=1.0.0
Downloading cmd2-2.3.3-py3-none-any.whl (149 kB)
|████████████████████████████████| 149 kB 75.7 MB/s
Requirement already satisfied: six>=1.10.0 in /usr/lib/python3.6/site-packages (from pyghmi>=1.2.0->virtualbmc) (1.11.0)
Collecting python-dateutil>=2.8.1
Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
|████████████████████████████████| 247 kB 68.9 MB/s
Collecting cryptography>=2.1
Downloading cryptography-36.0.1-cp36-abi3-manylinux_2_24_x86_64.whl (3.6 MB)
|████████████████████████████████| 3.6 MB 152.5 MB/s
Collecting wcwidth>=0.1.7
Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Collecting importlib-metadata>=1.6.0
Downloading importlib_metadata-4.8.2-py3-none-any.whl (17 kB)
Collecting pyperclip>=1.6
Downloading pyperclip-1.8.2.tar.gz (20 kB)
Preparing metadata (setup.py) ... done
Collecting typing-extensions
Downloading typing_extensions-4.0.1-py3-none-any.whl (22 kB)
Collecting attrs>=16.3.0
Downloading attrs-21.2.0-py2.py3-none-any.whl (53 kB)
|████████████████████████████████| 53 kB 15.2 MB/s
Collecting cffi>=1.12
Downloading cffi-1.15.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (405 kB)
|████████████████████████████████| 405 kB 109.8 MB/s
Collecting pycparser
Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
|████████████████████████████████| 118 kB 61.0 MB/s
Collecting zipp>=0.5
Downloading zipp-3.6.0-py3-none-any.whl (5.3 kB)
Building wheels for collected packages: pyperclip
Building wheel for pyperclip (setup.py) ... done
Created wheel for pyperclip: filename=pyperclip-1.8.2-py3-none-any.whl size=11136 sha256=929a183afbe14d795eb9453264deb3250a0a44af5c3c62735d3ba6dc7e3d5436
Stored in directory: /root/.cache/pip/wheels/95/38/95/e30a7f0b44cb90642de3469f211a3218f93f871789b4f4b46c
Successfully built pyperclip
Installing collected packages: zipp, typing-extensions, pycparser, wcwidth, pyperclip, pbr, importlib-metadata, cffi, attrs, stevedore, python-dateutil, pyparsing, PrettyTable, cryptography, cmd2, autopage, pyzmq, pyghmi, cliff, virtualbmc
Attempting uninstall: python-dateutil
Found existing installation: python-dateutil 2.6.1
Not uninstalling python-dateutil at /usr/lib/python3.6/site-packages, outside environment /opt/vbmc
Can't uninstall 'python-dateutil'. No files were found to uninstall.
Successfully installed PrettyTable-2.4.0 attrs-21.2.0 autopage-0.4.0 cffi-1.15.0 cliff-3.10.0 cmd2-2.3.3 cryptography-36.0.1 importlib-metadata-4.8.2 pbr-5.8.0 pycparser-2.21 pyghmi-1.5.29 pyparsing-3.0.6 pyperclip-1.8.2 python-dateutil-2.8.2 pyzmq-22.3.0 stevedore-3.5.0 typing-extensions-4.0.1 virtualbmc-2.2.1 wcwidth-0.2.5 zipp-3.6.0
[root@lab2 /]#
vbmcd.service 만들기
# vi /etc/systemd/system/vbmcd.service
[Install]
WantedBy = multi-user.target
[Service]
BlockIOAccounting = True
CPUAccounting = True
ExecReload = /bin/kill -HUP $MAINPID
ExecStart = /opt/vbmc/bin/vbmcd --foreground
Group = root
MemoryAccounting = True
PrivateDevices = False
PrivateNetwork = False
PrivateTmp = False
PrivateUsers = False
Restart = on-failure
RestartSec = 2
Slice = vbmc.slice
TasksAccounting = True
TimeoutSec = 120
Type = simple
User = root
[Unit]
After = libvirtd.service
After = syslog.target
After = network.target
Description = vbmc service
저장 후 systemd 의 데몬을 리로드 합니다.
#systemctl daemon-reload <- 데몬 리로드
#systemctl enable vbmcd.service <- 서버 시작시 enable 로 활성화
#systemctl start vbmcd.service <- 서비스 start
#systemctl status vbmcd.service <- 서비스 status
[root@lab2 /]# systemctl daemon-reload
[root@lab2 /]# systemctl enable vbmcd.service
Created symlink /etc/systemd/system/multi-user.target.wants/vbmcd.service → /etc/systemd/system/vbmcd.service.
[root@lab2 /]# systemctl start vbmcd.service
[root@lab2 /]# systemctl status vbmcd.service
● vbmcd.service - vbmc service
Loaded: loaded (/etc/systemd/system/vbmcd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-12-15 14:11:57 KST; 5s ago
Main PID: 31663 (vbmcd)
Tasks: 3 (limit: 820810)
Memory: 24.5M
CPU: 211ms
CGroup: /vbmc.slice/vbmcd.service
└─31663 /opt/vbmc/bin/python3 /opt/vbmc/bin/vbmcd --foreground
Dec 15 14:11:57 lab2 systemd[1]: Started vbmc service.
Dec 15 14:11:58 lab2 vbmcd[31663]: 2021-12-15 14:11:58,070 31663 INFO VirtualBMC [-] Started vBMC >
[root@lab2 /]#
vbmc 확인.
#/opt/vmbc/bin/vbmc list
[root@lab2 /]# /opt/vbmc/bin/vbmc list
[root@lab2 /]#
VirtualBMC에 가상 머신 추가
제어 하려는 VM에 vbmc 를 추가 합니다.
/opt/vbmc/bin/vbmc add ubuntu20.04 --port 7110 --username admin --password 1234
(VM이름) 포트 이름 비번
[root@lab2 /]# /opt/vbmc/bin/vbmc add ubuntu20.04 --port 7110 --username admin --password 1234
[root@lab2 /]#
VM 실행
[root@lab2 /]# /opt/vbmc/bin/vbmc start ubuntu20.04
[root@lab2 /]#
[root@lab2 /]# /opt/vbmc/bin/vbmc list
+-------------+---------+---------+------+
| Domain name | Status | Address | Port |
+-------------+---------+---------+------+
| ubuntu20.04 | running | :: | 7110 |
+-------------+---------+---------+------+
[root@lab2 /]#
VM이 start 되었을까요?
KVM ( virt-manager )를 보면 안켜져 있습니다.
자 vbmc는 VM에 대한 전원을 ON/OFF 할 수 있습니다. 이는 ipmitool을 통해 진행 됩니다.
#ipmitool -I lanplus -U zeljko -P pass -H 127.0.0.1 -p 7110 power up
[root@lab2 /]# ipmitool -I lanplus -U admin -P 1234 -H 127.0.0.1 -p 7110 power up
bash: ipmitool: command not found...
Install package 'ipmitool' to provide command 'ipmitool'? [N/y] y
* Waiting in queue...
* Loading list of packages....
The following packages have to be installed:
ipmitool-1.8.18-17.el8.x86_64 Utility for IPMI control
Proceed with changes? [N/y] y
* Waiting in queue...
* Waiting for authentication...
* Waiting in queue...
* Downloading packages...
* Requesting data...
* Testing changes...
* Installing packages...
Chassis Power Control: Up/On
[root@lab2 /]#
ipmitool 패키지가 없어서 자동으로 설치 되었습니다. (repo의 중요성)
KVM 에서 보면 VM 이 잘 켜지고 동작 중 입니다.
#ipmitool -I lanplus -U admin -P 1234 -H 127.0.0.1 -p 7110 power down
VM 이 OFF 됩니다.
[root@lab2 /]# ipmitool -I lanplus -U admin -P 1234 -H 127.0.0.1 -p 7110 power down
Chassis Power Control: Down/Off
[root@lab2 /]#
이상으로 VirtualBMC 의 설치 및 설정에 대하여 알아 봤습니다.
'Linux Tech ' 카테고리의 다른 글
RedHat/Rocky/Centos local repository Srv 구축 방법 (0) | 2022.01.28 |
---|---|
cgroup 으로 시스템 자원 제한 걸기 (0) | 2021.12.30 |
iscsi 구성 후 reboot 시 볼륨이 보이지 않을때는 (0) | 2021.12.14 |
etc/fstab 설명 - 작성 중 (0) | 2021.12.14 |
Linux 에서 Intel CPU 버그 관련 (0) | 2021.12.14 |