redhat 8 系列vnc变动说明
The previous Tigervnc versions had a wrapper script called vncserver which could be run as a user manually to start Xvnc process. The usage was quite simple as you just run.
$ vncserver :x [vncserver options] [Xvnc options]
and that was it. While this was working just fine, there were issues when users wanted to start a Tigervnc server using systemd. For these reasons things were completely changed and there is now a new way how this all is supposed to work.
安装yum安装vnc package
tip:rhel8的光盘分为2个仓库:BaseOS和AppStream,必须都要配置上。这2个仓库都不能少。事先挂载光盘:
#mount /dev/cdrom /mnt/cdrom/
#cd /etc/yum.repos.d
编辑配置文件localyum.repo
[BaseOS]
name=BaseOS
baseurl=file:///run/media/root/RHEL-8-3-0-BaseOS-x86_64/BaseOS
enabled=1
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///run/media/root/RHEL-8-3-0-BaseOS-x86_64/AppStream
enabled=1
gpgcheck=0
安装vnc
#yum install tigervnc -y
#yum install tigervnc-server tigervnc-server-module -y
Add a user mapping
With this you can map a user to a particular port.
#vim /etc/tigervnc/vncserver.users
:1=grid # 配置你的端口和用户
Configure Xvnc options
This file is for the default Xvnc configuration and will be applied to every user
unless any of the following applies:
The user has its own configuration in $HOME/.vnc/config
The same option with different value is configured in
‘vncserver-config-mandatory’ configuration file, which replaces the default configuration and has even a higher priority than the per-user configuration.
This option is for system administrators when they want to force particular Xvnc options.
#vim /etc/tigervnc/vncserver-config-defaults
session=gnome
alwaysshared
NOTE:
There is one important option you need to set and that option is the session you want to start. E.g when you want to start GNOME desktopwhich should match the name of a session desktop file from /usr/share/xsessions directory.
Set VNC password
You need to set a password for each user in order to be able to start the Tigervnc server. In order to create a password, you just run $vncpasswd:
#su - grid
$vncpasswd
Start the Tigervnc server
Finally you can start the server using systemd service.
systemctl start vncserver@:x # x为你为用户指定的端口
systemctl enable vncserver@:x
systemctl status vncserver@:1
6.At this point, the VNC service is up and running, verify that the VNC server is listening on TCP port 5901 using the netstat command.
#netstat -tlnp