Running Ubuntu Desktop in LXC/LXD on top of Ubuntu Server

13,232

Solution 1

(Not definitely true:)That won't work!(/Not definitely true) What would work though, is doing it the other way round: install the Desktop on your machine and then use LXD to run the web server.

Also, if you have a current NUC box, you should have processor virtualization and could run KVM. I'm not familiar with that, but it seems your chances are better with a true VM solution...

Solution 2

Yes it is possible with LXD.

I have my custom LXD Image server. Please do the following:

sudo lxc remote add codedream lxdimage.codedream.ml --public 
sudo lxc launch codedream:ubuntu1604-kodhe-xfcedesktop my-desktop -c "security.privileged=true" -c "security.nesting=true"

Or if you prefer unity desktop:

sudo lxc remote add codedream lxdimage.codedream.ml --public 
sudo lxc launch codedream:ubuntu1604-kodhe-unitydesktop my-desktop -c "security.privileged=true" -c "security.nesting=true"

Also now have ukui:

sudo lxc remote add codedream lxdimage.codedream.ml --public 
sudo lxc launch codedream:ukui my-desktop -c "security.privileged=true" -c "security.nesting=true"

After, install NoMachine, and connect to lxd container by IP and port 4000. Username=kodhe, Password=1. To view IP:

sudo lxc list my-desktop
Share:
13,232

Related videos on Youtube

Bjarni Jens
Author by

Bjarni Jens

Updated on September 18, 2022

Comments

  • Bjarni Jens
    Bjarni Jens over 1 year

    Is it possible to have Ubuntu Desktop running in an LXC/LXD container on top of Ubuntu Server, displaying Ubuntu Desktop's graphical X session on the physical screen that Ubuntu Server outputs to?

    Whether it makes sense or not, my idea is to separate the Server "PC" from the Desktop "PC". I intend to set up an Intel NUC machine as a personal web server as well as a HTPC machine connected to my TV.

    • Anass Boukalane
      Anass Boukalane over 7 years
      Here's another link to check out: reddit.com/r/LXC/comments/425l3p/… What did you end up doing with this?
    • Bjarni Jens
      Bjarni Jens over 7 years
      Thanks for the link. I ended on installing Ubuntu Desktop (to have the Desktop GUI) and run the server related things alongside it. I might one day reinstall the whole NUC if I figure out how to run the Desktop inside an LXC/LXD container.
    • Lamp
      Lamp over 3 years
      I don't know about connecting the container's console to the host display, but if you're using RealVNC (with system Xorg), ubuntu desktop works perfectly fine!
  • Bjarni Jens
    Bjarni Jens over 7 years
    I was starting to fear this would be the answer. Before I accept this answer, how sure are you? Do you have some reference for this?
  • Bjarni Jens
    Bjarni Jens over 7 years
    Think of the Desktop as a service. Just as I isolate my Django site in a Linux container, I'd like to isolate my Desktop session in a container.
  • OttoEisen
    OttoEisen over 7 years
    No, I don't. And maybe I've been a bit premature? I had a look at the link provided by Davei and also at this: link.The following IS true: I assumed that, when you wrote "server", you mean some basic installation from an Ubuntu server image. In this case neither of these two solutions will work, since they rely on devices which are not present in a server installation, e.g. '/dev/video0'.
  • OttoEisen
    OttoEisen over 7 years
    KVM: I just started with that and it seems you're out of luck there too. The guides say that in order to install a GUI-based system on a server, you have to create the VM and then use VNC or virt-viewer from a GUI client to finish the installation.
  • Bjarni Jens
    Bjarni Jens over 7 years
    I appreciate the time and effort you put into this. The "other way around" solution is what I need to do. Ubuntu Server in a LXD container on top of standard Ubuntu Desktop installation.
  • OttoEisen
    OttoEisen over 7 years
    Thank you! Honestly I just happened to play around with virtualization solutions right now. Love LXD for the Linux server-side! KVM is OK, it runs Win10 on top of VMware Player on a Win10 host ;-) But a local console is always tricky. Next stop: Hyper-V!