1.系统环境 Redhat5.5 x86_64 2.查看是否已安装vncserver #rpm -qa | grep vnc vnc-server-4.1.2-14.el5_3.1 vnc-4.1.2-14.el5_3.1 3.切换至普通用户 #su – xue 4.设置xue用户登录VNC密码 vncpasswd Password: Verify: 5.配置vnc-server配置文件 cat /etc/sysconfig/vncservers | grep -v"^#" | grep -v "^$" VNCSERVERS="1:xue" VNCSERVERARGS[1]="-geometry 800x600-nolisten tcp -nohttpd -localhost" (也即把最后两行#去掉,修改一下用户名即可若需要支持多用户,使用空格隔开) 6.启动vncserver /sbin/servicevncserver restart Shuttingdown VNC server: 1:xue [FAILED] StartingVNC server: 1:xue xauth: creating newauthority file /home/xue/.Xauthority xauth:(stdin):1: bad display name"ihs:1" in "add" command
New'ihs:1 (xue)' desktop is ihs:1
Creatingdefault startup script /home/xue/.vnc/xstartup Startingapplications specified in /home/xue/.vnc/xstartup Logfile is /home/xue/.vnc/ihs:1.log
[ OK ] 7.配置vncserver,使客户端可以使用桌面环境 cat~/.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&
gnome-session& 8.重启vncserver #/sbin/service vncserver restart Shuttingdown VNC server: 1:xue [ OK ] StartingVNC server: 1:xue xauth: (stdin):1: baddisplay name "ihs:1" in "add" command
New'ihs:1 (xue)' desktop is ihs:1
Startingapplications specified in /home/xue/.vnc/xstartup Logfile is /home/xue/.vnc/ihs:1.log
[ OK ] 9.查看端口 #netstat -tlunp ActiveInternet connections (only servers) ProtoRecv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN 1824/Xvnc tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 1824/Xvnc tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 1824/Xvnc tcp 0 0 :::6001 :::* LISTEN 1824/Xvnc tcp 0 0 :::22 :::* LISTEN 1592/sshd 10.查看进程 #ps -ef | grep vnc | grep -v grep xue 1824 1 0 16:31 ? 00:00:00 Xvnc :1 -desktop ihs:1 (xue)-httpd /usr/share/vnc/classes -auth /home/xue/.Xauthority -geometry 1024x768-depth 16 -rfbwait 30000 -rfbauth /home/xue/.vnc/passwd -rfbport 5901 -pn #ps aux | grep vnc | grep -v grep xue 1824 0.1 0.3 47812 7552 ? S 16:31 0:00 Xvnc :1 -desktop ihs:1 (xue) -httpd /usr/share/vnc/classes -auth/home/xue/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth/home/xue/.vnc/passwd -rfbport 5901 –pn 11.查看日志是否无误 12.客户端登录测试
输入用户名和密码
登录即可。
|