learn programming

Virtual Linux Server

Would you like to have your Linux server for testing, but not necessarily paid solutions available on the market? You can have your test server set up on a virtual machine, fully accessible from the terminal. This is a great solution that allows you to play with the server at home with virtual impunity. All you need is a computer that will be able to run a virtual machine.

The tool that allows you to build Linux Server

use Oracle Virtual Box to operate the virtual machine. Available for free at https://www.virtualbox.org/
Installation on Windows is similar to any other installation using the installer.

Virtual server instalation screen

To run the server, you still need an ISO image with the operating system that you want to install on the server. For starters, I suggest Ubuntu Server. It’s simple to install and easy to use, as long as you know the basic Linux recommendations and can navigate in the console. If not, you can always install it on a Linux virtual machine and get used to the console.
The Linux server image can be downloaded from the website:
https://ubuntu.com/download/server

If you have Oracle Virtual Box installed, create a new virtual machine in it.

After clicking the new icon, the new machine configurator will start. Select the name of the machine (for example Linux Server), its location on the disk, the size of the ram memory (for ease of use, the safe range for selection is marked in color on the scale).

In the next step, we can create a new virtual disk for Linux Server or use an existing one. We can decide on the type of file in which the virtual disk will be kept.

We can also decide to dynamically allocate space on the hard disk for the virtual disk file. This option is interesting because it allows you to save space on our physical disk. Finally, we set the maximum size of the virtual disk and the configured machine.

Linux Server installation

Before the first start of the machine, you should “load” the ISO image from which you will install the software on your Linux Server. For example, it could be Ubuntu Linux Server.

After clicking the settings option in our machine, go to the Memory and Controller: IDE tab. Then click on the disc icon on the left side of the dialog box and select the ISO file. It is also worth noting that this is a Live CD image. We click OK and the file is loaded into the virtual CD / DVD drive.

Now you can start the virtual machine. Just click the green arrow with the caption run. The virtual machine will start in a new window. The installation of the Linux Server will start immediately.

The installation itself is very intuitive and the only discomfort is the inability to use the mouse. However, you have to get used to it. We only use the terminal when working with the server.

During installation, we can immediately install the software that we will use. If you don’t choose anything at this stage, that’s fine. You can install everything later. At the installation stage, it is worth installing the software to log in to the server from the console (Open ssh server). The installer asks for this in one of the steps.

The time needed to perform the installation depends on how many additional packages we have chosen, on the speed of our connection and the parameters of the virtual machine.

After installation, restart the virtual machine. It will ask us to remove the installation CD, so we have to do this in the settings. Click on the tile on the left and select delete from the drop-down menu.

We go back to the virtual machine and press Enter. The Linux server will reset. If the installation was successful, we can log in to our Linux server in a virtual machine.

Finally, you need to set the communication ports in the virtual machine that allow you to communicate with Linux Server, for example, using the PowerShell console. Thanks to such communication, we will have full Linux Server emulation on our local machine.

In the settings tab, select the network, advanced and click port forwarding. We’re adding a new rule with a plus on the right. We set the TCP protocol: Host port 2222 and guest port 22. After accepting the changes, the windows system will ask for permission to communicate on this port. We agree.

From now on, we can log into the Linux Server on the virtual machine through our terminal. We use the command ssh login@127.0.0.1 -p 2222. The Linux Server will report and ask for the password. Correctly entering the password will allow you to log into the server and perform work on the server.

linux server communication screen

From now on, your home Linux Server is ready to work and connected to the console. From now on, it can be used, for example, to simulate a web server.

More about how to set web services on this Linux Server, you can find in this article: Web Server on Virtual Machine.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

X