VirtualBox下载地址:https://www.virtualbox.org/wiki/Downloads
Fedora Server 下载地址:https://getfedora.org/zh_CN/server/download/
在 OSX 下安装一个无桌面的 Linux 开发环境。主要完成三个目标:
剪贴板共享
文件共享
使用 linux 的命令行和开发环境(使用 ssh 配合 zsh+tmux+vim)
虚拟机设置
Virtual Box 关键配置如下:
常规 - 高级 - 共享剪贴板:双向
系统 - 主板 - 内存大小:足够大
系统 - 主板 - 启动顺序:硬盘 > 光驱
系统 - 处理器 - 处理器数量:最大
存储 - 存储介质 - 光驱:Fedora ISO
网络 - 网卡 1 - 网络地址转换(NAT)
网络 - 网卡 2 - 仅主机 (Host-Only) 网络:选择一个接口
这个需要先在全局工具 - 主机网路管理器里创建
设置 IPv4 地址和掩码,不需要启用 DHCP 服务器
共享文件夹:共享代码文件夹
备注:Virtual Box 可以使用 shift + 启动 启动虚拟机但不打开虚拟机 UI 界面
安装 Fedora Server 和 VBox 组件
安装 Fedora,过程中需要配置网卡,第一张网卡无需配置,主要是第二张网卡的 IP 地址和掩码需要设置一下。
安装完成后,重启,弹出光驱。然后在虚拟机界面的菜单中插入 VBox 的组件:Devices -> Insert Guest Additions CD Image…
更新系统:
Packer is a tool for creating machine and container images for multiple platforms from a single source configuration.
Works Great With
Out of the box Packer comes with support to build images for
Amazon EC2, CloudStack, DigitalOcean, Docker, Google Compute Engine,
Microsoft Azure, QEMU, VirtualBox, VMware, and more. Support for more
platforms is on the way, and anyone can add new platforms via plugins.
from https://www.packer.io/
----------------
The images that Packer creates can easily be turned into
Vagrant boxes.
Quick Start
Download and install packages and dependencies
go get github.com/mitchellh/packer
Note: There is a great
introduction and getting started guide
for those with a bit more patience. Otherwise, the quick start below
will get you up and running quickly, at the sacrifice of not explaining some
key points.
First, download a pre-built Packer binary
for your operating system or compile Packer yourself.
After Packer is installed, create your first template, which tells Packer
what platforms to build images for and how you want to build them. In our
case, we'll create a simple AMI that has Redis pre-installed. Save this
file as quick-start.json. Export your AWS credentials as the
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.
Packer will build an AMI according to the "quick-start" template. The AMI
will be available in your AWS account. To delete the AMI, you must manually
delete it using the AWS console. Packer
builds your images, it does not manage their lifecycle. Where they go, how
they're run, etc. is up to you.
phpVirtualBox is a modern web interface that allows
you to control remote VirtualBox instances - mirroring the VirtualBox GUI.
This is a docker image that eases setup.
An open source, AJAX implementation of the VirtualBox user interface written in PHP.
As a modern web interface, it allows you to access and control remote VirtualBox instances.
phpVirtualBox is designed to allow users to administer VirtualBox in a headless
environment - mirroring the VirtualBox GUI through its web interface.
Usage
This docker image is available as a trusted build on the docker index.
Using this image for the first time will start a download automatically.
Further runs will be immediate, as the image will be cached locally.
This image provides the phpVirtualBox web interface that communicates with any
number of VirtualBox installations on your computers.
As per the above diagram the following examples assume we have two computers PC2 and PC3
in our cluster that we want to manage through a single installation of phpVirtualBox.
Applying the same scheme to any number of computers running Virtualbox should be fairly straight forward.
Also, the same scheme applies if you only want to manage a single PC, which hosts both VirtualBox and
this image.
Internally, the phpVirtualBox web interface communicates with each VirtualBox installation through the
vboxwebsrv program that is installed as part of VirtualBox.
So for every computer connected to the phpVirtualbox instance, we're going to use a minimal container
that eases exposing the vboxwebsrv.
For PC2:
$ docker run -it --name=vb2 clue/vboxwebsrv vbox@10.1.1.2
And for PC3:
$ docker run -it --name=vb3 clue/vboxwebsrv myuser@10.1.1.3
This will start an interactive container that will establish a
connection to the given host.
To establish an encrypted SSH connection it will likely ask for your
password for each user. This is the user that runs your virtual machines
(VMs). See clue/vboxwebsrv for more details.
Some background: The official phpVirtualBox readme describes setting up the vboxwebsrv daemon so
that it is automatically started when the machine boots up and is exposed over the network.
Instead of requiring this upfront configuration, we only spawn the vboxwebsrv on demand
and expose its socket only through an encrypted SSH tunnel.
In fact, if you already have your vboxwebsrv set up, you don't have to rely on
the clue/vboxwebrv container. In this case, you can substitute the following link by
supplying ENV variables instead. You can also pass a visual name like this:
Now that all vboxwebsrv instance are up, we can link everything together and start our actual phpVirtualBox container.
The recommended way to run this container looks like this: