Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2921109
  • 博文数量: 454
  • 博客积分: 4860
  • 博客等级: 上校
  • 技术积分: 6375
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-13 10:08
个人简介

10年工作经验,专研网站运维。

文章分类

全部博文(454)

文章存档

2017年(11)

2016年(13)

2015年(47)

2014年(36)

2013年(147)

2012年(64)

2011年(136)

分类: LINUX

2012-11-05 16:07:18

思路:
远程ssh登录服务器,运行命令vncviewer :3即可。
 
0. 确认运行级别
[root@localhost ~]# runlevel
N 5
[root@localhost ~]#
1. As root permitssion run:
yum install *vnc*
2. 启动vnc服务:
[root@localhost ~]# /etc/init.d/vncserver restart
Shutting down VNC server:                                  [  OK  ]
Starting VNC server: no displays configured                [  OK  ]
2. 要以那个用户登录vnc服务器就以那个用户在远程打开客户端,这个客户端有讲究的,可以是两种,一种是Linux图形化机器当作客户端(就是在一台linux系统下),就是我现在用的,另一种是ssh客户端软件,比方说xmanager,如果是这一种,那么必须全部安装并且输入license。
输入命令:
注意:这个命令只能在root用户下执行,如果在其他用户下执行vnc不会生效。比方说当前用户是oracle,然后执行如下命令,那么往下操作就不会生效。必须先退回到root用户下再进行下面的操作。
ssh -X
输入远程登录的密码即可登录。
3. 配置vnc服务的密码,第二次不需要配置:
注意:如果是给普通用户配置vnc服务,不是root用户。需要切换到相应的用户:[root@localhost ~]# su - oracle,然后才能执行命令。

[root@localhost ~]# vncserver

You will require a password to access your desktops.

Password:
Verify:

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

注意:看到上面红色的1,就是指vnc所指定的ID号,就是说,使用1,还是3,还是其他的数字是这里指定的,不能乱指定的。

3. 登录进终端后,应该是字符界面,操作如下:
 vim /home/oracle/.vnc/xstartup

#!/bin/sh
# Uncomment the following two lines for normal desktop:
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 -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
注释第三行和第四行,就是把这两行的#号去掉。
保存退出。
4. 以当前用户停止vnc服务,如果是root用户后面是:1,如果是其他用户,后面是:3或更大的数字。
 vncserver -kill :3
5. 启动vnc 服务。
vncserver :3
6. 登录即可。
vncviewer :3
 
备注:
1. 如果是shell客户端软件必须得设置客户端软件支持图像化界面。
 
阅读(2125) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~