Operating the VNC Server
Let's learn how to operate VNC servers including starting, stopping and debugging them.
Starting a VNC server
First, you need to make sure that you have any Desktop Environment installed in your Linux OS. After you make sure that you're inside the OS shell (shell you get after starting the distro) and not the Termux shell; execute the following command in that-
Now just download any VNC Viewer app from Play Store (e.g. Real VNC, bVNC, etc.) and connect to localhost:1 or the configured port.
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-
Once you execute it, the terminal will ask you for a port number. Enter 1 as the port number and click enter.
Setting a desired resolution
To apply your desired resolution, please execute the following command-
Now, you just need to change the last line of this file to-
vncserver -name remote-desktop -geometry 1920x1080 :1
Since you've made changes to the file, let's save it by pressing
ctrl + x , then hit y and finally hit
How to change resolution permanently in Modded OS /Ubuntu 19
To change resolution permanently execute the following command in the distro's shell-
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
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
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-
Now edit the last line and change it to-
vncserver -name remote-desktop -geometry 1920x1080 -localhost no :1
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:
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 ).