差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

兩邊的前次修訂版 前次修改
下次修改
前次修改
tech:vncserver [2011/09/20 13:49] jonathantech:vncserver [2016/10/29 22:04] (目前版本) – [CentOS 6] jonathan
行 1: 行 1:
 +====== CentOS 內設定 VNCServer 方式 ======
 +之前的困擾是 
 +  * vncserver 無法開機自動啟動
 +  * 登進去所看到的畫面只有標準 X Window , 並沒有 Window Manager(GNOME)
  
 +===== - 安裝相關 RPM =====
 +==== CentOS 5 ====
 +  * VNC Viewer & Server <code sh>
 +yum install vnc vnc-server
 +</code>
 +==== CentOS 6 ====
 +  * VNC Viewer & Server <code sh>
 +yum install tigervnc tigervnc-server
 +</code>
 +  * 如果 CentOS 6 是以 Basic Server 安裝, 要增加 Basic Desktop 相關套件<code sh>
 +yum groupinstall "basic-desktop" "X Window System"
 +</code>
 +
 +===== - 先手動執行一次 =====
 +假設我要 vncserver 啟動給 root 透過 5909 方式遠端登入, 之前的處理方式就是先用 root 登入該主機, 然後執行<code sh>
 +vncserver :09
 +</code>第一次會需要設定密碼
 +<note>
 +  * 如果需要更改密碼, 可以直接執行 vncpasswd
 +  * 如果需要刪除密碼, 可以直接移除掉 ~/.vnc/passwd
 +</note>
 +
 +===== - 更改 ~/.vnc/xstartup =====
 +將以下兩行前面的 # 取消掉 <file>
 +:
 +unset SESSION_MANAGER
 +exec /etc/X11/xinit/xinitrc
 +:
 +</file>
 +
 +===== - 更改 /etc/init.d/vncserver =====
 +找到 VNCSERVERS="" 將啟動的帳號加入, 例如 root 要 Listen 5909, jonathan 要 Listen 5901<file>
 +:
 +VNCSERVERS="1:jonathan 9:root"
 +</file>
 +<note>
 +  * Centos 6 要更改 /etc/sysconfig/vncservers <file>
 +:
 +VNCSERVERS="1:jonathan 9:root"
 +VNCSERVERARGS[1]="-geometry 1024x768 -nolisten tcp -localhost"
 +VNCSERVERARGS[9]="-geometry 800x600"
 +</file>
 +</note>
 +===== - 設定開機自動啟動 vncserver =====
 +<code sh>
 +chkconfig vncserver on
 +</code>
 +
 +===== - 測試手動啟動與關閉 =====
 +<code sh>
 +service vncserver start
 +</code>
 +<file>
 +[root@pdc-e2160 .vnc]# service vncserver start
 +正在啟動 VNC 伺服器: 1:jonathan
 +New 'pdc-e2160:1 (jonathan)' desktop is pdc-e2160:1
 +
 +Starting applications specified in /home/jonathan/.vnc/xstartup
 +Log file is /home/jonathan/.vnc/pdc-e2160:1.log
 +
 +9:root
 +New 'pdc-e2160:9 (root)' desktop is pdc-e2160:9
 +
 +Starting applications specified in /root/.vnc/xstartup
 +Log file is /root/.vnc/pdc-e2160:9.log
 +
 +                                                            確定  ]
 +</file>
 +<code sh>
 +service vncserver stop
 +</code>
 +<file>
 +[root@pdc-e2160 .vnc]# service vncserver stop
 +正在關閉 VNC 伺服器: 1:jonathan 9:root                      確定  ]
 +</file>
 +
 +===== 參考網址 =====
 +  * http://www.walkernews.net/2008/06/20/configure-vnc-server-to-auto-start-up-in-red-hat-linux/
 +  * https://wiki.centos.org/zh-tw/HowTos/VNC-Server
 +  * http://linux.vbird.org/linux_server/0310telnetssh/0310telnetssh-centos6-v1.php
 +
 +{{tag>vncserver 密技}}