Linux下VNC的安装,配置,连接
安装配置VNC
1.服务器端配置YUM
mount -o loop /data/software/CentOS-7.6-x86_64-DVD-1810.iso /mnt
cd /etc/yum.repos.d
vi local.repo
------------------------------
[base]
name=centos 7.6
baseurl=file:///mnt
gpgcheck=0
enable=1
------------------------------
2.安装图形化
安装Linux时选择了最小化安装,因此需要安装图形化支持
# 查看是否安装有图形化界面
rpm -qa|grep gnome
# 安装图形化界面
yum groupinstall "X Window System" "Chinese Support" "GNOME Desktop"
X Window System
和GNOME Desktop
的关系可以参考:关系
3.安装VNC Server
yum install -y tigervnc tigervnc-server
4.配置VNC Server
vncserver --help
# 最简单的配置
vncserver :1
----------------------------------------------------------
[root@localhost system]# vncserver :1
You will require a password to access your desktops.
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
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
----------------------------------------------------------------
-
VNCSERVER允许同时启动多个VNCSERVER,每一个不同的VNCSERVER使用display#来区分,不同的用户可以使用不同的display#,同一个用户,也可以启动多个display#。
-
可以到config文件中修改配置,主要配置有分辨率geometry
以下演示创建oracle用户的VNCSERVER
useradd oracle passwd oracle su - oracle vncserver :2 # 在使用Vnc Viewer连接的时候,输入display#后直接连入oracle账户
5.VNC Server管理
5.1.设置开机自启动
systemctl enable vncserver@:1.service
5.2.关闭VNC Server
vncserver -kill :1
5.3.修改配置
vncserver -kill :1
vi $HOME/.vnc/config
------------------------
## Supported server options to pass to vncserver upon invocation can be listed
## in this file. See the following manpages for more: vncserver(1) Xvnc(1).
## Several common ones are shown below. Uncomment and modify to your liking.
##
# securitytypes=vncauth,tlsvnc
# desktop=sandbox
geometry=1440x900
# depth
# localhost
# alwaysshared
------------------------
vncserver :1
6.使用VNC Viewer连接VNC Server
6.1.下载安装
6.2.连接
输入IP和Display#即可
6.3.全屏展示
如果VNCServer的分辨率设置合适的话,可以全屏展示
鼠标悬浮到VNC Viewer的中间,点击全屏选项即可