Introduction
After this tutorial you will have set up two linux virtual machines connected through a RS232 virtual serial port.VirtualBox will be the program used to run the virtual machines and both of them will be running Lubuntu, which is a very light version of Ubuntu.
I will be using Ubuntu during this setup, but the process is very similar if you are using Windows.
If you are not interested in creating a virtual serial port using virtual machines, you can emulate a virtual serial port in ubuntu itself using socat with a command similar to the following:
sudo printf "Opening virtual serial port... Done.\nPress CTRL+C at any time to close it.\n"; sudo socat PTY,link=/dev/ttyS0 PTY,link=/dev/ttyS4; printf "\nClosing virtual serial port... Done.\n"
Install VirtualBox
First, you will need to install VirtualBox. Open a terminal - CTRL+ALT+T - and enter the following command:sudo apt-get install virtualboxAfter this, you should have successfully installed VirtualBox:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAm_v7Lqpi-PRtLd-M5di5sxKuC35nergJGSg_1CZhicknSB6A3q6xvuMv7MFqRS2b56_qikRkWeQzyPsoF5Pg8RCmWrCYNtp9KLjPa4ur_uIWeDO3Gqd65lZhNVXPYmAgiYzuQ3onLec/s400/Screenshot+from+2014-10-22+13:19:09.png)
Get Lubuntu
As I said before, both virtual machines will be running Lubuntu. Download the iso here. Select the PC 64bits - Standard image disc (lower left button):![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwNN0S8p5z7G87mWP8L9qQQB-jercjIu0rILpZd9ZoaGcEbJNfAwhI0FUMEDPBrlyZQ1JollhZxRD3U9uatEJzNL97Xiy_cbqHj108r84Chf2SLHkOIT_Apj6tyLZCOM8Wz4E6xNStWuc/s400/Screenshot+from+2014-10-22+13:27:28.png)
Creating two virtual machines
Open VirtualBox and create a new virtual machine:![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC7NpCzttKhYjm6qLUXVMwwIe8fNZsnQ2_B7ff-Z55Vmst9JSv-Vsqq1GVFLvXxcgO_Q4hmCQ1gYC44_RDye_RuQzFyVioq8-1JlS6PhkaGHuSwwwjGWJgG79tKaoKecLX3GzVARyQsqA/s400/Screenshot+from+2014-10-22+17:55:03.png)
Name it lubuntu1 and select the type Linux and version Other Linux (64-bit):
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNozBbE0dER49iCHZ9GE6gd3VAlimR-gFO7oaRHxZuL6hRiVtbqbWzUJcGTpYvg5SrlPMU9n2H77KSFUDuO5-LiBrOoT8W8fyRkHkH3EC6NR1F4lyeBky81l6QxS_xU_py4S3yAXIocMc/s400/Screenshot+from+2014-10-22+17:55:20.png)
Press next without modifying anything else and finally press create.
Repeat the same process to create a second virtual machine but this time call it lubuntu2.
Installing Lubuntu on the virtual machines
Click on the first virtual machine settings and go to the storage tab. Press the disk icon with a green plus sign:![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUZdI54OMXl4gJsjl5i7SlTZmfaY97BSLpfPqLRV5ubJyMC9TOccHaY4qE_HhkOdtmyz6rz7PPpoBuRQYGIRM5nMuOXVmSlpnVHv-0qLBC3cNROIkF2TIlCqDWVOqa6sVY-Lu3sMHhAo/s400/Screenshot+from+2014-10-22+18:05:54.png)
Select choose disk:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyl2BWzrN6uDOtB39Iy8SC_xV_0bvE9cJGE9y7sqrZEBTLWRGyhnKZHUxgeconFIzNXBFFd9LdvaN3htmDndxsbtel-LTEI7n75q9RlaVZjqOAiQCB65YLkF3WZVRwfnIT6XRYxSOUgiM/s400/Screenshot+from+2014-10-22+18:03:41.png)
Browse to and select the lubuntu image disk (.iso) you downloaded:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv7HztYlb7ajR4KKjq3rHd-G_MCiMYdD2btzSl96BrqXSP8ckbkx6B1A4boW_KqfB86tm95h-i32G-hL5Zqku4Fx-FcOtitsPp5HO4dL5ePQGCiU_38ezu031lG-kb_Q8XIPzD4zPggXA/s400/Screenshot+from+2014-10-22+18:03:49.png)
There should appear a new entry on the Storage Tree now:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJkMsJDs1JF0Q4xUwcH4VbjdQJN4WWHrEvC4PCFg3Je2Lk99cfdpMpkcSCLa1lyb6cB_ffMXRHF0Vt0i6_lTDg1yzlFLULLOINq8rSNGAGJ_MdNzv6jzYRYUdlkHlopn9B_SLE7dR-5qM/s400/Screenshot+from+2014-10-22+18:03:33.png)
Press OK and repeat for the other virtual machine.
After you are done, go ahead and start both virtual machines: the Lubuntu setup should start. Follow the onscreen instructions to install Lubuntu on the virtual machines. When the installation finishes, shutdown both virtual machines.
Connecting the virtual machines with a virtual serial port
Open both virtual machine settings and browse to the Serial Ports tab.Modify the Port 1 settings as follows - notice that serial port settings differ from lubuntu1 to lubuntu2:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwEEQYyF8UIFI8MgRQpBc15wnyI51g_c5wCR3cbSpj_ZWoVHiL2YGjL7Bjrg2ab3m0biBbvrCQFzUooDt2M5DWqz_to4gt4v4yjSmOOC-LRO4QOusY7xjn7C-qdJIlFBkknU3Lxte1HQs/s400/Screenshot+from+2014-10-22+18:22:07.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6GB6k4ZWJJyZt39SfM2CGNVGPHFgImDWIUtTb1sD60I4EFk56TqiT_RmLdM9jQbcfnmfzGwvfQee-sL6xFQHUIAPwKsFjXO6YsjSL6mys4z13k9bbvsmQbQ6SWynDs6pDbSqMsMs3s9c/s400/Screenshot+from+2014-10-22+18:22:40.png)
Testing the virtual serial port
After having set both serial ports, boot both virtual machines.In order to test the connection, install gtkterm on both machines by executing the following command:
sudo apt-get install gtktermAfter installing gtkterm, open a terminal on both machines and type:
sudo gtktermIf everything was set up correctly, as soon as you type anything on one terminal, the terminal on the other virtual machine should output what you typed.