Installation of Tigervnc
First, make adjustments to the configuration files to make them
compatible with LFS systems:
patch -Np1 -i ../tigervnc-1.11.0-configuration_fixes-1.patch
Install tigervnc by running the
following commands:
# Put code in place
mkdir -p unix/xserver &&
tar -xf ../xorg-server-1.20.7.tar.bz2 \
--strip-components=1 \
-C unix/xserver &&
( cd unix/xserver &&
patch -Np1 -i ../xserver120.patch ) &&
# Build viewer
cmake -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-Wno-dev . &&
make &&
# Build server
pushd unix/xserver &&
autoreconf -fiv &&
CFLAGS="$CFLAGS -I/usr/include/drm" \
./configure $XORG_CONFIG \
--disable-xwayland --disable-dri --disable-dmx \
--disable-xorg --disable-xnest --disable-xvfb \
--disable-xwin --disable-xephyr --disable-kdrive \
--disable-devel-docs --disable-config-hal --disable-config-udev \
--disable-unit-tests --disable-selective-werror \
--disable-static --enable-dri3 \
--without-dtrace --enable-dri2 --enable-glx \
--with-pic &&
make &&
popd
This package does not come with a test suite.
Now, as the root
user:
#Install viewer
make install &&
#Install server
( cd unix/xserver/hw/vnc && make install ) &&
[ -e /usr/bin/Xvnc ] || ln -svf $XORG_PREFIX/bin/Xvnc /usr/bin/Xvnc
Command Explanations
tar -xf ..
xorg-server...: This command extracts the standard
Xorg package into the tree in a location needed for modification.
--disable ...
: Most options that are
usually needed for the standard Xorg server are not needed for the
Xvnc instance being built.
[ -e /usr/bin/Xvnc ] || ln ...
Xvnc: If the Xvnc server is not installed in the
/usr/bin
directory, then create a
link so the vncserver
script can find it.
Configuring Tigervnc
The default installation of this package makes some changes in the
way it is used. The vncserver perl script is placed in /usr/libexec
and the server is designed to be run via a systemd style .service
file or the vncsession script as the root user. The man page for
vncserver is placed in section 8 of the man pages. The new
procedures require a display manager to be installed.
To restore the previous behavior, as the root
user:
install -m755 --owner=root ../vncserver /usr/bin &&
cp ../vncserver.1 /usr/share/man/man1
Using the previous procedures, the user specific configuration
files of vncserver reside in the .vnc
directory in the user's home directory. The xstartup
file in that directory is a script
specifying what commands to run when a VNC desktop is started. If
no xstartup
file exists, vncserver will try to start an
xterm in a twm session. An example xstartup
would be:
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
startlxde &
The xstartup
file must be executable
for the commands in it to be executed, so run chmod a+x ~/.vnc/xstartup.
Set up the vnc passwd with vncpasswd. The server can then be
started with the vncserver command. See the man
pages in section 1 for the vncserver for the server system and
vncviewer for the remote system.
Server Configuration
Note
This section is optional and is only useful if you want to have
VNC sessions launch on system startup. Both configuration methods
can coexist on the same system.
On systemd systems, another method of configuration is available.
This configuration provides the added benefit of making tigervnc
systemd aware for VNC sessions and allows desktop environments like
GNOME to autostart services once
the VNC session is started. This configuration also gives the added
benefit of starting VNC Sessions on system startup. To setup the
VNC server in this fashion, follow these instructions.
First, install a rudimentary Xsession file so that the VNC server
can initialize X sessions properly:
install -vdm755 /etc/X11/tigervnc &&
install -v -m755 ../Xsession /etc/X11/tigervnc
Next, setup a user mapping in /etc/tigervnc/vncserver.users
. This tells the VNC
Server which session is allocated to a user.
echo ":1=$(whoami)" >> /etc/tigervnc/vncserver.users
Next, setup a configuration file to tell vncserver which desktop environment should be
used and what display geometry should be used. There are several
other options that can be defined in this file, but they are
outside the scope of BLFS.
cat > ~/.vnc/config << EOF
# Begin ~/.vnc/config
session=LXDE # The session must match one listed in /usr/share/xsessions.
geometry=1024x768
# End ~/.vnc/config
EOF
To start the VNC Server, run the following command:
systemctl start vncserver@:1
To start the VNC Server when the system boots, run the following
command:
systemctl enable vncserver@:1