小兔的筆記本

Just another WordPress.com weblog

在Ubuntu裡使用vncserver

Posted by Tsukino Usagi 於 七月 11, 2006

本文介紹如何在Ubuntu裡架設vnc, 使用的是tightvncserver, 本文的方法是用vnc另外啟動一個X環境, 不是在原本本機上的X環境加上vnc的功能.

以root的身份安裝:

$ apt-get install tightvncserver

接下來以一般的使用者的身份啟動:

$ vncserver

第一次啟動時會要求設定密碼, 按照螢幕上的指示輸入即可, 接著會出現「New ‘X’ desktop is 主機名稱:1」之類的訊息, 後面的1就是desktop的號碼.

之後就可以用vncviewer或其他vnc client連進去看, client這邊要指定連接埠或desktop的號碼, 若desktop是1的話, 連接埠就是5901, 2就是5902, 餘類推.

關閉vncserver的指令是:

$ vncserver -kill :1

1就是desktop的號碼.

可以修改~/.vnc/xstartup這個檔, 讓vncserver可以啟動GNOME或KDE

$ vim ~/.vnc/xstartup

把#!/bin/sh以外的文字都註解掉, 若想啟動GNOME, 加上

exec gnome-session

即可, KDE則是

exec startkde

若您發現用vnc啟動的GNOME或KDE畫面文字變得很小, 可以先去本機的環境, 下

$ xset q

指令, 然後用root的身份打開/etc/vnc.conf編輯, 參考xset q指令輸出的fontPath相關設定修改/etc/vnc.conf裡的fontPath相關設定, 以下是我機器上的設定(僅供參考):

$fontPath .= "/usr/share/X11/fonts/misc,";
$fontPath .= "/usr/share/X11/fonts/100dpi/:unscaled,";
$fontPath .= "/usr/share/X11/fonts/75dpi/:unscaled,";
$fontPath .= "/usr/share/X11/fonts/Type1,";
$fontPath .= "/usr/share/X11/fonts/100dpi,";
$fontPath .= "/usr/share/X11/fonts/75dpi,";
$fontPath .= "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType";

並且往後啟動vncserver時, 都要加上 -dpi 100 的參數, 如下:

$ vncserver -dpi 100

6 回應 to “在Ubuntu裡使用vncserver”

  1. ppip said

    字体还好啦,主要是 -dpi 这个参数比较重要。

  2. Pretty nice post. I simply stumbled upon your blog and wanted to say that I’ve truly enjoyed browsing your weblog posts. In any case I will be subscribing to your rss feed and I am hoping you write once more soon!

  3. I’m starting up a internet website directory and was wondering if I can submit your website? I’m trying to increase
    my directory gradually by hand so that it maintains quality.
    I will make sure and put your blog in the appropriate category and I’ll additionally use, “在Ubuntu裡使用vncserver 小兔的筆記本" as your anchor text. Please make sure to let me know if this is okay with you by mailing me at: chiquitaterrill@aol.com. Many thanks

  4. Hi, I think your site might be having browser compatibility issues.
    When I look at your blog site in Chrome, it looks fine but
    when opening in Internet Explorer, it has some overlapping.
    I just wanted to give you a quick heads up! Other then that,
    amazing blog!

  5. Gabriela said

    Hey! This post couldn’t be written any better! Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this post to him. Fairly certain he will have a good read. Many thanks for sharing!

  6. Hey! This is my first visit to your blog! We are a collection of volunteers and starting a new project in a community in the same
    niche. Your blog provided us useful information to work on.
    You have done a marvellous job!

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s

 
%d 位部落客按了讚: