Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2048085
  • 博文数量: 354
  • 博客积分: 4955
  • 博客等级: 上校
  • 技术积分: 4579
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-21 11:46
文章分类

全部博文(354)

文章存档

2015年(1)

2013年(4)

2012年(86)

2011年(115)

2010年(67)

2009年(81)

我的朋友

分类: LINUX

2009-08-07 15:03:19

1、VNC的启动/停止/重启
#service vncserver start/stop/restart
关闭具体的vncserver命令:vncserver -kill :1 vncserver -kill :2
2、设置密码
#vncpasswd
3、客户端登陆
在vnc客户端中输入:服务器端IP:1或服务器端IP:2
4、设置登陆到KDE桌面
a.
[root@centos ~]# vi /etc/sysconfig/vncservers
#
# Uncomment the line below to start a VNC server on display :1
# 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
# .
# VNCSERVERS="1:myusername"
VNCSERVERS="1:root"
# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[1]=”-geometry 800×600 -alwaysshared -depth 24″
-alwaysshared代表允许多用户同时登录 -depth代为色深,参数有8,16,24,32。
注:红色部分就是被修改或增加的部分
b.
[root@centos .vnc]$ vi /root/.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" &
#gnome-session & #set starting GNOME desktop
startkde &   #kde desktop
#twm &     #Text interface
注:红色部分就是被修改或增加的部分
c.
重启VNC即可。



装oracle时候快速配置VNC
1. 启动VNCSERVER,第一次启动会提示输入密码。
[oracle@localhost /]$ vncserver
You will require a password to access your desktops.
Password: 123456            #输入vnc 连接密码
Verify: 123456                 #确认vnc密码

xauth: creating new authority file /home/oracle/.Xauthority

New ‘localhost.localdomain:2 (oracle)’ desktop is localhost.localdomain:2

Creating default startup script /home/oracle/.vnc/xstartup
Starting applications specified in /home/oracle/.vnc/xstartup
Log file is /home/oracle/.vnc/localhost.localdomain:2.log



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


2.. 配置gnome环境
你的RH使用的什么图形模式这个一般只有登录到图形界面查看一下才能知道,或者通过ps -A命令列出所有当前运行的程序,看看有没有KDE或者gnome字样来判断一下。

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


[oracle@localhost .vnc]$ vi 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 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
gnome-session gnome           #添加这一句是连接时使用gnome 桌面环境
twm &

设置修改完毕最好是重启一次系统,否则设置不会生效。我采用的方法是杀死VNCSERVER进程再重运行VNCSERVER。

[oracle@localhost .vnc]$ vncserver -kill :1      #这里你启动vncserver时是什么端口号要对应上。
[oracle@localhost .vnc]$ vncserver :1           #重启VNCSERVER,注意:1前面一定要有空格。


3. 设置分辨率
[root@localhost: ~]#vi /etc/sysconfig/vncservers

# `man vncviewer’ manual page.

VNCSERVERS=”1:oracle”            #此处添加用户,一般只添加一个就行了。
VNCSERVERARGS[1]=”-geometry 1024×768 -nolisten tcp -nohttpd -localhost”

4. 常用命令
修改密码 vncpasswd
启动VNC  vncserver :1
停止VNC  vncserver -kill :1

阅读(666) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~