Virtual machines and Freebox Delta: creation and hosting of your first web page
To complete this guide, you will of course need a Freebox Delta with an up-to-date Server box. To do this, you just need to restart it, Free details the methods to follow here.
You will also need to have at least one HDD/SSD installed and configured in order to have storage space to host your virtual machines. In our case, these are four 2 TB Seagate HDDs (ST2000LM015) configured in RAID 10. Note that you can also increase the integrated memory, in order to have more than 1 GB usable, Free specifying that this is not “neither recommended nor supported by Free, no after-sales service is possible in the event of hardware modifications”
To access the interface of your Freebox, you must finally have a computer and a browser. You can then type in one of the following two URLs:
http://mafreebox.freebox.frhttp://192.168.0.254
Then double-click on the “VMs” button.
Creation of a first virtual machine
Now let's go to the configuration of the virtual machine, by clicking on Add a VM. You can choose a name for it, which is not mandatory, assign it 1 or 2 virtual cores and up to 957 MB of memory if you haven't changed the 2 GB module provided by default by Free.
The parameters here are quite limited not to lose the novice user, and that's not a bad thing. The advanced configuration is done in a second step, after choosing the operating system. You have the possibility of opting for a virtual disk (image), an installation ISO, or one of the OS offered by Free. Choose the latter case.
We've also set the CPU/RAM settings to maximum so we can test performance, but you can adjust these settings to suit your needs, especially if you want to run multiple virtual machines simultaneously. You will be limited to three cores overall and the amount of memory present.
Free hosts ARM64 (AARCH64) images for Debian 10 or its next version (Testing), Ubuntu 19.04 or its next version 19.10 (currently in beta), as well as Fedora 30. It also offers Jeedom. A list that may change in the months to come. These are "Cloud" images in Qcow2 format which are virtual disks to be used as such.
This avoids a whole phase of configuration and installation, this method being used in particular by hosts. These images are not modified by Free, which saves the ISP and its teams from having to constantly adapt them and maintain them over the long term, they only have to modify the list regularly. We opt for Debian 10.
The files are saved in the “VMs” folder of the Freebox Delta storage space. The download goes through the application provided for this purpose within Freebox OS. We discover that they are retrieved via an HTTP server without going through a secure link and without verification of the checksum.
Asked about the subject, Free tells us not to consider that there is an attack vector there. We would still have appreciated a little more precautions for such files, which will serve as the basis for an OS used within the local network. If only the possibility of verifying an optional SHA-256 fingerprint.
Also be careful, deleting a virtual machine does not necessarily delete the data linked to it, in particular its Qcow2 image. It will therefore be necessary to proceed manually, whether by the file explorer of the web interface or the network share via Samba from a remote system.
For remote access, this will go through OpenSSH, installed and activated by default. You can opt for a password method, classic but not recommended, or by creating an SSH key. This second method is preferable because it relies on an asymmetric encryption key pair, the public key being provided to the virtual machine, the private key remaining in your local machine, protected by the passphrase of your choice.
You can use the tools present within your system to generate it, or PuttyGen under Windows for example. On Linux and Windows 10 where the support is native, this goes through the following command:
ssh-keygen -t rsa -b 4096
You will then be prompted to choose the name of your public key, you can leave the default or change it if you wish. Then assign it a passphrase. You can then open it to retrieve its content and place it in the Freebox VM creation interface. In our case, under Windows 10:
notepad C:\Users\DavidLegrand/.ssh/id_rsa.pub
Hopefully Free will learn to be more didactic on this part later so as not to "lose" novice users who will probably turn to the password method instead.
Once all this is done, the image will be downloaded and then put in place. By default it will be resized to 42 GB, but you can change this number or keep the original size if you wish.
Configuring, starting and accessing the virtual machine
You will then return to the global VM management interface, the one you just created is now accessible. You can modify a number of parameters such as its name, its technical composition, the location of its disk image, the type of disk used (Qcow2 or raw), use an ISO image as a CD player, etc.
Note that there is only one optical drive and one storage device per machine, no more. Here too Free seems to have decided to limit the possibilities in order to keep a dose of simplicity. By default, it will be a server-type system, accessible remotely via OpenSSH. But if you opt for an operating system with a desktop-like graphical interface, a virtual screen can be assigned to the machine.
Another interesting point, you can assign one of the USB ports (Type-A or Type-C) to the virtual machine (only one at a time), so that it can access external devices like storage, webcam , etc. Finally, the cloud-init script that will run on first boot is configured according to your settings. Of course you can change it. By default, it is simply used to assign a name to the main user and his connection method.
If you make changes, remember to click Apply. To start the virtual machine, click Power on at the top of the interface (green button). If the Freebox is restarted, the VMs will return to their previous state. For now, this first start can be quite long in some cases as Ubuntu warns Free (several minutes), due to an OS bug that remains to be corrected by its developers.
You can then access the virtual machine in a number of ways, with the virtual machine getting an IP address once it is up and running. Via the Console (Xterm.js) or Screen (NoVNC) tab of the online interface, but also through an OpenSSH client. On Linux or Windows 10 for example:
ssh username@ip-address
Which gives in our case:
ssh davlgd@192.168.0.197
You will then need to enter the account password or the passphrase of your private key in order to validate the connection. You will then arrive on a classic Linux terminal (Bash in our case).
Installing an Apache web server
The first thing to do is to update the system. Under Debian, this goes through the APT package manager which allows you to do this from the command line:
sudo apt updatesudo apt full-upgradesudo apt autoremove
You can also do it all in one line:
sudo apt update && sudo apt full-upgrade && sudo apt autoremove
Next, let's install the Apache web server:
sudo apt install apache2
After a few minutes, the server will be installed and started. You can then access the web page used by default by typing the IP address of your virtual machine in a browser. In our case :
http://192.168.0.197
Editing the webpage
To modify this web page, you can use editors that allow access via protocols like SFTP or even tools like SSHFS-Win... or use the command line:
sudo nano /var/www/html/index.html
Delete the content and place the following HTML code:
INpact Hardware is greatI followed an awesome tutorial, it works so well!!!
Save and exit (CTRL+X), confirm your modification (Y) then press F5 in your browser, the web page will have been modified and will display the text above (without the HTML tags).
To monitor the performance of your virtual machine, you can use htop:
sudo apt install htophtop
Access from outside
You now have a website with local content, but how do you allow third parties to access it? All you have to do is redirect an external port of the Freebox to that of the Apache server that we have just configured (80 by default). To do this, go to the Network tab, then Configure port forwarding.
The destination IP will be that of the virtual machine, the TCP protocol. You can change the source IP if you only want to allow a machine corresponding to a particular IP address to access it. Next, indicate the external ports to redirect, which must necessarily be greater than 16384. It will therefore be impossible to opt for port 80.
Here is our setup:
This amounts to redirecting port 16800 of the Freebox, accessible from the Internet, to port 80 of the virtual machine. To access your web page you will then type the following URL:
http://ip_externe_de_la_freebox:port_externe
You can do the same with OpenSSH access to the virtual machine, but be careful, this may encourage some to try to access it by taking advantage of security holes. So be sure to update your machine and only opt for this solution if you know what you are doing. You will then have to redirect the external port of your choice to port 22 of the VM.
The external IP of the box can be found in the Internet Status tab of the Freebox Status application of the interface. Of course, you can also use a domain name rather than an IP address, either the one provided by Free ( xxx.freeboxos.fr
), third-party services via the Domain Name or Dynamic DNS application of Freebox OS.