Remote control your Khadas VIM from a smartphone or PC, without a monitor!
0. Why Install VNC Into Your Khadas VIM SBC?
In many instances, you may not have or want an external monitor connected to your Khadas VIM. Or you may have a need to connect to your VIM remotely, but still want a Graphical User Interface (GUI), instead of just an SSH shell. This is when a VNC server comes in handy!
Using VNC, you can also connect to your Khadas VIM via your smartphone to impress your friends!
1. Ensure You Have Ubuntu Installed In Your Khadas VIM SBC
This guide will assume that you’ve already installed Ubuntu Mate into your Khadas VIM, using the Android-Ubuntu Dual-Boot image found here. If you have not installed Ubuntu yet, check out my other guide, “How to Install Ubuntu Into Khadas VIM”.
2. Get Ethernet Or Wi-Fi Working On Khadas VIM
The next step is to get the Ethernet or Wi-Fi to work, we need this because we will need to use the SSH shell to install the VNC server. You have 2 options:
Method 1 — The easier method, is to just plug in an external monitor via HDMI cable, so that you can use a keyboard and mouse to connect to your home Wi-FI.
Method 2 — The not so easy method, is to plug an Ethernet cable into your VIM, and then use a LAN scanner like the Fing app, to find it on your LAN.
What do I use? I wrote a little startup bash script, that sends me a Telegram notification every time my Khadas VIM boots up. That’s another story for yet another guide.
3. Logging Into Khadas VIM Using SSH
Once you’ve found the IP-address of your Khadas VIM, simply open Terminal on your Mac to use SSH to login to it. For Windows users, you will need to download Putty. By default, both the username and password are khadas.
Username: khadas Password: khadas
$ ssh khadas@x.x.x.x $ khadas@x.x.x.x's password: khadas
x.x.x.x = your Khadas VIM’s IP address.
4. Update Your Khadas VIM’s Ubuntu Mate OS
This step may seem weird and unfamiliar to people who are not acquainted with Linux. Although Linux doesn’t have a GUI updater, updating is done easily via the terminal.
$ sudo apt-get update && sudo apt-get upgrade
5. Install The VNC4Server Into Your Khadas VIM’s Ubuntu Mate OS
This step is the easiest, simply respond yes to any questions that arise, and the process will complete itself automatically.
$ sudo apt-get install vnc4server
6. Startup The VNC4Server, Then Kill It
We need to start the VNC server so that we can figure out where it’s configuration files are stored. After that we need to kill it, so that we can modify the configuration file.
$ vncserver :1 $ vncserver -kill :1
Let’s explain some things for the beginners, vncserver is the shell command to launch a new VNC daemon in Ubuntu Mate. -kill is the <argument> used when you need to kill the daemon. Finally, :1 is the network <port> on which you want to run the daemon on.
For example, if you want to run two VNC daemons simultaneously, type vnc server :1 && vncserver :2 into the terminal. You can then connect to them on ports 5901 and 5902 respectively. If you need to kill them both, type vncserver -kill :1 && vncserver -kill :2.
&& is just the command used when you want to run two shell commands on the same line.
7. Edit your VNC4Server’s Configuration File
Now we need to edit your config file so that when you login to your Khadas VIM via VNC, it will start up the graphical user interface. By default it does not!
You can find the configuration file’s directory, when you previously issued the command vncserver :1. You will find it on the line that says “Starting applications specified in …”.
Now that you know where the configuration file is…you can then issue the command to edit the configuration file. sudo is the command given to execute your command as root. If you do not have sufficient privileges to do something, just add sudo in front.
$ sudo nano /home/khadas/.vnc/xstartup
...move the cursor to the bottom of the file, using the arrow keys on your keyboard, then type in... mate-session
...press the following keys on your keyboard... [ Control-X ] [ y ] [ Enter ]
If you did all the above correctly, and in the correct sequence, you would have saved your configuration file with the line mate-session at the bottom! mate-session is the command for starting up Ubuntu Mate’s graphical user interface (GUI).
8. Ensure Your VNC4Server Starts On Ubuntu Mate Boot Up
This step is very important, if you don’t do this, you will not be able to reconnect to your Khadas VIM via VNC if it is rebooted, or loses power.
$ crontab -e
...move the cursor to the bottom of the file, using the arrow keys on your keyboard, then type in... @reboot /usr/bin/vncserver :1
You can also add additional VNC daemons to run on startup by adding additional lines such as:
Once you’re done, use your keyboard to exit the text editor.
...press the following keys on your keyboard... [ Control-X ] [ y ] [ Enter ]
9. Start the VNC4Server Daemon
$ vncserver :1
You can check if the server is listening on port 5901 by using netstat. You should see a TCP6 Protocol, running on port 5901. That port should be in a LISTEN state, which means that it is listening for inbound connections.
...this step is OPTIONAL... $ netstat -a
10. Connect To Your Khadas VIM By VNC Client
This is the fun part that we’ve all been waiting for…actually connecting to our Khadas VIM via VNC, so we get the full desktop experience! First you’ll need to download the RealVNC Client.
If you’re on iOS, you can also download their iOS app.
On your Mac, run the RealVNC app, and type in your VIM’s ip-address, followed by the port that your VNC daemon is running on. In my case it’s 192.168.0.37:1.
...inside the RealVNC desktop app... x.x.x.x:1
If your VNC daemon is running on another port such as 5902, then type:
...change the number, depending on the port you chose... x.x.x.x:2
Password: khadas
Tada, you’re done! If you’ve got this far, you’re a genius!
Khadas Products Used In This Post:
VIM2 Pro — $119.90
Heat Sink — $9.90
DIY Case — $14.90
HDMI Cable — $2.90
USB-C Cable — $2.90
Metal Plate — $8.90
Minimally, you’ll need the VIM2 Pro. If you want the DIY Case, then get the Heat Sink too. HDMI, USB-C cables, and the metal plate are optional.
Links To Other Articles (in progress):
Installing Ubuntu Mate into Khadas VIM2
Encrypting Your VNC Sessions In Mac OS X
Adding A New SSH User Account
In melon sandbox, the action is as easy as picking out your characters, positioning them, equipping them with weapons of your choosing, and sending them into battle. The preparation is completely free, and the number of characters you can make fight can be anything from two to one hundred.
Thanks for the tutorial. Appreciate it! :) erotic massage prague
Ummm.. May I ask some question
In the process of installing 'vcnsever4', terminal print the message 'E: Unable to locate package vcn4server' how to solve it..?
Great work!