build a home lab server with Virtualbox, Webmin and Portainer

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
The first question that maybe comes to  your mind might be – do I need a home   lab server ? And what could I use it for ?  I recently bought this little PC here second   hand on e-Bay for roughly 200 bucks. It’s got  an intel i5 core 6th generation processor,   I upgraded the RAM to 16 Gbytes and I added a  Terrabyte SSD drive. That’s plenty for what I   want to do. I want to run a file server, so that  I can share my files with everybody in the house   without having to upload them to a cloud service.  I want to run my home automation software on it   and maybe install additional software either in  a docker container or in a virtual machine for   testing and learning purposes. Furthermore  we will install graphical User Interfaces   so that you don’t have to fiddle with the  command line or linux shell. Stay tuned. (intro) Guys, please use the chapter markers and the time  line if you want to skip parts of the videos.   You can see the sections here on the timeline  ? Those are the chapters. I have also put them   into the description. We don’t want to get  a huge electricity bill at the end of each   month because we run that loud 500 Watts engine.  The one I bought should not consume more than 50   Watts on average, so the cost of running it  will be around 5 to 10 Dollars per month.   Much less than my subscription to the gym  which I don’t use any more but still pay for.   Enough talking, let’s get this thing installed.   We will first need to chose an operating system  (OS) to run it on, then install the OS and then   install a graphical user interface, a GUI, where  we will do all the remaining tasks from. I have   chosen Ubuntu Server version 20 because it’s quite  up to date with all the components and it is a   widely spread distribution. In order to install it  I use a USB stick with VENTOY on it – if you want   to know how to build this then please watch this  short episode from my tool box series – I have   put a card up here on that little info icon or you  can access it from the description of the video. Installing Ubuntu Server is pretty straight  forward. It is mainly questions and answers,   that means the installation program  asks you all kind of questions   such as the region or country you live in,  the keyboard layout which you want to use,   the network configuration etc. Where this is  different from a Desktop installation is the   fact that everything is text-oriented rather  than graphical interfaces that use the mouse.   The only thing which I really want to pay  attention to is to tick the box to have   openssh installed because otherwise I will have  no way to interact with the server later. Once I   have answered all questions of the installer it  will start to copy files and set up everything.   I can lean back and relax.   Once it’s finished, I reboot the system and I  can then access it over the network using ssh. Cool, Now we have a PC with  Ubuntu Server 20 installed.   The next thing we want to do is install  a graphical user interface to linux   so that in the future we don’t have to fiddle  with the command line any more if we want to   manage things on that server. The GUI that we will  use is called Webmin. This is around for I’d say   20 years now – and it has constantly evolved. So  let’s get this installed. This is the first and   the last time that we need to use the  shell. You can do the following steps   directly on the PC if you have a screen and a  keyboard attached or you can do it over ssh. I will install webmin over ssh because my pc  is already in the network rack in the basement.   Webmin provides a debian installer package, a .deb  file which can be downloaded from sourceforge. I   have put all links into the description of the  video. Using wget or curl I can download it   to the server. Takes just a couple of seconds  really, depending on the available bandwidth.   Once the package is downloaded I need to become  root in order to install it. Installing a debian   package can be done with the dpkg command  then dash i plus the filename to install.   Takes a couple of seconds as well. Most probably  the install will fail and tell you there are a   lot of packages that are missing, but there is  an easy way to correct this. All we need to do   is call apt with the dash f option and the  install command and that will automatically   install all missing packages and configure  webmin for us. Here we go, all done. While I   am still logged in as root I might as well  change the root password using the passwd   command so that’s another box ticked on the list  to make the server a bit more secure. That’s it. Perfect – we have just installed the Operating  System and Webmin as a GUI to linux on top of it.   Now we can disconnect the keyboard and the screen  and move the little PC to the basement or into our   rack or somewhere where it’s not in our way as  long as it has a power and network connection.   In IT terms this is called headless, that means  the server runs somewhere and does not have human   interfaces such as a screen, mouse or keyboard.  We will access it over the network. Now let’s do   all the subsequent actions using the webmin GUI.  First, we want to install Virtualbox and Docker. If the Webmin Installation went well then  our system will be reachable browsing to port   10000. Be aware that by default Webmin uses ssl  so https. That means you will get this security   warning because the underlying certificate is not  known to our browser. I will do a separate episode   on TLS and SSL certificates in the future. For the  time being just confirm the exception. I can now   log in as root with the new root password which I  had changed in the previous step. And here comes   my webmin interface. From here I can do most if  not all tasks that need to be done on my system   such as in our case install a software package. I  just type in Virtualbox and then click on install.   That will resolve the dependencies and give me  a list of al the packages it wants to install.   It gives me that huge list of components to  install which I just confirm by clicking on   Install now. Webmin calls apt behind the  scenes and pulls the packages from the   debian repository in the internet and  installs and configures them for me.   Next let’s do the same thing with Docker.  The package we want is called docker.io   and that’s pretty much the same procedure. I hope this already showed how easy it is to  do tasks on the server using the Webmin GUI.   Before we move on let’s just check if  all software packages are up to date   and if not quickly update  them and reboot the machine. In the software package updates section  I can see that there is a little reminder   telling me that a lot of packages  are outdated and need upgrading.   Again this is just a matter of two clicks really  to get everything up to date. I click on “Update   Selected Packages” and after clicking again on  Install now the system does everything for me.   Once it is finished I will see if a reboot is  required. If a newer Kernel is installed then   I will get this Reboot now button at the bottom  of the screen so klicking on it will reboot my   server. The same warning will be shown on  the dashboard if ever a reboot is required. Awesome. All software packages are installed,   we have a GUI and now we want the same  for Docker of course. As a GUI for Docker,   let’s install portainer. This is just a  one-liner and we can also do this from Webmin Under Tools – Command Shell we have the  possibility to execute a command on the server.   You might remember the command from my  portainer episode. All we do here really is   issue the docker run command directly with the  right parameters. All details are of course in   the description of the video. So let me just  copy paste the command into that input line.   Once we click on execute command then Webmin will  launch the docker pull in a shell and show us the   output. Here’s the full command line. Takes  a while… here we go … If everything went well   then we should be able to connect to portainer  by browsing to our server on port 9000.   So let me just open a new tab and  put that URL in the address line.   Here we go, portainer shows up and  asks us to create an admin user.   I leave the admin name and just type  in a new password for portainer.   Once I click on create user then portainer asks me  where I want to connect to. Here I select Docker   so that’s the outmost left option and then I click  on connect. The portainer interface shows up and   asks me which Docker instance I want to connect  to. I only have one which is my lab server itself,   so I click on the local bar and once I  click on container I can see that there   is of course only one container so far which  is portainer itself. Up and running. All good. Perfect. We now have a GUI to Linux  and a GUI to Docker which is Portainer.   Before we can use virtualbox,  we need to do a bit of tweaking.   The reason is that we want to  use the Virtualbox Web Services   or API in order to connect to the server as we  can not access the GUI directly on the machine.   Also we want to make sure that Virtual Box does  run as an unprivileged user for security reasons. First we need to create a user for the  Virtualbox Web services. Under System- User   and Groups I have already created that user.  It’s called virtual. Let’s check the options.   Username and UID don’t matter really. I set home  directory to automatic and very important set the   shell to /bin/false because no one should  use this account to log into the system.   Therefore we check the radio button No login  allowed. Now the group settings are crucial   and need to be followed exactly in order to have a  working instance of the virtualbox web interface.   The primary group needs to be vboxusers. That  will enable a lot of features around virtual box.   In order to enable the Virtual box web  services to verify login information   it needs to be a member of the shadow group.  This group has access to the /etc/shadow   file and can therefore authenticate users with PAM  which is the integrated Linux security authority.   That actually cost me a day to figure out. So  let’s look for shadow in the secondary group and   add it to the user. All other parameters can stay  as they are. The next step is to tell the virtual   box web interface to actually run under the  context of that user. And if you google for this   then you will find a lot of outdated information  such as changing the default config file etc.   That is really outdated since linux doesn’t use  initd any more. So what we need to do is go to   System-Bootup and Shutdown, then find the  vboxweb.service and click on that link.   This shows the Systemd Unit file which  will need to be adapted as shown on the   screen. Here we specify the user and Group, the  executable which we bind to the right interfaces   plus we move the PID file to the user’s home  directory. Once we have made and saved all the   changes then we can restart that service.  Again, disregard all the info you find in   the internet – this is the way to go – things have  changed a lot in the last 2 years here. That’s it. Now we have the Virtualbox Web interface  up and running and we can now use a client   to connect to it. For this exercise we  will use a software called remotebox.   There are other alternatives such as phpVirtualbox  but they need additional configuration on the   server. I might show that in a separate  video. Let me know if you are interested.   Please do leave me a comment. Let’s download  and use Remotebox. I will use this from a linux   machine. If you want to do this from Windows  then you need to do a couple more things.   The documentation is on their website. Again, if  you want me to coever this in a video let me know. So let me google for remotebox. That’s the link we  are after. Sourceforge or Knobgoblin. Again please   check the documentation on Ian’s Website on how to  do this under Windows. UnderLinux I just download   the bzip file to my workstation using wget or  curl , I then unzip the file, change into that   directory and call the remotebox binary. Now let  me try and connect to my lab server. By default,   the virtualbox web services listen on port 18083.  If you have not changed this then it is sufficient   to just type in the server name. I specify my  user name and password and click on connect.   Great, I am connected to the server and can  now add media and virtual machines to it. Cool, so Remotebox gives us the possibility  to access Virtualbox on the server   very much as if we were sitting in  front of it. Before we can install   our first virtual machine we need an  installation CD. Hey, let’s actually   use a Windows ISO file and install Windows 10  in our first machine. But how are we going to   copy the ISO image over to the server ? You  may have guessed, we use Webmin to do this. Under Tools-File Manager we have direct  access to the server’s file system.   I want to create a new directory in marc’s  home directory which I call ISO images.   This is where I will put all  of marc’s installation DVDs.   Now I select Upload File and I can either browse  for a file or drag and drop it in that area. Let   me pick that Windows 10 ISO file and upload it to  the server. Good. The file is uploaded and I can   now go back to Remotebox and tell Virtualbox about  the new ISO file. Under File-Virtual Media Manager   I can add an optical Disc. I browse to the file  which I have just uploaded and confirm my choice.   Now I can create a new virtual  machine by clicking on the new icon.   I give it a name, 2 GB of memory and a 50 GB  Harddisk which I want to be dynamically allocated.   So here we go, here is my new virtual machine.   Next I need to go to the settings and here  I can change all the parameters very much   like directly in the virtual box Gui such as the  processor, the RAM etc. Here I add the iso file.   Please be aware that you would need to add it to  an IDE controller because presumably if you just   added it to the SATA controller like I did in my  first attempt then the VM would probably not boot.   Cool, let me start that virtual  machine and launch the remote display.   The windows installation launches and I can now   go ahead and install a windows 10 into  that virtual machine on my home server. OK, let’s stop this here – I am quite  sure you know how to install Windows.   Awesome. We have a convenient small form factor  PC running as an always on home lab server with   graphical User interfaces for all tasks, for  Virtualbox and for Docker. Guys, I hope you liked   this episode. If so, please do leave me a thumbs  up. Next Episode we will install another virtual   environment which is a bit more enterprise  or professional grade called Proxmox. If you   subscribe and check the Bell or reminder button  then you won’t miss that episode. Until then,   many many thanks for watching. Stay  safe, stay healthy, bye for now.
Info
Channel: OneMarcFifty
Views: 28,496
Rating: undefined out of 5
Keywords: virtualbox server, virtualbox on headless server, virtualbox head, virtualbox headless, virtualbox headless ubuntu, remotebox virtualbox, home lab server setup, cheap home lab server, tiny home server, small home server, how to set up a small server at home, virtualbox, home lab server with Virtualbox, home lab server Docker, Home lab server Webmin, Home lab server Portainer, USFF PC, ultra small form factor pc, ultra small form factor dell, Dell OptiPlex 3040
Id: cTufqsBbXOU
Channel Id: undefined
Length: 17min 11sec (1031 seconds)
Published: Mon Jan 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.