See how you can easily turn your home computer into a server and set up your own personal website with the VirtualBox program.
In part 1 we set up the VirtualBox program and inside it we created a virtual computer running Ubuntu Server. We made sure that Ubuntu has taken an IP from our router and that the ssh service is enabled on it.
In part 2 you will see how to remotely connect to your server with ssh and how to set up a management panel on it. Deep breath and let's go.
Connection with the outside world
Confirmation of IP
Start VirtualBox, then start your Ubuntu Server virtual machine (if both are not already running) and login with the now-classic name dimitris and password 1234. Then, in Ubuntu, enter the command
ip addr and note the IP address assigned to your primary network adapter. In our case this was 192.168.100.25.
Note: It is also possible to get the same results with the bridge adapter in VirtualBox, with the originally suggested NAT network type but also using port forwarding in VirtualBox. But the way we describe is clearly simpler and easier.
Setting up the router
The guest operating system (Ubuntu Server) appears to the router as a normal computer that is connected to the internal network of your home and even has an internal IP (192.168.100.25).
You will need to tell the router which ports to forward their traffic to Ubuntu. In short, you should set up port forwarding on your router. Since ssh works by default on port 22, let's port forward the router on 22.
The photo below is a typical example, as not all routers have the same environment. But the command and configuration of this is more or less the same everywhere.
Go into the router menu, find the port forward command (or something similar) and set port 22 to point to the IP of your Ubuntu Server.
Try to find the corresponding fields in you and set them according to the photo above. That is, TCP protocol, port range from 22 to 22, internal host "iguruserver" or whatever you named your virtual Server, etc.
Pay attention here so as not to get confused, that the router mentions as “host” what VirtualBox calls “guest”.
Download an ssh program
Depending on what you're running on your physical computer, you may or may not have an ssh program ready. Since our example is hosted on Windows 10 we will need a program on Windows that can connect with shh to a remote computer.
You can choose several programs and even free ones, but we prefer BitVise SSH Client. If you don't have it, you can download from here.
BitVise SSH Client is free, easy, fast, lightweight and can and does store your connections. If you still want to connect from an Android mobile, then try Termius.
Connect to Ubuntu Server
There are two types of connection. The first is a connection within your internal network (intranet), i.e. an internal machine to connect to another internal one, without going through the internet and simply using an internal IP (such as 192.168.100.25)
The second is for a machine outside the internal network to communicate with a machine inside your network. Here you will need to have a computer connected to the internet but with a different connection than your home one, which will try to communicate with Ubuntu Server.
If the second case works, it means that you are "out" on the internet and that logically the first case will also work.
Let's try the first case first. That is, if within our internal network we see Ubuntu. Start BitVise and set it to the corresponding own IP, username and password.
Press the Log In button and see if it connects.
If it connects click the “New Terminal Console” button on the left to open a new ssh window, which is easier to work with your server
Now try the same with a machine that is not inside the internal network and see if it connects. If you don't have something handy, try with your mobile only connected to Data of your provider and with Termius.
Installing an admin panel
The choice of management panel is a personal matter. There are panels that are paid, such as cPanel, Plesk, but also panels for Ubuntu Server that are free, such as Cloudron, aaPanel, Cyberpanel, etc.
We will try it cyberpanel.
Upgrade your virtual machine
Login to your Ubuntu server with ssh (with Bitvise) and issue the following commands:
sudo apt update && sudo apt upgrade -y (upgrade your machine with the latest versions of your programs)
If you see a dialog asking which services need to be restarted, just accept the defaults and go to OK by pressing TAB.
First login as root with
sudo su -
Run the following command. The automated installation script will start, asking you to make a few decisions about the version of LiteSpeed and which plugins you want to install.
sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)
Be patient because it takes a while. After all, you also have a virtual machine with low characteristics.
If for some reason you cannot log in as root then run the command below:
sudo su - -c "sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)"
In the first installation question, select 1 (install)
On the next screen select which version of LiteSpeed to install. If you choose LiteSpeed Enterprise, make sure to obtain a license key first. It's free for 1 domain, but you still need to get the key.
If you selected LiteSpeed Enterprise, you will see the following message:
Enter your serial number. If you do not have any license, you can also use trial license (if server has not used trial license before), type TRIAL.
We chose 1.
Please provide the following answers below:
- Full Installation = Y
- Do you want to setup Remote MySQL? = N (Allow your database to be installed on a remote server)
- Press Enter key to continue with latest version = Enter (here you can also install an old version)
- Please choose to use default admin password  = d (here do whatever you understand, we think 1234567 is hard enough for hackers to figure out)
- Do you wish to install Memcached = Y
- Do you wish to install Redis = Y
- Do you like to setup a Watchdog = Y
The installation process will proceed automatically. It will take 5-10 minutes, depending on the speed of your machine.
If you see a dialog asking you which services need to be restarted, just tick what it gives you and go to OK by pressing TAB.
At the end of the installation process, the following screen will appear containing important information about your settings. Select and copy it to a safe location for future reference.
Say Y to reboot your server.
Open the required ports
In the same way that you opened port 22 on your router, first open both 8090 and 80 in TCP protocol as well as 443 in both TCP and UDP, because it is required to connect to the management panel through a browser.
Then open a browser (eg Chrome) and enter your IP address to enter the panel. eg https://ХХХ.ХХХ.ХХХ.ХХХ:8090 as mentioned in the photo above (there with the yellow color).
If you get a 503 message, do what their page says in the order he mentions them.
When you see the Cyberpanel home page put in your credentials (admin and the awesome 1234567) to login.
Congratulations on your new server!. You are on the management page of your server, as if you had rented it from the Internet.
aaPanel has a similar panel:
This was quite a long post, but by the end of it you should have a working installation of Ubuntu Server running in VirtualBox that you can connect to from your host OS via SSH.
If you have any questions or comments, we'd love to hear from you in the comments.