个人工具

UbuntuHelp:FreeNX/zh

来自Ubuntu中文

跳转至: 导航, 搜索


FreeNX 是什么

FreeNX 是一个允许你通过互联网从另外一台电脑进入你桌面的系统。你可以用此系统来进行远程的图形界面登录。比方说它可以用于:在你的家用电脑上装好FreeNX服务端,然后就可以用FreeNX客户端从你的工作电脑来图形登录到家用电脑上。它是开源的、安全(基于SSH)、快捷并且用途广泛!注意:目前FreeNX还仅限于本地和远程机器的桌面环境是Linux或Unix。在Ubuntu上运行FreeNX为服务端并在Windows中配合使用NoMachine的免费"NX Client for Windows",也能运行良好。

术语

服务器(server)是你想接入的电脑。此电脑也就应该安装FreeNX服务端程序。提供服务端的Ubuntu包叫"freenx"。对前面的举例而言,家用电脑就是服务器。 客户端(client)是指你准备接入"服务器"的那台电脑。提供客户端的Ubuntu包叫"nxclient"。对前面的例子而言,工作电脑是客户端。

安装

安装FreeNX服务端

我们将在提供服务的电脑上安装FreeNX服务端,即那台你想远程登录的机器。在前面举例中指那台你家中的电脑。打开你的aptitude源列表在文件内容后加上两行。

gksudo gedit /etc/apt/sources.list

对于Ubuntu 5.10 和 6.06,请加入:

 
deb http://mirror.ubuntulinux.nl/ dapper-seveas freenx
deb-src hhttp://mirror.ubuntulinux.nl/ dapper-seveas freenx

对于Ubuntu 7.04,请加入:

 
deb http://mirror.ubuntulinux.nl/ feisty-seveas freenx
deb-src http://mirror.ubuntulinux.nl/ feisty-seveas freenx

对于Ubuntu 8.04 和 8.10 你可以在[1]找到相关信息。 保存并关闭列表。对于更老的发行版还必须加上GPC key:

wget http://mirror.ubuntulinux.nl/seveas.gpg -O- | sudo apt-key add -

然后更新apt

sudo apt-get update

在添加源后安装freenx 包。

sudo aptitude install freenx

(利用aptitude来安装依赖包) [注:你也可以用sudo nxsetup --install --setup-nomachine-key 来手动执行安装] 在安装过程中会让你选择NoMachine keys还是custom keys。最好是选NoMachine keys。 说给paranoid:利用默认keys会带来额外的安全风险。如果你保留了默认key则在安装时系统默认设置为所有人都将可以作为NX用户连接到你的SSH服务器。这样就会让你的电脑更易受到额外(非必要)的攻击。你可以使用客户key来避免这样的不安全因素,稍后会介绍怎么做。 在服务器上,在nxserver中添加你的用户

sudo nxserver --adduser <username>
sudo nxserver --passwd <username>
sudo nxserver --restart

[注:I don't know if this is still needed, but it helps - JeremySchroeder]

安装NX客户端

sudo aptitude install nxclient

你应该可以从任何Windlows或Linux box中用从 NoMachine's website下载的免费客户端程序来登入你的Ubuntu box。 你也可以将你的NX服务器嵌入装有Nomachine Web Companion和Apache网页服务器的网页中。 (!) NoMachine网站提醒他的nxclient新版本2.0不再与freenx兼容,所以你最好使用从Seveas' Packages下载的nxclient。 现在你可以执行下面的命令来运行装好的客户端:

/usr/NX/bin/nxclient &

或者在菜单中找到它 这种启动NX客户端的图形界面,并指导一步步联接到FreeNX服务器,这样就成功了! [注意:如果在防火墙下你可能需要在高级配置(Advanced configuration)标签页中允许SSL encryption。 - JeremySchroeder] Useful Resource for installing client on 64-bit Ubuntu

杂项

Ubuntu 8.04 LTS:调整字体目录

如果nxclient只是在成功认证后存在,很有可能你应该调整X字体路径的位置: Edit /etc/nxserver/node.conf

sudoedit /etc/nxserver/node.conf

找到下面这一行(around line 371):

#AGENT_EXTRA_OPTIONS_X=""

然后改为:

AGENT_EXTRA_OPTIONS_X="-fp /usr/share/fonts/X11/misc:/usr/share/X11/fonts/cyrillic:/usr/share/fonts/X11/Type1:/usr/share/X11/fonts/CID:/usr/share/fonts/X11/100dpi:/usr/share/fonts/X11/75dpi:/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType:/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID"

FreeNX on PowerPC

There are no precompiled binaries of FreeNX on this platform, so FreeNX have to be compiled from source. Sources for breezy can be found at SeveasPackages These steps will build FreeNX from source:

  1. Create a directory to hold the FreeNX source, and cd into it.
    mkdir freenxSource; cd freenxSource
  2. Build the freenx pacakges and install related packages.
    sudo apt-get build-dep nx freenx
    apt-get -b source nx freenx
    This will download the souce tarballs and build the freenx packages (*.deb) in the current directory.
  3. Install the FreeNX packages.
    sudo dpkg -i *.deb
  4. If dpkg complains about missing packages, let apt fix it
    sudo apt-get -f install
    sudo dpkg -i *.deb

FreeNX on 64bit

FreeNX is not 64-bit safe, so you will have to build a 32-bit chroot.

如何开始/停止 FreeNX

FreeNX服务器并不提供服务只是使用了ssh。如下命令将使FreeNX程序拒绝接入。

sudo nxserver --stop

(用--start代替--stop来重启服务)

配置SSH端口

默认情况下,nxsever通过SSH使用22端口进行通信。但是,在一些机器或网络中,22端口被禁用;一些互联网提供商也屏蔽了22端口。22端口也是网络入侵者的常用目标。如果想让SSH服务器监听8888端口,可如下操作: Edit the file /etc/ssh/sshd_config

gksudo gedit /etc/ssh/sshd_config
Find
Port 22
and change it to
Port 8888

You then need to restart SSHD.

Try
/etc/init.d/ssh restart

Edit the file /etc/nxserver/node.conf

gksudo gedit /etc/nxserver/node.conf
Find
# The port number where local 'sshd' is listening.
#SSHD_PORT=22

and change it to:

# The port number where local 'sshd' is listening.
SSHD_PORT=8888

That is, change the port number to the one that sshd is listening to, and uncomment the line.

使用客户SSH keys

/!\ This is NOT supported by the FreeNX developers - only do this if you have no other option

  1. Generate the DSA private-public key pair.
     ssh-keygen -t dsa
    By default this key is places in ~/.ssh/id-dsa. You can leave the passphrase empty, this will not pose a security risk.
  2. Install the public key in the FreeNX serving machine. The key should be placed in the file authorized_keys2 in the .ssh dir of the user named nx.
    cat ~/.ssh/id_dsa.pub | sudo -u nx tee -a ~nx/.ssh/authorized_keys2
  3. Install the private key in the NX client software. When creating a session, press the button labeled "Key" and select your new key in the window that pops up.

References

Related docs

You can also have a look at the article about installing the |NX packages provided by NoMachine company