본문 바로가기
개발/Openstack

오픈스택(OpenStack) horizon(호라이즌)에서 CentOS 이미지 등록하기

by 용술이 2021. 5. 30.

HORIZON 은 오픈스택에서 기본적으로 제공해 주는 대시보드이다. 

 

나는 HORIZON을 통해 CentOS 이미지를 등록하고자 한다. 

많은 검색을 해보았지만 linux나 Unix에서 커맨드를 이용하여 설정하고 등록하는 것이 대부분이다. 

 

1. 파일 다운로드 

일단, 이미지를 등록하고자 하면, 파일을 다운 받아야 한다. 

 

cloud.centos.org/centos/7/images/

 

CentOS Cloud images

 

cloud.centos.org

이곳에 가면 버전벌로 다운로드할 수 있다. 

 

나는 OpenStack에서 사용할 예정이니 qcow2 파일을 받도록 하겠다. 

 

2. password 입력 

다운로드가 완료되면 root 계정에 password를 입력해야 한다. 

이 부분은 윈도(Windows) 버전은 찾을 수가 없다. 

 

어쩔 수 없이 파일을 Openstack(오픈스택)이 설치되어 있는 서버로 옮긴 후 작업해야 한다. 

 

그전에 libguestfs-tools 가 설치되어 있어야 한다. 

없다면 install 후 진행하도록 하자

yum install libguestfs-tools 으로 설치한다. 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
[root@localhost]# yum install libguestfs-tools
 
 
Last metadata expiration check: 2:46:28 ago on Wed 14 Apr 2021 08:26:00 AM KST.
Dependencies resolved.
===================================================================================================================================================================
 Package                              Architecture           Version                                                 Repository                               Size
===================================================================================================================================================================
Installing:
 libguestfs-tools                     noarch                 1:1.42.0-2.el8                                          advanced-virtualization                  30 k
Installing dependencies:
 hexedit                              x86_64                 1.2.13-12.el8                                           appstream                                46 k
 libconfig                            x86_64                 1.5-9.el8                                               baseos                                   69 k
 libguestfs-tools-c                   x86_64                 1:1.42.0-2.el8                                          advanced-virtualization                 5.6 M
 perl-Class-Inspector                 noarch                 1.32-2.el8                                              appstream                                37 k
 perl-Sys-Guestfs                     x86_64                 1:1.42.0-2.el8                                          advanced-virtualization                 314 k
 perl-Sys-Virt                        x86_64                 6.3.0-1.el8                                             advanced-virtualization                 314 k
 perl-hivex                           x86_64                 1.3.18-20.module_el8.3.0+555+a55c8938                   appstream                                60 k
 perl-libintl-perl                    x86_64                 1.29-2.el8                                              appstream                               817 k
Installing weak dependencies:
 libguestfs-xfs                       x86_64                 1:1.42.0-2.el8                                          advanced-virtualization                  12 k
 perl-File-ShareDir                   noarch                 1.104-3.el8                                             appstream                                29 k
 
Transaction Summary
===================================================================================================================================================================
Install  11 Packages
 
Total download size: 7.3 M
Installed size: 33 M
Is this ok [y/N]: y
Downloading Packages:
(1/11): perl-Class-Inspector-1.32-2.el8.noarch.rpm                                                                                 304 kB/|  37 kB     00:00
(2/11): perl-File-ShareDir-1.104-3.el8.noarch.rpm                                                                                  237 kB/|  29 kB     00:00
(3/11): hexedit-1.2.13-12.el8.x86_64.rpm                                                                                           301 kB/|  46 kB     00:00
(4/11): perl-hivex-1.3.18-20.module_el8.3.0+555+a55c8938.x86_64.rpm                                                                1.0 MB/|  60 kB     00:00
(5/11): libconfig-1.5-9.el8.x86_64.rpm                                                                                             1.3 MB/|  69 kB     00:00
(6/11): libguestfs-tools-1.42.0-2.el8.noarch.rpm                                                                                   494 kB/|  30 kB     00:00
(7/11): libguestfs-xfs-1.42.0-2.el8.x86_64.rpm                                                                                     798 kB/|  12 kB     00:00
(8/11): perl-libintl-perl-1.29-2.el8.x86_64.rpm                                                                                    3.1 MB/| 817 kB     00:00
(9/11): perl-Sys-Guestfs-1.42.0-2.el8.x86_64.rpm                                                                                   1.7 MB/| 314 kB     00:00
(10/11): perl-Sys-Virt-6.3.0-1.el8.x86_64.rpm                                                                                      3.1 MB/| 314 kB     00:00
(11/11): libguestfs-tools-c-1.42.0-2.el8.x86_64.rpm                                                                                8.2 MB/| 5.6 MB     00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                              2.9 MB/| 7.3 MB     00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                           1/1
  Installing       : perl-Sys-Virt-6.3.0-1.el8.x86_64                                                                                                         1/11
  Installing       : perl-Sys-Guestfs-1:1.42.0-2.el8.x86_64                                                                                                   2/11
  Installing       : libguestfs-xfs-1:1.42.0-2.el8.x86_64                                                                                                     3/11
  Installing       : libconfig-1.5-9.el8.x86_64                                                                                                               4/11
  Installing       : perl-hivex-1.3.18-20.module_el8.3.0+555+a55c8938.x86_64                                                                                  5/11
  Installing       : perl-Class-Inspector-1.32-2.el8.noarch                                                                                                   6/11
  Installing       : perl-File-ShareDir-1.104-3.el8.noarch                                                                                                    7/11
  Installing       : perl-libintl-perl-1.29-2.el8.x86_64                                                                                                      8/11
  Installing       : hexedit-1.2.13-12.el8.x86_64                                                                                                             9/11
  Installing       : libguestfs-tools-c-1:1.42.0-2.el8.x86_64                                                                                                10/11
  Installing       : libguestfs-tools-1:1.42.0-2.el8.noarch                                                                                                  11/11
  Running scriptlet: libguestfs-tools-1:1.42.0-2.el8.noarch                                                                                                  11/11
  Verifying        : hexedit-1.2.13-12.el8.x86_64                                                                                                             1/11
  Verifying        : perl-Class-Inspector-1.32-2.el8.noarch                                                                                                   2/11
  Verifying        : perl-File-ShareDir-1.104-3.el8.noarch                                                                                                    3/11
  Verifying        : perl-hivex-1.3.18-20.module_el8.3.0+555+a55c8938.x86_64                                                                                  4/11
  Verifying        : perl-libintl-perl-1.29-2.el8.x86_64                                                                                                      5/11
  Verifying        : libconfig-1.5-9.el8.x86_64                                                                                                               6/11
  Verifying        : libguestfs-tools-1:1.42.0-2.el8.noarch                                                                                                   7/11
  Verifying        : libguestfs-tools-c-1:1.42.0-2.el8.x86_64                                                                                                 8/11
  Verifying        : libguestfs-xfs-1:1.42.0-2.el8.x86_64                                                                                                     9/11
  Verifying        : perl-Sys-Guestfs-1:1.42.0-2.el8.x86_64                                                                                                  10/11
  Verifying        : perl-Sys-Virt-6.3.0-1.el8.x86_64                                                                                                        11/11
 
Installed:
  hexedit-1.2.13-12.el8.x86_64                                     libconfig-1.5-9.el8.x86_64                      libguestfs-tools-1:1.42.0-2.el8.noarch
  libguestfs-tools-c-1:1.42.0-2.el8.x86_64                         libguestfs-xfs-1:1.42.0-2.el8.x86_64            perl-Class-Inspector-1.32-2.el8.noarch
  perl-File-ShareDir-1.104-3.el8.noarch                            perl-Sys-Guestfs-1:1.42.0-2.el8.x86_64          perl-Sys-Virt-6.3.0-1.el8.x86_64
  perl-hivex-1.3.18-20.module_el8.3.0+555+a55c8938.x86_64          perl-libintl-perl-1.29-2.el8.x86_64
 
Complete!
 
 
cs

 

설치가 완료 되었다면 

파일을 옮긴 후 해당 디렉터리로 가서 명령어를 실행시킨다. 

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
[root@localhost]# cd /root/ajy_test/
 
[root@localhost]# virt-customize -a 파일명 --root-password password:'암호'
 
 
[   0.0] Examining the guest ...
virt-customize: error: libguestfs error: could not create appliance through
libvirt.
 
Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct
 
Original error from libvirt: Cannot access storage file
'/root/ajy_test/CentOS-7-x86_64-GenericCloud-1701.qcow2' (as uid:107,
gid:107): Permission denied [code=38 int1=13]
 
If reporting bugs, run virt-customize with debugging enabled and include
the complete output:
 
  virt-customize --x [...]
 
   

 

에러가 발생 했다. LIBGUESTFS_BACKEND 경로가 없다는 이야기 인가... 

 

1
2
3
4
5
6
7
8
9
[root@localhost]# export LIBGUESTFS_BACKEND=direct
 
[root@localhost]# virt-customize -a 파일명 --root-password password:'암호'
 
[   0.0] Examining the guest ...
103.1] Setting a random seed
104.4] Setting passwords
152.2] Finishing off
 
  cs

 

완료 되었다. 해당 파일을 FTP를 이용하여 다시 로컬로 가져온다.

 

3. 호라이즌에서 이미지 등록

 Compute -> 이미지 -> 이미지 생성(버튼)을 클릭한다.

 

나머지는 원하는 설정으로 해서 생성시키면 된다. 

 

중요! 포맷은 QCOW2 - QEMU 에뮬레이터 (Emulator)으로 하는 것이 좋을 것이다.

 

이미지 생성 후 VM을 생성하여, root로 로그인되는지 까지 확인하면 완료다. 

 

vm os 설치 및 로그인 성공

 

바보같이 방금 입력한 root 비밀번호를 잊어버렸지만.. 두 번째엔 성공했다. 

 

완료. 

반응형

댓글