폴더 구조
| /data01/libvirt_images/origin | 원본 이미지 | 리눅스 공식 웹사이트에서 다운로드 한 클라우드 이미지 원본 |
| /data01/libvirt_images/base/config | 기본 설정 | 원본 이미지에 추가 또는 변경할 설정 |
| /data01/libvirt_images/base | 기본 이미지 | 원본를 변경한 것 |
| /data01/libvirt_images | VM 이미지 | 실제 운영되는 VM 이미지 |
클라우드 이미지 다운로드
Ubuntu 와 CentOS 는 클라우드 이미지를 제공한다.
...
다운로드 하고 root 비번 바꿔서 켜기만 하면 된다.
| 코드 블럭 |
|---|
| language | bash |
|---|
| theme | Emacs |
|---|
| linenumbers | true |
|---|
|
sudo -s
cd /data01/libvirt_images/origin
wget https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-2009.qcow2 -O CentOS-7-2009.qcow2
wget https://cloud.centos.org/centos/8-stream/x86_64/images/CentOS-Stream-GenericCloud-8-20210603.0.x86_64.qcow2 -O CentOS-Stream-8-20210603.qcow2
wget https://cloud-images.ubuntu.com/hirsute/current/hirsute-server-cloudimg-amd64-disk-kvm.img -O Ubuntu-21.04-hirsute.qcow2 |
기본 설정
| /data01/libvirt_images/base/config/sshd_config | SSH 서버 설정 | - 루트 접속 비활성화
- 키 접속만 허용
- 특정 IP 대역에서만 암호접속 허용
|
| /data01/libvirt_images/base/config/authorized_keys | 허용 SSH 키 | 이 파일에 등록된 SSH 키만 VM에 접속할 수 있음 |
| /data01/libvirt_images/base/config/pwd.txt | 기본 비번 |
|
| 코드 블럭 |
|---|
| language | bash |
|---|
| theme | Emacs |
|---|
| title | /data01/libvirt_images/base/config/sshd_config |
|---|
| linenumbers | true |
|---|
|
...
AuthorizedKeysFile .ssh/authorized_keys
PermitRootLogin no
PasswordAuthentication no
Match Address 10.100.10.0/24 User gdhong
PasswordAuthentication yes
Match Address 192.168.0.1/24 User gdhong
PasswordAuthentication yes
Match all
... |
...
| 코드 블럭 |
|---|
| language | bash |
|---|
| theme | Emacs |
|---|
| title | /data01/libvirt_images/base/patch.sh |
|---|
| linenumbers | true |
|---|
|
cd /data01/libvirt_images/base
./patch.sh centos-7.qcow2
./patch.sh centos-stream-8.qcow2
./patch.sh ubuntu-21.04.qcow2 |
...