Ravada vdi 網站資源
- https://ravada.upc.edu/
- https://github.com/UPC/ravada
- https://ravada.readthedocs.io/en/latest/docs/INSTALL.html
- https://ravada.readthedocs.io/en/latest/docs/install_guest_windows10.html
服務器安裝
1. 實體機(or lxc in pve)安裝ubuntu 18.04
CPU需支援虛擬功能 ,
若使用pve的 lxc , 該 lxc container需在options中要啟用nest指令, 並且需修改主機中該lxc container的設定
mkdir -p /dev/net vi /etc/pve/lxc/<lxc_id>.conf 增加 lxc.mount.entry = /dev/kvm dev/kvm none bind,create=file
lxc.cgroup.devices.allow: c 10:232 rwm
啟後,確認權限是否為666,若沒有就要到pve主機(非lxc) 改一下 chmod 666 /dev/kvm
ps. pve的lxc安裝ravada 後來測試還是失敗 (2020/05/04)
且該container確認安裝以下套件 sudo apt-get install virt-manager ssh-askpass-gnome --no-install-recommends sudo apt-get install qemu-kvm libvirt-bin virtinst bridge-utils cpu-checker
2 安裝mysql
sudo apt-get update sudo apt-get upgrade sudo apt-get install mysql-server sudo mysql_secure_installation sudo mysqladmin -u root -p create ravada sudo mysql -u root -p ravada -e "create user 'rvd_user'@'localhost' identified by 'Pword12345*'" sudo mysql -u root -p ravada -e "grant all on ravada.* to rvd_user@'localhost'"
3 查看mysql設定檔案,可視需要修改使用者密碼,但要搭配上一步驟一起修改
sudo vi /etc/ravada.conf db: user: rvd_user password: Pword12345*
4 安裝相關套件
sudo apt-get install perl libmojolicious-perl mysql-common libauthen-passphrase-perl \ libdbd-mysql-perl libdbi-perl libdbix-connector-perl libipc-run3-perl libnet-ldap-perl \ libproc-pid-file-perl libvirt-bin libsys-virt-perl libxml-libxml-perl libconfig-yaml-perl \ libmoose-perl libjson-xs-perl qemu-utils perlmagick libmoosex-types-netaddr-ip-perl \ libsys-statistics-linux-perl libio-interface-perl libiptables-chainmgr-perl libnet-dns-perl \ wget liblocale-maketext-lexicon-perl libmojolicious-plugin-i18n-perl libdbd-sqlite3-perl \ debconf adduser libdigest-sha-perl qemu-kvm libnet-ssh2-perl libfile-rsync-perl \ libdate-calc-perl libparallel-forkmanager-perl libssh2-1-dev libssh2-1 libdate-calc-perl \ zlib1g-dev libpcre3-dev zlib1g-dev libpcre3-dev make gcc gcc-4.8 \ libdatetime-perl libdatetime-locale-perl libdatetime-timezone-perl libparams-validationcompiler-perl libspecio-perl libio-stringy-perl libpbkdf2-tiny-perl \ libfile-sharedir-perl libclass-singleton-perl libsub-quote-perl libexception-class-perl libref-util-perl libclass-data-inheritable-perl libclass-inspector-perl net-tools
sudo reboot
底下0.10-1_all版本, 可至 http://infoteleco.upc.edu/img/debian/ 確認是否最新
wget http://infoteleco.upc.edu/img/debian/libmojolicious-plugin-renderfile-perl_0.10-1_all.deb sudo dpkg -i libmojolicious-plugin-renderfile-perl_0.10-1_all.deb
sudo perl -MCPAN -we 'install "Net::SSH2"'
5 安裝Ravada
以下ravada版本0.7.0 可上官網確認最新版 http://infoteleco.upc.edu/img/debian/
wget http://infoteleco.upc.edu/img/debian/ravada_0.7.0_ubuntu-18.04_all.deb sudo dpkg -i ravada_0.7.0_ubuntu-18.04_all.deb sudo apt-get update sudo apt-get -f install
6 設定啟動參數
sudo systemctl daemon-reload sudo systemctl enable rvd_back sudo systemctl enable rvd_front sudo systemctl start rvd_back sudo systemctl start rvd_front
7 設定qemu 壓縮
sudo vi /etc/libvirt/qemu.conf 加上以下參數 save_image_format = "bzip2"
8 重開機後,新增使用者,並且同意該使用者為管理員
sudo /usr/sbin/rvd_back --add-user <使用者>
9 使用瀏覽器連線登(上一個步驟新增的使用者登入)
10 登入ravada後, 安裝VM(win 10)
記得要先把win10 安裝檔案放到ravada主機上(/var/lib/libvirt/images), 然後執行以下指令刷新列表
sudo virsh pool-list
ps.安裝win 10會很痛苦, 滑鼠很慢,之後安裝驅動程式就正常了
11 win10安裝完畢,登入win10下載驅動程式並且安裝起來
安裝virtio驅動程式 https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/ 執行qemu-ga-x64.msi (64-bit) or qemu-ga-x86.msi (32-bit)
安裝spice guest tools https://www.spice-space.org/download.html https://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-latest.exe
#安裝win10後關機, 編輯開機設定,讓vm的cpu與本機同步 virsh edit <vm name> 加上host-passthrough(直接使用原本的cpu), 以及核心數4(請依照實際cpu數修改) <cpu mode='host-passthrough'> <topology sockets='1' cores='4' threads='1'/> </cpu>
服務器端安裝完畢,找一台主機,使用spice方式連線
若是 linux,樹梅派,可安裝virt-viewer這套件, 安裝完畢可以執行remote-viewer進行連線 若是windows,請到此下載 https://virt-manager.org/download/
ps 目前不要嘗試docker, 若要嘗試,請切換branch到369_dockers, 但有一些perl 的bug,要自己修正才能執行,可是最後又會出現backend錯誤
virsh備份還原
備份
1. 請參考 https://kafeiou.pw/2020/03/25/2303/ 透過virsh方式備份xml 2. 備份 mysql mysqldump -u root -p ravada domains > domains.sql mysqldump -u root -p ravada networks > networks.sql
還原
1.將/var/lib/libvirt/images 同步到新的主機上 2.同步相關xml 3.資料庫還原
單一vdi還原
除了使用virsh還原外,還需以下指令, 然後再到網頁調整一下硬體設定
rvd_back --import-domain=<machine name>