远程管理VirtualBox

本文介绍如何在无显示器的服务器上安装VirtualBox,并通过网页界面进行虚拟机管理。内容包括安装VirtualBox及其Web组件、配置服务及访问网页管理界面等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言

需要在一台服务器上安装测试虚拟机,因为服务器没有显示器,所以不能通过VirtualBox客户端安装和管理虚拟机,命令行方式又太繁琐,听说可以通过网页的方式管理虚拟机,今天特意试了下这种方案,将过程记录如下。

安装virtualbox

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

加入apt源

deb http://download.virtualbox.org/virtualbox/debian xenial contrib

安装 virtualbox

sudo apt update
sudo apt install virtualbox virtualbox-ext 

安装web

sudo apt install php-fpm php-saop php-xml nginx 
wget https://github.com/phpvirtualbox/phpvirtualbox/archive/master.zip
unzip master.zip
sudo cp -r phpvirtualbox-5.2-0 /var/www/html/phpvirtualbox
sudo cp cp /var/www/html/phpvirtualbox/config.php-example /var/www/html/phpvirtualbox/config.php

配置服务

启动vboxweb服务

/usr/bin/vboxwebsrv -b -H 127.0.0.1 -p 18083

修改密码为真实运行virtualbox程序的账号密码

sudo vi /var/www/html/phpvirtualbox/config.php
12 var $username = 'vbox';
13 var $password = 'pass';

修改nginx

vi /etc/nginx/sites-enabled/default

35     root /var/www/html;
 36 
 37     # Add index.php to the list if you are using PHP
 38     index index.html index.htm index.nginx-debian.html;
 39 
 40     server_name _;
 41 
 42     #location / {
 43         # First attempt to serve request as file, then
 44         # as directory, then fall back to displaying a 404.
 45     #   try_files $uri $uri/ =404;
 46     #}
 47 
 48     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 49     #
 50     location ~ \.php$ {
 51         include snippets/fastcgi-php.conf;
 52     #
 53     #   # With php7.0-cgi alone:
 54     #   fastcgi_pass 127.0.0.1:9000;
 55     #   # With php7.0-fpm:
 56         fastcgi_pass unix:/run/php/php7.0-fpm.sock;
 57     }
 58 
 59     # deny access to .htaccess files, if Apache's document root
 60     # concurs with nginx's one
 61     #
 62     location ~ /\.ht {
 63         deny all;
 64     }

重新加载

/usr/sbin/nginx -s reload

访问

http://127.0.0.1/phpvirtualbox 默认账号密码都为admin

新建虚拟机

新建虚拟机的方法和virtualbox一样,只是要注意在设置里启用"Remote Display"

输入图片说明

这样可以通过其他远程工具连接上虚拟机,继续后面的安装了。 输入图片说明

转载于:https://my.oschina.net/yumm007/blog/1785906

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值