tigervnc-server的配置
查看系统中是否有安装过vnc
rpm -qa | grep vnc
安装tigervnc-server
yum -y install tigervnc-server
查看安装包信息
[root@kvmserver images]# rpm -qi tigervnc-server #查看
Name : tigervnc-server
Version : 1.8.0
Release : 19.el7
Architecture: x86_64
Install Date: 2020年09月22日 星期二 17时04分15秒
Group : User Interface/X
Size : 521902
License : GPLv2+
Signature : RSA/SHA256, 2020年04月04日 星期六 05时09分34秒, Key ID 24c6a8a7f4a80eb5
Source RPM : tigervnc-1.8.0-19.el7.src.rpm
Build Date : 2020年04月01日 星期三 12时46分28秒
Build Host : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://www.tigervnc.com
Summary : A TigerVNC server
Description :
The VNC system allows you to access the same desktop from a wide
variety of platforms. This package includes set of utilities
which make usage of TigerVNC server more user friendly. It also
contains x0vncserver program which can export your active
X session.
查看安装文件
[root@kvmserver images]# rpm -ql tigervnc-server #查看安装文件
/etc/sysconfig/vncservers
/usr/bin/vncserver
/usr/bin/vncserver_wrapper
/usr/bin/x0vncserver
/usr/lib/systemd/system/vncserver@.service
/usr/lib/systemd/system/xvnc.socket
/usr/lib/systemd/system/xvnc@.service
/usr/share/man/man1/vncserver.1.gz
/usr/share/man/man1/x0vncserver.1.gz
查看配置文件
[root@kvmserver images]# rpm -qc tigervnc-server
/etc/sysconfig/vncservers
[root@kvmserver images]# cat /etc/sysconfig/vncservers
# THIS FILE HAS BEEN REPLACED BY /lib/systemd/system/vncserver@.service #配置文件其实在这
首次设置密码
[root@kvmserver images]# vncserver
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? n 问你是不是只读模式,回答n
A view-only password is not used
New 'kvmserver:1 (root)' desktop is kvmserver:1
Creating default startup script /root/.vnc/xstartup
Creating default config /root/.vnc/config
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/kvmserver:1.log
查看进程
[root@kvmserver images]# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID #进程号
:1 33007
[root@kvmserver images]# ps aux | grep 33007
root 33007 0.4 1.1 196880 43732 pts/0 S 17:15 0:04 /usr/bin/Xvnc :1 -auth /root/.Xauthority -desktop kvmserver:1 (root) -fp catalogue:/etc/X11/fontpath.d -geometry 1024x768 -pn -rfbauth /root/.vnc/passwd -rfbport 5901 -rfbwait 30000
root 34139 0.0 0.0 112828 980 pts/0 R+ 17:31 0:00 grep --color=auto 33007
查询端口
[root@kvmserver images]# netstat -anp | grep vnc
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 33007/Xvnc
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 33007/Xvnc
tcp 0 0 192.168.1.11:5901 192.168.0.98:14756 ESTABLISHED 33007/Xvnc
tcp6 0 0 :::5901 :::* LISTEN 33007/Xvnc
tcp6 0 0 :::6001 :::* LISTEN 33007/Xvnc
结束进程
建议每次用完结束调进程
kill 33007
设置分辨率
[root@kvmserver images]# vncserver -geometry 1920x1080
New 'kvmserver:2 (root)' desktop is kvmserver:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/kvmserver:2.log
防火墙的配置
临时快速配置
[root@localhost ~]# yum install tigervnc-server -y #安装
[root@localhost ~]# vncserver #启动并设置密码
You will require a password to access your desktops.
Password:123456
Verify:123456
Would you like to enter a view-only password (y/n)? n
xauth: file /root/.Xauthority does not exist
New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1
Creating default startup script /root/.vnc/xstartup
Creating default config /root/.vnc/config
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
[root@localhost ~]# vncserver :1 -geometry 1920x1080 #启动当前用户1号窗口,并设置分辨率
A VNC server is already running as :1