centOS6.2 VNCserver搭建

任務:使工作的windowPC連接遠程linux服務器桌面
使用環境:centos6.2 x64 yum可用
一、安裝VNCserver端
# yum install tigervnc-server
二、配置服務
如果使用root用戶執行,則生成root用戶的vnc配置
[root@so366]# vncserver 
xauth:  creating new authority file /root/.Xauthority
xauth: (stdin):1:  bad display name "so366:1" in "add" command
 
New 'so366:1 (root)' desktop is so366:1
 
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/so366:1.log
會在當前用戶主目錄下 生成 .vnc  目錄和配置文件
設置客戶端登錄密碼
[root@so366]# vncpasswd 
Password:
Verify:
設置的密碼保存在  /root/.vnc/passwd
修改配置文件:
修改 xstartup 文件 把最後一行的 twm & 刪掉 加上 gnome-session & 
[root@so366 ~]# sed -i 's/twm &/gnome-session &/' ~/.vnc/xstartup
查看修改效果
[root@so366 ~]# tail -n 3 ~/.vnc/xstartup 
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
gnome-session twm &
 
修改vncserver的配置
# 桌面號:用戶    監聽 590* 端口
[root@so366 ~]# echo 'VNCSERVERS="2:root"' >> /etc/sysconfig/vncservers 
[root@so366 ~]# echo 'VNCSERVERARGS[2]="-geometry 800x600"' >> /etc/sysconfig/vncservers 
這樣修改後,就算 /etc/inittab 啓動模式爲 3  也可以正常進入圖形界面
 
[root@so366 ~]# /etc/init.d/vncserver start   
正在啓動 VNC 服務器:2:root xauth: (stdin):1:  bad display name "so366:2" in "add" command
 
New 'so366:2 (root)' desktop is so366:2
 
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/so366:2.log
 
                                                           [確定]
現在就可以在window下使用客戶端工具登錄系統了
推薦使用:RealVNC
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章