<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>VNC on Ivon's Blog</title><link>https://ivonblog.com/en-us/tags/vnc/</link><description>Recent content in VNC on Ivon's Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</managingEditor><webMaster>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</webMaster><copyright>You are welcome to share articles of Ivon's Blog (ivonblog.com). Please include the original URL when citing articles, and abide by CC BY-NC-ND 4.0 license. For commercial use, please write an e-mail to me.</copyright><lastBuildDate>Thu, 10 Apr 2025 01:00:00 +0800</lastBuildDate><atom:link href="https://ivonblog.com/en-us/tags/vnc/index.xml" rel="self" type="application/rss+xml"/><item><title>How to connect remotely to Termux's Linux desktop with VNC</title><link>https://ivonblog.com/en-us/posts/vncserver-termux/</link><pubDate>Thu, 10 Apr 2025 01:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/vncserver-termux/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;This article explains how to set up a VNC server so that we can access the Linux system desktop in Termux. It applies to Linux systems installed through proot or chroot.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/vncserver-termux/images/IMG_0357.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1040"
 height="585"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Termux can run Linux on an Android phone. After setting up the environment, the next concern is how to connect to the desktop (graphical environment). To connect to Termux&amp;rsquo;s Linux system desktop, there are three methods: &lt;a href="https://ivonblog.com/en-us/posts/termux-x11/" target="_blank" rel="noreferrer"&gt;Termux X11&lt;/a&gt;, &lt;a href="https://ivonblog.com/en-us/posts/android-xserver-xsdl/" target="_blank" rel="noreferrer"&gt;XSDL&lt;/a&gt;, and VNC.&lt;/p&gt;
&lt;p&gt;The first two run an X server on the phone. The latter is the remote desktop concept: run a VNC server on the phone, start a virtual Xvnc server, then connect with a VNC client. This VNC client can be local or a client on another computer.&lt;/p&gt;
&lt;p&gt;In terms of graphics performance, an X server is better than VNC, and it is easier to achieve 3D hardware acceleration.&lt;/p&gt;
&lt;p&gt;When I first learned Termux, I saw many people using VNC, but as Termux X11 gradually matured, I gradually abandoned VNC.&lt;/p&gt;
&lt;p&gt;If all three run on the same phone, since they are all localhost, there is no latency issue, and VNC really has no performance advantage over an X server.&lt;/p&gt;
&lt;p&gt;VNC&amp;rsquo;s strength is remote access from other computers! Compared with SSH X server forwarding, VNC can lower image quality to reduce bandwidth, and can even start headlessly. Its performance advantages appear when viewing remotely.&lt;/p&gt;
&lt;p&gt;So VNC is suitable for the scenario of &amp;ldquo;using a computer to connect to the phone&amp;rsquo;s Termux desktop&amp;rdquo;. You do not like staring at a tiny screen and typing commands like crazy, right? Then, besides text-only SSH access, graphical VNC is a good choice.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/vncserver-termux/images/IMG_0360.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1080"
 height="693"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;VNC and Termux X11 can coexist and should not affect each other.&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Choose a VNC client
 &lt;div id="1-choose-a-vnc-client" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-choose-a-vnc-client" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;On phones, I recommend &lt;a href="https://github.com/gujjwal00/avnc" target="_blank" rel="noreferrer"&gt;AVNC&lt;/a&gt; or &lt;a href="https://www.realvnc.com/en/connect/download/viewer/" target="_blank" rel="noreferrer"&gt;RealVNC Viewer&lt;/a&gt;. The latter has more features, but it is proprietary software.&lt;/p&gt;
&lt;p&gt;On computers, I recommend &lt;a href="https://remmina.org/" target="_blank" rel="noreferrer"&gt;Remmina&lt;/a&gt;&lt;/p&gt;

&lt;h2 class="relative group"&gt;2. Configure the VNC server
 &lt;div id="2-configure-the-vnc-server" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-configure-the-vnc-server" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Choose one of the two.&lt;/p&gt;

&lt;h3 class="relative group"&gt;Run the VNC server directly in Termux
 &lt;div id="run-the-vnc-server-directly-in-termux" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#run-the-vnc-server-directly-in-termux" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;In fact, proot-distro is not required. Termux itself provides a native VNC server package. But if you want to open the desktop of a Linux distribution inside proot-distro, do not use this method.&lt;/p&gt;
&lt;p&gt;Also, the desktop environment packages included in Termux are not as rich as those in proot-distro. The most complete one at present is XFCE.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://ivonblog.com/en-us/posts/termux-desktop-environment/" target="_blank" rel="noreferrer"&gt;Install the XFCE desktop&lt;/a&gt; for Termux, but do not install Termux X11.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the TigerVNC package. The current version is 1.13.0.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install tigervnc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Set the VNC server password&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vncpasswd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Add the program to execute after the VNC server starts by editing &lt;code&gt;~/.vnc/xstartup&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir ~/.vnc/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Fill in the following content&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;unset&lt;/span&gt; SESSION_MANAGER
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;unset&lt;/span&gt; DBUS_SESSION_BUS_ADRESS
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Start the PulseAudio sound server; audio will come out from Termux&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pulseaudio --start --exit-idle-time&lt;span class="o"&gt;=&lt;/span&gt;-1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pacmd load-module module-native-protocol-tcp auth-ip-acl&lt;span class="o"&gt;=&lt;/span&gt;127.0.0.1 auth-anonymous&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Run the desktop environment, XFCE here&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;exec&lt;/span&gt; startxfce4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;Grant execute permission to xstartup&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod +x ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="7"&gt;
&lt;li&gt;Define the VNC server configuration file. Edit &lt;code&gt;~/.vnc/tigervnc.conf&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim ~/.vnc/tigervnc.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="8"&gt;
&lt;li&gt;Fill in the following content:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Current session XFCE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$session&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;xfce-session&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Resolution; higher values use more bandwidth&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$geometry&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;1920x1080&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Bit depth, values are 8/16/24/32; larger numbers look better but use more bandwidth&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$depth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;32&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Allow external networks to connect&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$localhost&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;no&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 class="relative group"&gt;Run the VNC server inside proot-distro
 &lt;div id="run-the-vnc-server-inside-proot-distro" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#run-the-vnc-server-inside-proot-distro" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;p&gt;First install Termux proot-distro, such as &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-distro-debian/" target="_blank" rel="noreferrer"&gt;Debian&lt;/a&gt;. Then install a desktop environment inside proot-distro. XFCE uses the fewest resources, but KDE Plasma is also worth trying.&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/vncserver-termux/featured.webp"/></item><item><title>Install a graphical desktop environment and audio output in Termux</title><link>https://ivonblog.com/en-us/posts/termux-desktop-environment/</link><pubDate>Sun, 25 Aug 2024 13:00:00 +0800</pubDate><author>infoivonblog.nkfjt@aleeas.com (Ivon Huang)</author><guid>https://ivonblog.com/en-us/posts/termux-desktop-environment/</guid><description>&lt;!-- Co-translated by ChatGPT --&gt;
&lt;p&gt;Note: because the Termux filesystem differs from ordinary Linux and has fewer packages, I tend to install a &lt;a href="https://ivonblog.com/en-us/posts/termux-proot-distro/" target="_blank" rel="noreferrer"&gt;Linux proot container&lt;/a&gt; and run the desktop environment there. Although it is slower, the experience is better.&lt;/p&gt;
&lt;p&gt;By default, Termux only has a text interface. Users can install a desktop environment themselves, then connect through VNC or Termux X11 to get a desktop-computer-like experience.&lt;/p&gt;
&lt;p&gt;At present, desktop environments included in the Termux package repository include XFCE, LXQT, MATE, OpenBox, i3wm, Weston, and so on.&lt;/p&gt;
&lt;p&gt;Termux can also use Android GELS to output audio, so we can run a PulseAudio server for audio output in the desktop environment.&lt;/p&gt;
&lt;p&gt;This article explains how to install the XFCE desktop and configure the PulseAudio server.
&lt;figure&gt;
 &lt;img
 class="my-0 rounded-md"
 loading="lazy"
 decoding="async"
 fetchpriority="low"
 alt=""
 src="https://ivonblog.com/en-us/posts/termux-desktop-environment/images/Screenshot_20240825-133543.webp"
 onerror="this.onerror=null;this.src='https://ivonblog.com/images/cannotloadimage.avif'"
 width="1080"
 height="462"&gt;&lt;figcaption&gt;Termux running the XFCE desktop environment and desktop Firefox browser&lt;/figcaption&gt;&lt;/figure&gt;&lt;/p&gt;

&lt;h2 class="relative group"&gt;1. Prerequisites
 &lt;div id="1-prerequisites" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#1-prerequisites" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;To run a desktop environment, I recommend a phone with at least 6GB RAM.&lt;/p&gt;
&lt;p&gt;Please install &lt;a href="https://ivonblog.com/en-us/posts/how-to-use-termux/" target="_blank" rel="noreferrer"&gt;Termux&lt;/a&gt; first, and remember to disable Phantom Process Killing to prevent Termux from being terminated by the system in the background.&lt;/p&gt;

&lt;h2 class="relative group"&gt;2. Install the XFCE desktop environment
 &lt;div id="2-install-the-xfce-desktop-environment" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#2-install-the-xfce-desktop-environment" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Termux does not package many desktop environments, so choose XFCE, which is lightweight but still sufficiently functional.&lt;/p&gt;
&lt;p&gt;Install XFCE4, the Firefox browser, and the VIM editor:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install x11-repo
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install xfce xfce4-goodies pulseaudio pavucontrol vim firefox&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 class="relative group"&gt;3. Connect to the graphical interface
 &lt;div id="3-connect-to-the-graphical-interface" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#3-connect-to-the-graphical-interface" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Choose one of the two; they can coexist. I recommend Termux X11, which performs better than VNC, but is less convenient for remote connections.&lt;/p&gt;

&lt;h3 class="relative group"&gt;Termux X11
 &lt;div id="termux-x11" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#termux-x11" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Configure &lt;a href="https://ivonblog.com/en-us/posts/termux-x11/" target="_blank" rel="noreferrer"&gt;Termux X11&lt;/a&gt; and &lt;a href="https://ivonblog.com/en-us/posts/termux-virglrenderer/" target="_blank" rel="noreferrer"&gt;virglrenderer&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To make starting the desktop environment easier later, add a script&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim ~/startxfce4.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Fill in the following content:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Start GPU acceleration&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;virgl_test_server_android &lt;span class="p"&gt;&amp;amp;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Start audio server&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pulseaudio --start --exit-idle-time&lt;span class="o"&gt;=&lt;/span&gt;-1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pacmd load-module module-native-protocol-tcp auth-ip-acl&lt;span class="o"&gt;=&lt;/span&gt;127.0.0.1 auth-anonymous&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Start desktop environment&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;termux-x11 :0 -xstartup &lt;span class="s2"&gt;&amp;#34;dbus-launch --exit-with-session xfce4-session&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Grant execute permission&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod +x ~/startxfce4.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Exit Termux.&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;exit&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;
&lt;p&gt;Start the Termux X11 app&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Return to Termux and start the desktop environment. The XFCE4 desktop will appear in the Termux X11 app screen.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./startxfce4.sh&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 class="relative group"&gt;VNC server
 &lt;div id="vnc-server" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#vnc-server" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install the &lt;a href="https://github.com/gujjwal00/avnc" target="_blank" rel="noreferrer"&gt;AVNC&lt;/a&gt; client on the phone&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the TigerVNC package. The current version is 1.13.0.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pkg install tigervnc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="3"&gt;
&lt;li&gt;Set the VNC server password&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vncpasswd&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="4"&gt;
&lt;li&gt;Add the program to execute after the VNC server starts by editing &lt;code&gt;~/.vnc/xstartup&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mkdir ~/.vnc/
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="5"&gt;
&lt;li&gt;Fill in the following content&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;unset&lt;/span&gt; SESSION_MANAGER
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;unset&lt;/span&gt; DBUS_SESSION_BUS_ADRESS
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Start the PulseAudio sound server; audio will come out from Termux&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pulseaudio --start --exit-idle-time&lt;span class="o"&gt;=&lt;/span&gt;-1
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pacmd load-module module-native-protocol-tcp auth-ip-acl&lt;span class="o"&gt;=&lt;/span&gt;127.0.0.1 auth-anonymous&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Run the desktop environment, XFCE here&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;exec&lt;/span&gt; startxfce4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="6"&gt;
&lt;li&gt;Grant execute permission to xstartup&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;chmod +x ~/.vnc/xstartup&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="7"&gt;
&lt;li&gt;Define the VNC server configuration file. Edit &lt;code&gt;~/.vnc/tigervnc.conf&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vim ~/.vnc/tigervnc.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="8"&gt;
&lt;li&gt;Fill in the following content:&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Current session XFCE&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$session&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;xfce-session&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Resolution; higher values use more bandwidth&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$geometry&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;1920x1080&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Bit depth, values are 8/16/24/32; larger numbers look better but use more bandwidth&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$depth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;32&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Allow external networks to connect&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;$localhost&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;no&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;ol start="9"&gt;
&lt;li&gt;
&lt;p&gt;Enter the &lt;code&gt;tigervncserver&lt;/code&gt; or &lt;code&gt;vncserver&lt;/code&gt; command in Termux to start the VNC server. Observe the port number output on the screen; it usually starts from 1. Since VNC server ports count from 5900, the port here is 5901.&lt;/p&gt;</description><media:content xmlns:media="http://search.yahoo.com/mrss/" url="https://ivonblog.com/en-us/posts/termux-desktop-environment/featured.webp"/></item></channel></rss>