vnc配置

本文介绍了如何安装和配置VNC Server,包括编辑/etc/sysconfig/vncservers文件设置服务器账号,以及如何通过VNCSERVERS变量指定多个账号。此外,还提到了重启服务的步骤,并指导了设置VNC密码的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装VNC Server

[root@dfmc-dbaasem-01 ~]# rpm -q vnc-server
package vnc-server is not installed
[root@dfmc-dbaasem-01 ~]# yum install -y vnc-server
Loaded plugins: aliases, changelog, kabi, ovl, presto, refresh-packagekit, security, tmprepo, ulninfo, verify, versionlock
Loading support for kernel ABI
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tigervnc-server.x86_64 0:1.1.0-24.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                    Arch                              Version                                   Repository                                 Size
========================================================================================================================================================================
Installing:
 tigervnc-server                            x86_64                            1.1.0-24.el6                              oraclelinux6.9                            1.0 M

Transaction Summary
========================================================================================================================================================================
Install       1 Package(s)

Total download size: 1.0 M
Installed size: 2.6 M
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 1.0 M
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : tigervnc-server-1.1.0-24.el6.x86_64                                                                                                                  1/1 
  Verifying  : tigervnc-server-1.1.0-24.el6.x86_64                                                                                                                  1/1 

Installed:
  tigervnc-server.x86_64 0:1.1.0-24.el6                                                                                                                                 

Complete!
[root@dfmc-dbaasem-01 ~]# 

vi /etc/sysconfig/vncservers

# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the lines below to start a VNC server on display :2
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see this URL:
# https://access.redhat.com/knowledge/solutions/7027

# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.

# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.

VNCSERVERS="2:myusername"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
#VNCSERVERS="2:myusername"
VNCSERVERS="1:root 2:grid 3:oracle"
VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

VNCSERVERS 是用来设定可以使用VNC的服务器账号,可以设定多个,例如上面root、grid、oracle,但是中间要用空格隔开。使用VNCVIEWER登录时,10.2.21.10:1表示是以root账号登录

重启服务:

[root@dfmc-dbaasp-01 ~]# service vncserver start
正在启动 VNC 服务器:1:root A VNC server is already running as :1
2:grid 
You will require a password to access your desktops.

getpassword error: Inappropriate ioctl for device
Password:3:oracle 
You will require a password to access your desktops.

getpassword error: Inappropriate ioctl for device
Password:[失败]
[root@dfmc-dbaasp-01 ~]# 

设置vnc密码

[root@dfmc-dbaasp-01 ~]# vncpasswd
Password:
Verify:
[root@dfmc-dbaasp-01 ~]#su - grid
[root@dfmc-dbaasp-01 ~]# vncpasswd
Password:
Verify:
[root@dfmc-dbaasp-01 ~]#su - oracle
[root@dfmc-dbaasp-01 ~]# vncpasswd 
Password:
Verify:
[root@dfmc-dbaasp-01 ~]# 


配置xstartup文件
如下所示,将下面的部分注释取消
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc



[root@dfmc-dbaasp-01 ~]# service vncserver restart
关闭 VNC 服务器:1:root 2:grid 3:oracle [确定]
正在启动 VNC 服务器:1:root xauth: (stdin):1:  bad display name "dfmc-dbaasp-01:1" in "add" command

New 'dfmc-dbaasp-01:1 (root)' desktop is dfmc-dbaasp-01:1

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/dfmc-dbaasp-01:1.log

2:grid xauth: (stdin):1:  bad display name "dfmc-dbaasp-01:2" in "add" command

New 'dfmc-dbaasp-01:2 (grid)' desktop is dfmc-dbaasp-01:2

Starting applications specified in /home/grid/.vnc/xstartup
Log file is /home/grid/.vnc/dfmc-dbaasp-01:2.log

3:oracle xauth: (stdin):1:  bad display name "dfmc-dbaasp-01:3" in "add" command

New 'dfmc-dbaasp-01:3 (oracle)' desktop is dfmc-dbaasp-01:3

Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/dfmc-dbaasp-01:3.log

[确定]

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值