WebvirtCloud安裝(CentOS7)


1、安裝依賴包
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install python-pip
yum -y install python-virtualenv python-devel libvirt-devel glibc gcc nginx supervisor python-lxml git python-libguestfs

2、下載webvirtcloud並初始化webvirtcloud
git clone https://github.com/retspen/webvirtcloud
mv webvirtcloud /opt
cd /opt/webvirtcloud && cp webvirtcloud/settings.py.template webvirtcloud/settings.py
pip install -r conf/requirements.txt
cp conf/nginx/webvirtcloud.conf /etc/nginx/conf.d/
sed -i "s#SECRET_KEY = ''#SECRET_KEY = 'abcd12345'#g" /opt/webvirtcloud/webvirtcloud/settings.py
python manage.py migrate

3、編輯一個webvirtcloud.ini的新文件並粘貼以下內容到文件中
vim /etc/supervisord.d/webvirtcloud.ini

[program:webvirtcloud]
command=/usr/bin/gunicorn webvirtcloud.wsgi:application -c /opt/webvirtcloud/gunicorn.conf.py
directory=/opt/webvirtcloud
user=nginx
autostart=true
autorestart=true
redirect_stderr=true

[program:novncd]
command=/usr/bin/python /opt/webvirtcloud/console/novncd
directory=/opt/webvirtcloud
user=nginx
autostart=true
autorestart=true
redirect_stderr=true

4、更改webwirtcloud文件夾的權限為nginx
chown -R nginx:nginx /opt/webvirtcloud
systemctl start nginx && systemctl start supervisord

5、在所有KVM主機上新增webvirtcloud賬戶用於webvirtcloud連接虛擬化服務
useradd webvirtcloud
echo "123456" | passwd --stdin webvirtcloud
usermod -G kvm -a webvirtcloud

6、安裝虛擬化服務
wget -O - https://clck.ru/9V9fH | sudo sh

7、配置ssh免鑰登陸kvm主機
su - nginx -s /bin/bash
ssh-keygen    #生成id_rsa.pub文件,直接回車即可
touch ~/.ssh/config && echo -e "StrictHostKeyChecking=no\nUserKnownHostsFile=/dev/null" >>~/.ssh/config
chmod 0600 ~/.ssh/config
ssh-copy-id webvirtcloud@127.0.0.1   #拷貝id_rsa.pub文件到遠端kvm主機

8、在所有kvm主機上新增以下文件
vim /etc/polkit-1/localauthority/50-local.d/50-org.libvirtd-group-access.pkla

[libvirtd group Management Access]
Identity=unix-group:kvm
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes

service libvirtd restart

9、訪問http://ip,默認用戶名:admin,密碼:admin

10、創建虛擬后出現下圖中的錯誤,解決辦法:點擊Users,編輯admin用戶,最下面四個選項填入-1即可




參考鏈接:
           https://github.com/retspen/webvirtmgr/wiki/Setup-SSH-Authorization
           https://github.com/retspen/webvirtcloud
           https://github.com/luckman666         #一鍵部署k8s


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM