个人工具

ThinClientHowto

来自Ubuntu中文

跳转至: 导航, 搜索

What is a Thin Client? 什么是瘦客户机?

To the user, a thin client behaves like a regular desktop computer. To the administrator, a thin client has no storage of its own, is easy to maintain, and can give the user a modern computing experience even with ancient hardware.

对于终端用户来说,瘦客户机和平常使用的计算机没有什么区别;对于管理员来说,一个瘦客户机是没有本机存储设备,易于管理,利用陈旧计算机硬件为用户提供先进的计算体验的设备。

How do thin clients work? 瘦客户机终端如何工作?

Thin clients are computers that load and run most of their programs from a central server, but are displayed on the thin client's screen. In more technical terms, the thin client can either obtain a kernel from local storage, or load the kernel across the network. (Using these instructions, you will collect the linux kernel from the server using a bootable network card. This way, the thin client needs no more storage than the boot rom built into a bootable network card.)

瘦客户机终端从中央服务器下载要运行的程序, 运行并显示在本地屏幕上。用更确切的技术术语来说,就是客户端可以从本机存储器获得内核,或者通过网络下载内核来运行(通过可网络启动的网卡从服务器获取linux内核到本地。这样一来,瘦客户机终端就可以通过可网络启动的网卡获取内核到本地内存运行,而不需要其他额外的存储设备)。

Boot sequence 启动步骤

The PXE network card makes a DHCP request on the local network. The DHCP reply gives information to the card where to collect the linux kernel from. The kernel is collected over the network through the TFTP protocol.

启动时,网卡通过PXE协议向本地网络发出DHCP请求,网络中服务器响应此DHCP请求,并在此响应信息中指定何处去获得linux内核。然后linux内核通过TFTP协议从服务器端传输到客户端。

Once the kernel has been collected via TFTP, the kernel is executed; the machine boots linux. A initramfs collected with the linux kernel is mounted as a root file system. This carries and autodetect the necessary drivers for the network card, mouse, keyboard sound etc. Once the network card driver is loaded, a second DHCP request tells the client it's ip address, netmask, gateway, DNS server, and root NFS (Network File System) mount point.

一旦linux内核通过TFTP下载到客户端,内核解压并开始运行;客户端开始运行于linux上,initramfs作为根文件系统被mount上,它将自动查找和匹配相应的网卡,鼠标,键盘,声卡等设备的驱动,初始化一个系统的环境。一旦网卡驱动加载,第二次的DHCP请求发出获得的响应信息告知客户端将被分配的IP地址,子网掩码,默认网关,DNS服务器地址以及root NFS(根网络文件系统)的挂载点。

The linux kernel runs the ubuntu initramfs, which mounts the root NFS share from the server onto the thin client read-only. The thin client now has a booted linux kernel, and a root file system, much like any Linux system. From now on, when we talk of the root file system on the client, we are actually talking about a root file system mounted read-only from the server. The root file system mounted by the thin client is not the same root file system the server itself uses, but is specially prepared for thin clients, and is shared by all thin clients connected to the server (located in /opt/ltsp/<arch> on the server) . The initramfs calls the init program, the Xserver settings are autodetected and the ubuntu breezy ltsp login manager, called ldm is started.

ubuntu的initramfs开始在内核环境中运行--这个从服务器端被只读挂载的root NFS(根网络文件系统)。这样客户端就有了一个启动的Linux内核、一个根文件系统,也就是一个基本的Linux操作系统了。然后客户端挂载的根文件系统和服务器端的根文件系统是不一样的,而是为客户端特定的。所有连接在这个服务器上的客户端都共享这个文件系统(在服务器的 /opt/ltsp/<arch [对应平台]>)。initramfs是作为整个系统的根程序(init),Xserver(图形服务器)的管理配置程序在相应的环境起来后也开始运行了,它是ldm(Ltsp display manager,它是ltsp项目上的图形显示管理程序,功能相当于本地的gdm, kdm, xdm等,原理下节介绍)

X 事务处理(nuts & bolts)

After logging in, ldm starts a ssh tunnel and executes a X session on the server which is displayed through the tunnel on the thin clients X server. Using ssh here has the big advantage that you dont need to have a Xserver configured on the client and no unsafe tcp X transport is initialized like it was done in older days of ltsp.


一旦登录,ldm(LTSP display manager)启动一个ssh通道,客户机通过这个通道运行一个X会话并显示。使用ssh有一个很大的好处就是不需要对客户机进行X的配置以及避免像以前的ltsp模式一样通过不安全链接来初始化X。

必需准备

需要做下列准备工作:

  • 一个ubuntu 5.10以上版本作为server
  • 至少一个客户机(具有pxe网卡启动功能)
  • 足够的磁盘空间
  • 较快的网络环境, 或者一个Breezy的镜像
  • 一个支持这些PXE启动的客户机的DHCP服务器,或者可以专门有一个独立网段的DHCP服务器
  • 对命令行不陌生 :)
  • 有钻研精神
  • 有任何问题,欢迎反馈给 ubuntu-devel

警告

  • Please don't use this Howto if you installed Edubuntu from CD, since the Installer does nearly all of the work described here already, if you use Edubuntu, follow the EdubuntuInstallNotes wikipage.
  • This is not the latest stable release of LTSP (4.1) but the new upcoming standard for LTSP (upstream codename MueCow). Since it is a very young implementation not all LTSP 4.1 options are supported (see [EdubuntuLtsConfParams] for details), nonetheless you can use most solutions (like local device support or sound etc.) provided at http://wiki.ltsp.org. For some of the features that are planned/being worked on for default integration see:
    • ThinClientAudioSupport
    • ThinClientFasterStartup
    • ThinClientLocalDevices
    • ThinClientLocalDevicesForwardConnection
    • ThinClientMemoryUsage
  • Do not use the tools ltspadm and ltspcfg with this implementation of LTSP, it will for sure ruin the ltsp setup !!!


  • 如果您使用的是Edubuntu,请不要参考这份Howto,因为Edubuntu的安装程序几乎完美的完成了这些软件配置和安装,Edubuntu用户请按照Edubuntu安装说明的wiki页面(EdubuntuInstallNotes)。
  • 本例的LTSP并不是最近稳定发布的版本4.1,LTSP稳定版本会按照新的标准(MueCow-上游的代号)发布,它并不支持所有的LTSP 4.1的选项(查看EdubuntuLtsConfParams获取详情), 然而依然可以用很多的方案(比如本地磁盘或者声卡等等),更多详细的资料在: http://wiki.ltsp.org. 默认的集成环境上计划的和已经具备的特性:
    • ThinClientAudioSupport  音频支持
    • ThinClientFasterStartup  快速启动
    • ThinClientLocalDevices   本地磁盘
    • ThinClientLocalDevicesForwardConnection 本地磁盘转储
    • ThinClientMemoryUsage  内存管理
  • 在配置这个LTSP过程中一定不要使用ltspadm和ltspcfg等配置工具,这会毁了整个安装操作!!!


开始

NOTE: If you plan to use the server as gateway/nat/firewall machine, it is strongly suggested to configure all the network interfaces before proceeding with the following steps.

注意: 如果您计划将服务器作为 网关/NAT/防火墙,强烈建议先把这些相关设置做好,然后再按照下面的配置来实施Thin Client:

  • Set up the DHCP server
    • If you have an existing DHCP server which can support PXE clients:
      • Configure it to pass a boot filename of `/ltsp/pxelinux.0` and a root path of `/opt/ltsp/i386`
      • For ISC DHCPD, use the following options:
  • 设置DHCP服务器
    • 如果您有一个现成的DHCP服务器,并支持PXE客户端:
      • 那么配置可启动文件路径 `/ltsp/pxelinux.0` 以及根文件系统路径 `/opt/ltsp/i386`
      •  ISC DHCPD, 添加下面的选项:
filename "/ltsp/pxelinux.0";
option root-path "/opt/ltsp/i386";
    • Install `ltsp-server` on the server:
    • 在服务器上安装`ltsp-server`:
sudo apt-get install ltsp-server
    • If you want to run a dedicated DHCP server on the thin client server:
      • Install `ltsp-server-standalone` on the server:
sudo apt-get install ltsp-server-standalone
      • If necessary, customize `/etc/ltsp/dhcpd.conf` (by default it's configured for a server at 192.168.0.1 serving PXE clients)
      • If you are running a firewall on the server, you'll need to open TFTP and NFS (and DHCP if you're running the standalone server). Also, make sure portmap isn't limited to the loopback interface in /etc/default/portmap (comment out the line with "-i 127.0.0.1") if it exists, could be a leftover from Hoary. You also may want to edit `/etc/hosts.allow' and limit access for portmap, rpc.mountd, rpc.statd, and in.tftpd to the local network:
portmap:    192.168.0.0/24
rpc.mountd: 192.168.0.0/24
rpc.statd:  192.168.0.0/24
in.tftpd:   192.168.0.0/24
      • Restart the nfs subsystem:
sudo invoke-rc.d nfs-kernel-server restart
sudo invoke-rc.d nfs-common restart
sudo invoke-rc.d portmap restart
  • Build the thin client runtime environment:
sudo ltsp-build-client
    • This script is hardcoded to use a particular Ubuntu mirror, so you may wish to edit it if you have a nearby mirror or CD (sudo ltsp-build-client --mirror file:///cdrom), remember to copy sources.list from the server into the chroot)
    • If you changed your aptitude dependency-settings not to select recommended packages automatically, not all required packages will be downloaded and installed by this script. Then no login with sdm is possible for example because some parts of the x-server are missing

sudo apt-get install openssh-server
sudo ltsp-update-sshkeys
    • Check `/opt/ltsp/i386/etc/ssh/ssh_known_hosts` and ensure that your host key is associated with your host's IP address. Depending on your `/etc/hosts` configuration, this may not always be correct automatically (yet). If it looks like this:
servername ssh-rsa AAAAB3NzaC1yc2EAAAABI...
    • then add the IP address like this:
servername,192.168.0.1 ssh-rsa AAAAB3NzaC1yc2EAAAABI...
    • AND file a bug in Malone. THIS SHOULD NOT HAPPEN.

sudo invoke-rc.d dhcp3-server start
  • Optionally, create `/opt/ltsp/i386/etc/lts.conf`. If you don't create one, reasonable defaults and auto-detected values will be used. Note: Not all options are supported (see [EdubuntuLtsConfParams]).
  • PXE boot the client and see what happens. If all goes well, you should see a graphical login dialog.
  • If your client doesn't have PXE on the network card, you can generate a custom boot CD or floppy at ROM-o-matic.net. Burn the iso or floppy image and boot from that.
  • Log in, with any user authorized to login remotely via ssh, and see what happens. If all goes well, you should get a working desktop session on the server.
  • Send mail to ubuntu-devel with your findings

Tips

If you have a separate DHCP that you do not want to install LTSP on you can just redirect the thin-client to boot off a different server.

In your DHCP server's dhcpd.conf:

如果你拥有一台独立的DHCP服务器,并且不想在它上面安装LTSP,你只需要配置转发瘦客户端从另一个服务器启动。

在你的DHCP服务器上配置dhcpd.conf:

next-server 192.168.0.3;
  • where 192.168.0.3 is the address of your LTSP server
  • 192.168.0.3就是你的LTSP服务器。

Bugs

  • Bug 19407: Open``SSH doesn't appear to release ports used for X forwarding in a timely manner, preventing you from logging out and logging back in immediately when IPv6 support is enabled. Disable it by adding "Address``Family inet" to /etc/ssh/sshd_config, and restarting the openssh daemon.

Extras