安装:
[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
查看进程:
[root@localhost ~]# ps -ef|grep vnc
root 23180 1 6 13:57 pts/1 00:00:00 Xvnc :1 -desktop localhost.localdomain:1 (root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -pn
root 23184 1 0 13:57 pts/1 00:00:00 vncconfig -iconic
root 23219 17944 0 13:57 pts/1 00:00:00 grep vnc
修改管理窗口:
以gnome管理
[root@localhost ~]# 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" &
#twm &
gnome-session &
~
~
~
~
~
~
~
~
~
~
".vnc/xstartup" 13L, 351C written
重启服务:
[root@localhost ~]# service vncserver restart
Shutting down VNC server: [ OK ]
Starting VNC server: [ OK ]
[root@localhost ~]#
或者这样重启:
[root@localhost .vnc]# vncserver -kill :1
Killing Xvnc process ID 23180
[root@localhost .vnc]# vncserver -kill :2
Killing Xvnc process ID 23243
[root@localhost .vnc]# vncserver -kill :3
Can't find file /root/.vnc/localhost.localdomain:3.pid
You'll have to kill the Xvnc process manually
[root@localhost .vnc]# vncserver
New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
访问VNC服务器
在客户端安装VNC viewer,然后打开:
中间填要访问的IP:1