如何安装具有GUI(gnome,kde,...)的Vagrant Linux盒?

时间:2015-08-06 01:40:07

标签: linux ubuntu vagrant

如何安装具有桌面GUI(gnome,kde,...)的Vagrant Linux盒。

是否存在已经拥有桌面环境的Vagrant盒子分发?

我做了一个"流浪汉"如何登录此虚拟框并激活GUI?

2 个答案:

答案 0 :(得分:4)

此问题重复,并在此处提供了广泛的答案:Using vagrant to run virtual machines with desktop environment

是的,您需要在流浪文件中启用GUI,但首先需要:

  • 安装Virtual Box Guest添加件
  • 安装桌面环境

从上面链接中的一个答案(https://stackoverflow.com/a/33138627/1412348),您可以使用以下流浪文件:

Vagrant.configure(2) do |config|
  # Ubuntu 15.10
  config.vm.box = "ubuntu/wily64"

  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true
  end

  # Install xfce and virtualbox additions
  config.vm.provision "shell", inline: "sudo apt-get update"
  config.vm.provision "shell", inline: "sudo apt-get install -y xfce4 virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11"
  # Permit anyone to start the GUI
  config.vm.provision "shell", inline: "sudo sed -i 's/allowed_users=.*$/allowed_users=anybody/' /etc/X11/Xwrapper.config"
end

答案 1 :(得分:3)

如果要进入桌面GUI,可以修改Vagrantfile以添加vb.gui = true。例如:

config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = true

    # Customize the amount of memory on the VM:
    # vb.memory = "1024"
end

然后你可以vagrant up从虚拟框中输入它。