加入收藏 | 设为首页 | 会员中心 | 我要投稿 应用网_镇江站长网 (https://www.0511zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

CentOS 6.3下 VNC Server 的配置 - Linux系统

发布时间:2014-06-02 02:14:55 所属栏目:Linux 来源:站长网
导读:操作系统:CentOS6.3 Linux 可以通过使用 SSH 远程连接来进行控制,也可以在主机执行以下命令进行投射。 [root@localhost ~]# export DISPLAY=ipaddress:0[root@
操作系统:CentOS6.3

Linux 可以通过使用 SSH 远程连接来进行控制,也可以在主机执行以下命令进行投射。

[root@localhost ~]# export DISPLAY=ipaddress:0
[root@localhost ~]# xhost +

这个命令要求 ipaddress 的机器装有 X Server(比如 Xmanager),但有时需要将远程整个的 Linux 桌面投射到本地,这时仍可通过安装配置 Xmanager 来实现。

本文主要介绍 VNC Server 的配置方法,需配置好 yum 源,文中的“主机”指安装 Linux 的机器。

首先验证主机上是否安装 VNC Server,使用

[root@localhost ~]# yum list | grep vnc

的命令。返回

tigervnc.x86_64                        1.0.90-0.10.20100115svn3945.el6    @local
tigervnc-server.x86_64                 1.0.90-0.10.20100115svn3945.el6    @local

就代表已经存在,否则就通过

[root@localhost ~]# yum install "*vnc*" pixman pixman-devel libXfont -y

的命令进行安装。

单用户root配置方法:

1. 启动 VNC Server,这时会要求你输入两次进行连接的初始密码。

[root@localhost ~]# vncserver
You will require a password to access your desktops.

Password: //输入密码
Verify: //再次输入密码
xauth: creating new authority file /root/.Xauthority

New ‘localhost.localdomain:1 (root)’ desktop is localhost.localdomain:1

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log

这里要注意:每个用户都可以启动多个 VNC Server 远程桌面,它们用 ip 加端口号:ip:1、ip:2、ip:3 来标识区分,使用同一端口会使另外登录的用户自动退出。另,VNC Server 的大部分配置文件及日志文件都在用户 home 目录的.vnc 目录下。

用户可以自定义启动号码如:

[root@localhost ~]# vncserver :2        #注意:2前面一定要有空格。
A VNC server is already running as :2

2. Red Hat Linux 支持两种图形模式:KDE 模式和 gnome 模式。

你的 Redh Hat 使用的什么图形模式这个一般只有登录到图形界面查看一下才能知道,或者通过

[root@localhost ~]# ps -aux | grep gnome

这样的命令来判断。

如果是 gnome 桌面,那么需要修改/root/.vnc/xstartup的配置文件。

使用 vi 打开 xstartup 文件,如下:

[root@localhost /]# cd /root/.vnc
[root@localhost .vnc]# vi xstartup

删除全部内容,然后添加如下内容:

-------------------------

unset SESSION_MANAGER

exec /etc/X11/xinit/xinitrc

-------------------------

注:若启动黑屏则添加如下脚本内容

-------------------------------

#[-x /etc/vnc/xstartup]]&& exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &

xterm -gemetry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#twm &

gnome-session &

-------------------------------

(编辑:应用网_镇江站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!