VNC
VNC Basics

VNC Basics

Learn how operate a VNC server.

Operating the VNC Server

Let's learn how to operate VNC servers including starting, stopping and debugging them.

Make sure you have started your distribution and you are in your distribution shell i.e. you see root@localhost mentioned on Termux.

Starting a VNC server

Start VNC Server

Andronix has already copied the necessary command on your clipboard if you are on the VNC server page. Just paste it in Termux (in the Distro shell [root@localhost]) and execute it

vncserver-start

image

Select Resolution

If you're prompted to select a resolution, just press Enter to dynamically select the resolution.

Install a VNC Client

That's it. Now install the RealVNC app (opens in a new tab) from the Google Play Store (or any other VNC client).


image

Add VNC Server

Now press the Add(+) button to add a VNC connection. Enter localhost:1 as the address and give it a name. Save the record.


image

Select VNC Server

Click the newly created VNC address


image

Continue

You might be warned that the connection is untrusted. Click OK to continue.


image

Enter your VNC password

You will be prompted to enter a password. Enter the password you set while installing the distro step and click ** Continue**.


image
You can turn "Remember the password" toggle on for your convenience.

Almost done ☑️

You will now be able to see the GUI of your Linux distribution.


image

Let's Improve the Quality

You might notice the horrible picture quality. Don't worry, we'll fix that in the next step.

Click on 'i' Button

Press the i button on the top menu bar of the VNC app to open the settings.


image

Select High Picture Quality

You will see the settings of the VNC app. Scroll down to the Picture Quality section and select High.


image

Yay!

Now, you will be able to see the GUI of your Linux distribution in high quality.


image

All done!

You can now use your Linux distribution as you would on a PC ✅.


image
⚠️
Always remember to Stop the VNC server before exiting the distro by running vncserver-stop.

Stopping a VNC server

It is necessary to stop the VNC server once you are done using your distro or exiting it. To stop the VNC server execute the following command in the distro shell-

vncserver-stop

Once you execute it, the terminal will ask you for a port number. Enter 1 as the port number and click enter.

VNC Settings

These instructions assume that you have started your distro and are inside the distro shell (not a Termux shell).

Setting a desired resolution

To apply your desired resolution, please execute the following command-

nano /usr/local/bin/vncserver-start

Now, you just need to change the last line of this file to-

vncserver -name remote-desktop -geometry 1920x1080 :1
You can replace the 1920x1080 to your desired resolution.

Since you've made changes to the file, let's save it by pressing ctrl + x , then hit y and finally hit Enter.

How to change resolution permanently in Modded OS /Ubuntu 19

To change resolution permanently execute the following command in the distro's shell-

nano /usr/local/bin/vnc

Once you do this, replace the second line with-

LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver -localhost no -depth 24 -name remote-desktop -geometry 1920x1080 :$PORT
You can replace the 1920x1080 to your desired resolution and then restart/start the VNC Server.

Once you are done, just press Ctrl+X and then type Y and then hit enter. Now when you'll do just choose the first option i.e., Start vnc-server with autodetect/dynamic resolution.

How to change the picture quality in VNC

If you are using bVNC then you do not need to make any changes. It will make it's required changes itself.

If you are using RealVNC Viewer, then connect to the VNC Server and then click on (i) button at the top. Change Picture Quality to High, or to your desired quality.

VNC on other devices

💡
You can access the instance running on your phone on any other device on your network.

Continuing with the instructions, please make sure that both of your devices are sharing the same network. If you don't have access to Wi-Fi, you can start the hotspot from the device having the Linux installed and connect the other device to the hotspot. Once both the devices are under the same network, execute the following command inside the distro's shell-

nano /usr/local/bin/vncserver-start

Now edit the last line and change it to-

vncserver -name remote-desktop -geometry 1920x1080 -localhost no :1
⚠️
If you are using an Arch-based distribution like Manjaro or Arch Linux itself, please execute the following command instead of the command as mentioned earlier-
vncserver -name remote-desktop -geometry 1920x1080 -localhost :1

Once you are done with this open a new Termux session (drag from the left to open the sidebar for more options) and type:

ip a

Now copy then WLAN IP address (eg. 192.168.xx.xx). Now use this IP Address on the other device with the port number as 1 (eg. 192.168.xx.xx:1 ).