Linux無盤工作站(非原創)

2021-08-31 08:09:23 字數 3784 閱讀 7237

假設有一台伺服器裝有 debian gnu/linux,有兩塊網絡卡。

網絡卡 eth0 (對外) ip 10.0.2.15 netmask 255.255.255.0 gateway 10.0.2.2

網絡卡 eth1 (對內) ip 192.168.1.1 netmask 255.255.255.0

網路結構如下:

網絡卡 ip 客戶端

+-----------------------------+

| ||+-- [eth0] 10.0.2.15 +- to wan

| ||+-- [eth1] 192.168.1.1 +- to clients

| | ip from 192.168.1.2 - 192.168.1.254

+-----------------------------+

以 root 使用者登入無盤伺服器,執行:

1. 建需要的目錄

#mkdir /diskless

#mkdir /diskless/nfsroot

#mkdir /diskless/tftpboot

#mkdir /diskless/tftpboot/pxelinux.cfg

2. 裝需要的軟體

#apt-get install dhcp3-server

#apt-get install atftpd

#apt-get install nfs-kernel-server

#apt-get install syslinux

#apt-get install debootstrap

3. 建無盤機用的根檔案系統

#debootstrap lenny /diskless/nfsroot

#chroot /diskless/nfsroot

#apt-get install linux-image-2.6.26-2-686

#exit

4. 配置 dhcp 服務

#nano /etc/dhcp3/dhcpd.conf

加上如下內容:

subnet 192.168.1.0 netmask 255.255.255.0

#/etc/init.d/dhcp3-server restart

5. 配置 tftp 服務

#cp /diskless/nfsroot/boot/vmlinuz-2.6.26-2-686 /diskless/tftpboot/vmlinuz

#cp /diskless/nfsroot/boot/initrd.img-2.6.26-2-686 /diskless/tftpboot/initrd.img

#cp /usr/lib/syslinux/pxelinux.0 /diskless/tftpboot

#nano /diskless/tftpboot/pxelinux.cfg/default

label linux

kernel vmlinuz

#nano /etc/inetd.conf

tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /diskless/tftpboot

#/etc/init.d/openbsd-inetd restart

6. 配置 nfs 服務

#nano /etc/exports

/diskless/nfsroot *(rw,async,no_subtree_check,no_root_squash)

#/etc/init.d/nfs-kernel-server restart

ok! 無盤機可以通過 pxe 啟動了。

**********=== 進一步完善 **********===

7. 配置客戶端環境

#nano /diskless/nfsroot/etc/network/inte***ces

auto lo

iface lo inet loopback

#nano /diskless/nfsroot/etc/fstab

#[file system] [mount point] [type] [options] [dump] [pass]

proc /proc proc defaults 0 0

tmpfs /tmp tmpfs defaults 0 0

tmpfs /var/run tmpfs defaults 0 0

tmpfs /var/lock tmpfs defaults 0 0

tmpfs /var/tmp tmpfs defaults 0 0

8. 批量建立使用者

#chroot /diskless/nfsroot

#nano /root/batch_add_users.sh

#!/bin/sh

pre="ws"

for (( i = 2; i <= 254; i++ ))

douseradd -g audio -p abc123 -s /bin/bash -d /home/$pre$i -m $pre$i

done

#chmod u+x /root/batch_add_users.sh

#/root/batch_add_users.sh

#exit

9. 讓無盤機能夠自動進入圖形介面

#chroot /diskless/nfsroot

#apt-get install x-window-system-core xfce4

或者apt-get install kdebase

allowed_users=anybody

#nano /etc/rc.local

ws_number=`ifconfig eth0 | grep "inet addr" | cut -d. -f4 | cut -d" " -f1`

su ws$ws_number -c startx

#如果想退出圖形介面就直接關機

#poweroff

exit 0

#exit

#chroot /diskless/nfsroot

#apt-get install alsa

#alsaconf

#alsamixer

#nano /etc/rc.local

#如果/dev/dsp不能正常出現,加下面的內容。

modprobe snd-pcm-oss

#exit

11. 增加無盤機的虛擬記憶體交換空間swap(該步驟確有需要才做,並且不適合多使用者使用。)

#cd /diskless/nfsroot

#dd if=/dev/zero of=var/cache/swap.ext3 bs=1024 count=550000

#mkfs -t ext3 var/cache/swap.ext3

#mkdir var/cache/swap

#mount -o loop var/cache/swap.ext3 var/cache/swap

#dd if=/dev/zero of=var/cache/swap/swap0 bs=1024 count=512000

#mkswap var/cache/swap/swap0

#echo "/var/cache/swap.ext3 /var/cache/swap ext3 defaults,loop 0 2" >> etc/fstab

#echo "/var/cache/swap/swap0 none swap sw 0 0" >> etc/fstab

12. 無盤機的引導方式

a. 通常是用網絡卡上的 boot rom;

[url]

無盤工作站的日常維護

一 硬體維護 硬體是無盤網路維護中看得見 摸得著的部分,包括計算機 工作站和伺服器 網線 hub 集線器 等裝置。硬體方面的網路維護比較簡單 1.灰塵是引起計算機故障的重要原因之一。放置伺服器的地方應經常打掃,定期用毛刷除去主機電源 hub 集線器 網線接頭處 cpu風扇 主機板以及記憶體上的灰塵。...

在Fedora上建立無盤工作站

1 安裝dhcp yum install dhcp 配置檔案 etc dhcpd.conf如下 ddns update style none ignore client updates next server 192.168.0.3 tftp伺服器位址 filename pxelinux.0 引導檔...

無盤工作站與VMware View虛擬桌面對比

本文僅從操作場景方面將無盤與虛擬桌面對比。操作場景 傳統無盤工作站 vmware view虛擬桌面 新電腦環境準備 工作人員進行複雜的線纜連線,伺服器配置 簡單的瘦客戶機線纜連線,開機即用。客戶端掉電 宕機 使用者資料及操作丟失 操作介面消失,使用者會話仍然在後台伺服器上執行,只需重新連線就可以繼續...