You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### 1.2. Chỉnh sửa file .xml của máy ảo, bổ sung thêm channel trong `<devices>` (để máy host giao tiếp với máy ảo sử dụng qemu-guest-agent), sau đó save lại
129
-
`virsh edit u18-01`
128
+
## Bước 2 : Tắt máy ảo, xử lí trên KVM host
130
129
131
-
với `u18-01` là tên máy ảo
132
-
```
130
+
- Chỉnh sửa file `.xml` của máy ảo, bổ sung thêm channel trong <devices> (để máy host giao tiếp với máy ảo sử dụng qemu-guest-agent), sau đó save lại
#### *Mục đích là phân quyền cho phép libvirt-qemu được đọc ghi các file có hậu tố `.qemu.guest_agent.0`trong thư mục `/var/lib/libvirt/qemu/channel/target`*
151
+
## 2. Thực hiện trên máy ảo cài đặt các dịch vụ cần thiết
152
+
153
+
### 2.1. Setup môi trường
154
+
155
+
Bật máy ảo lên, truy cập vào máy ảo. Lưu ý với lần đầu boot, bạn phải sử dụng tài khoản `ubuntu` tạo trong quá trình cài os, chuyển đổi nó sang tài khoản root để sử dụng.
156
156
157
-
Khởi động lại `libvirt` và `apparmor`
157
+
Cấu hình cho phép login root và xóa user `ubuntu` chỉnh `/etc/ssh/sshd_config`
158
+
```sh
159
+
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/'g /etc/ssh/sshd_config
160
+
service sshd restart
158
161
```
159
-
service libvirt-bin restart
160
-
service apparmor reload
162
+
163
+
Đặt passwd cho root
164
+
```sh
165
+
sudo su
166
+
# Đặt passwd cho root user
167
+
passwd
168
+
Enter new UNIX password: <root_passwd>
169
+
Retype new UNIX password: <root_passwd>
161
170
```
162
171
163
-
### 1.5. Bật máy ảo
172
+
Restart sshd
173
+
```sh
174
+
sudo service ssh restart
175
+
```
164
176
165
-
## 2. Thực hiện trên máy ảo
177
+
Disable firewalld
178
+
```sh
179
+
sudo apt-get install ufw -y
180
+
sudo ufw disable
181
+
sudo stop disable
182
+
```
166
183
167
-
### 2.1. Setup môi trường
184
+
Logout hẳn ra khỏi VM
185
+
```sh
186
+
logout
187
+
```
168
188
169
-
- Cấu hình cho phép login root và xóa user ubuntu chỉnh vi /etc/ssh/sshd_config
189
+
Login lại bằng user `root` và xóa user `ubuntu`
170
190
```sh
171
-
sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/'g /etc/ssh/sshd_config
0 commit comments