欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

vnc配置

程序员文章站 2022-05-10 14:52:43
...

安装VNC Server

[aaa@qq.com ~]# rpm -q vnc-server
package vnc-server is not installed
[aaa@qq.com ~]# 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!
[aaa@qq.com ~]# 

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

[确定]

vnc配置

相关标签: vnc