Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
My Gentoo diskless install howto
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3, 4, 5, 6, 7  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Swiss.Mage
n00b
n00b


Joined: 24 Mar 2003
Posts: 49
Location: Switzerland

PostPosted: Fri May 16, 2003 11:16 am    Post subject: My Gentoo diskless install howto Reply with quote

Hi all,

The aim of this post is to provide a tested procedure to setup a diskless Gentoo desktop, using PXE booting capabilities of some network cards and the PXE GRUB bootloader. This procedure has been tested on at least one computer and is really working.

If you want to do this you will need a network card on the diskless client that uses the PXE protocol to boot, like many 3com cards, for example.

I have to apologize for the quality of the language but English isn't my first language.

In the next lines, I will talk about the "client" and the "server". The client is the diskless machine and the server is the one providing DHCP and NFS filesystem. In all my examples, the client is called "eta" and the server "sigma" ... change this to your needs. The "sigma" server has a static IP address that is 192.168.1.20.

I will separate this precedure into several parts :

1. Server base setup
2. Gentoo setup on the server
3. Booting the client
4. Enable XFree XDMCP
5. Enjoy ...


1. Server base setup

Of course, I wont talk here about the complete setup of the server. For this follow the install guide provided in the Documentation area of the Gentoo's website.

1.1 Create directories

The first thing to do is to create the directories where your diskless system will be stored. Personally, I created a directory called /diskless on which I created a directory for each diskless hosts :
Code:
# mkdir /diskless
# mkdir /diskless/eta

Here "eta" is the name of one of my diskless desktop.

A good thing would be to direcly create a "boot" directory for each host :
Code:
# mkdir /diskless/eta/boot


1.2 DHCP and TFTP setup

The client will get boot informations using DHCP and download all the required files using TFTP. Here's how to setup this.

Just emerge DHCP and configure it for your basic needs. (I wont explain this here). Then, add the following on /etc/dhcp/dhcpd.conf :
Quote:
option option-150 code 150 = text ;
host eta {
hardware ethernet 00:00:00:00:00:00;
fixed-address 192.168.1.10;
option option-150 "/eta/boot/grub.lst";
filename "/eta/boot/pxegrub";
}

This provide a static IP adress for the client and the path of a PXE boot image, here pxegrub. You have to replace the MAC address of the Ethernet card of the client and the directory where you will put the client files with the one you use.

For TFTP, I emerged "app-admin/tftp-hpa" that is really easy to use. In /etc/conf.d/in.tftpd, I put the following :
Quote:
INTFTPD_PATH="/diskless"
INTFTPD_USER="nobody"
INTFTPD_OPTS="-u ${INTFTPD_USER} -l -vvvvvv -p -c -s ${INTFTPD_PATH}"


1.3 Setup GRUB

To provide PXE booting I use GRUB. I've done this because I'm already using GRUB on several machines and I'm happy with. The bad piece of news is that you have to compile it by yourself to enable the PXE image compilation ... but that's quite easy.

First, get the latest version of the GRUB source code (over Internet or just do "emerge -f grub" and get it into the /usr/portage/distfiles directory) and copy it to a nice place ... for example /root.

Now, do the following :
Code:
# tar zxvf grub-0.92.tar.gz
# cd grub-0.92
# ./configure --help

You will see a list of available options. In this options, you will see several relative to network interfaces drivers. Look for the option that match you client network card. In my case, I'm using a 3com 3c905 card.

Then, do this :
Code:
# ./configure --enable-diskless --enable-3c90x
# make


Don't do "make install", this is not necessary ! This will compile the GRUB source code and generate the nice pxegrub image we need.

The compilation ended, go to the "stage2" subdir and copy "pxegrub" to your diskless client boot directory :
Code:
# cd stage2
# cp pxegrub /diskless/eta/boot/pxegrub


Now edit the GRUB config file for the the diskless client :
Code:
# nano -w /diskless/eta/boot/grub.lst

And put the following inside (adapt the exemple for your needs) :
Quote:
default 0
timeout 30

title=Diskless Gentoo
root (nd)
kernel /eta/bzImage ip=dhcp root=/dev/nfs nfsroot=192.168.1.20:/diskless/eta

For the nfsroot option, the IP address is the one of the server and the directory is the one where your diskless client files are located (on the server).[/code]

1.4 Setup NFS

NFS is quite easy to configure. The only thing you have to do is to add a line on the /etc/exports config file :
Quote:
# /etc/exports: NFS file systems being exported. See exports(5).
/diskless/eta eta(rw,sync,no_root_squash)


1.5 Update your hosts

One important thing to do now is to modify your /etc/hosts file to fit your needs. In my configuration, I have the following on this file (I just replaced the domaine name) :
Quote:
127.0.0.1 localhost

192.168.1.10 eta.example.com eta
192.168.1.20 sigma.example.com sigma



2. Gentoo setup on the server

I have tried many ways to install the base system of my diskless client. But the only one that really succeded is the following :

2.1 Reboot the server on a Gentoo LiveCD

I don't think I have to explain this ...

2.2 Then follow the standard install procedure as explained in the Gentoo Install Howto BUT with the following differences :

2.2.1 Mounting file system

When you have to mount the file system, do the following (where hda3 is the partition where you created the /diskless directory) :
Code:
# mount /dev/hda3 /mnt/gentoo

Don't do anything else ...

2.2.2 Stage tarballs and chroot

WARNING ! Be very careful where you extract your stage tarball ...

I used a stage3 tarball ... as I wanted to have it running quick :
Code:
# [b]cd /mnt/gentoo/diskless/eta/[/b]
# tar -xvjpf  /mnt/cdrom/gentoo/stage3-*.tar.bz2
# mount -t proc /proc /mnt/gentoo/diskless/eta/proc
# cp /etc/resolv.conf /mnt/gentoo/diskless/eta/etc/resolv.conf
# chroot /mnt/gentoo/diskless/eta/ /bin/bash
# env-update
# source /etc/profile

Now follow the usual steps ... until the kernel configuration

2.2.3 Kernel configuration

When you do the "make menuconfig" of your kernel configuration, don't forget to enable the following options with the others recommended into the install howto :

- Your network card device support

- Under "Networking options" :
Quote:
[*] TCP/IP networking
[*] IP: kernel level autoconfiguration
[*] IP: DHCP support
[*] IP: BOOTP support


- Under "File systems --> Network File Systems" :
Quote:
<*> NFS file system support
[*] Provide NFSv3 client support
[*] Root file system on NFS


2.2.4 /etc/fstab

Just let the following on the file :
Quote:
/dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0


2.2.5 Bootloader

Dont install any bootloader because we have already install one (pxegrub).

2.2.6 Restart the server

Finish the install and restart the server. It should boot like the others times (if not you have probably made a mistake :P ). Start DHCP, TFTPD and NFS.


3. Booting the client

Now, just boot the client. Configure the bios and the network card to use PXE in first to boot (before CD-ROM or floppy).

The network card should get an IP address using DHCP and download the GRUB PXE image using TFTP.

Then, you should see a nice black and white GRUB bootmenu where you will select the kernel to boot and press Enter.

If everything is ok the kernel should boot, mount the root filesystem using NFS and provide you the so waited login prompt.


4. Enable XFree XDMCP

Ok ... now you can use your diskless client as if it was a normal one. But the client is a very old machine like a PII 350 for me, running graphical applications on it is a bit stupid, at least if you have a nice P4 with a lot of Mhz an memory as server.

So, I recommend you to emerge distcc and then XFree on the client. After that, follow the instructions given at this URL to enable XDMCP on the server :

http://www.tldp.org/HOWTO/XDMCP-HOWTO/procedure.html

Then, on the client, do :
Code:
# X -broadcast

And you should get the server display manager login prompt as display ... or the one of your neighbour ... :P

Something you have to note about this is that everything will run on the remote server ... even sound ! If it's not what you want, start the X server as usual from the client so it will run on it and use it own hardware.


5. Enjoy ...

Ok, now you have a nice diskless desktop that runs all his stuff on a big server located somewhere else ... great no ?

If you are happy, like me, with this, post a message here to gratulate me :P

If not, maybe because something gone wrong and my howto doesn't help, search on this nice forum before asking me ... There're a lot of other diskless experiments and you will maybe find your answere.

If you want me to add something to this howto just post here too ...
_________________
EPFL
http://www.epfl.ch
Swiss Federal Institute of Technology


Last edited by Swiss.Mage on Fri May 16, 2003 1:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
darookee
Apprentice
Apprentice


Joined: 02 Jan 2003
Posts: 162
Location: Long Beach, CA.

PostPosted: Fri May 16, 2003 12:15 pm    Post subject: Reply with quote

is there a way to do this without a bootable network card?
Back to top
View user's profile Send private message
Swiss.Mage
n00b
n00b


Joined: 24 Mar 2003
Posts: 49
Location: Switzerland

PostPosted: Fri May 16, 2003 12:20 pm    Post subject: Reply with quote

This howto covers only the use of a PXE capable network card.

I see how to do without ... maybe with a floppy or a cd-rom ... so look over the forum and the net to find more information about this.
_________________
EPFL
http://www.epfl.ch
Swiss Federal Institute of Technology
Back to top
View user's profile Send private message
kermitjunior
Apprentice
Apprentice


Joined: 04 Aug 2002
Posts: 167

PostPosted: Sat May 17, 2003 12:38 am    Post subject: Thank you Reply with quote

Ok,

So I wanted to take a minute to say "THANK YOU"

How does this differ from LTSP? Any advantages or disadvantages?
_________________
-----
Toshiba Satellite A15-S157, 2.2 Celery, 40GB, 512MB
AMD Athlon XP 1900+, 640MB PC2100, ABIT KG-7R
IBM 120GB (Linux), WD 30GB (WinDoze), ATI All-In-Wonder 128 Pro PCI
Back to top
View user's profile Send private message
hielvc
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2805
Location: Oceanside, Ca

PostPosted: Sat May 17, 2003 3:46 am    Post subject: Reply with quote

You might want to submit it or have it moved to "tips and tricks forum"

hielvc
Back to top
View user's profile Send private message
Swiss.Mage
n00b
n00b


Joined: 24 Mar 2003
Posts: 49
Location: Switzerland

PostPosted: Sat May 17, 2003 6:31 am    Post subject: Reply with quote

In fact I have never heard of this :oops:

I will have a look but one of the major advantage of "my" way to create a diskless desktop is to understand how it works ... at least a bit ... I hope :?
_________________
EPFL
http://www.epfl.ch
Swiss Federal Institute of Technology
Back to top
View user's profile Send private message
BradN
Advocate
Advocate


Joined: 19 Apr 2002
Posts: 2391
Location: Wisconsin (USA)

PostPosted: Sat May 17, 2003 4:51 pm    Post subject: Reply with quote

If you don't have a boot ROM for your network card, there's a site that you can create floppy images that act like a boot rom (or create "real" boot rom images and burn them to a chip)... http://rom-o-matic.net - you could burn one of these as a floppy boot image on a CD if you had a CD drive but no floppy.

And, if you're really insane, I think it might be possible on some BIOS'es to include a net booting module by modifying the bios image (award comes to mind, but i'll leave that as an exercise to the experimentor) - heh, that's why it's called a modular bios - there are in fact modules that can be added into it, space permitting.
Back to top
View user's profile Send private message
GurliGebis
Retired Dev
Retired Dev


Joined: 08 Aug 2002
Posts: 509

PostPosted: Sun May 18, 2003 11:16 am    Post subject: Reply with quote

How about swap, who does your /etc/fstab look?
_________________
Queen Rocks.
Back to top
View user's profile Send private message
ctford0
l33t
l33t


Joined: 25 Oct 2002
Posts: 774
Location: Lexington, KY,USA

PostPosted: Mon May 19, 2003 12:50 am    Post subject: Reply with quote

I have seen other diskless howto's also and I have always had one question. Why use tftp and not something like ssh? Is tftp secure?

Thanks for the input...

Chris
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20054

PostPosted: Mon May 19, 2003 4:28 am    Post subject: Reply with quote

Moved from Installing Gentoo.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
GurliGebis
Retired Dev
Retired Dev


Joined: 08 Aug 2002
Posts: 509

PostPosted: Mon May 19, 2003 12:17 pm    Post subject: Reply with quote

Well, Isn't there a way to be able to have swap on this system?
_________________
Queen Rocks.
Back to top
View user's profile Send private message
Swiss.Mage
n00b
n00b


Joined: 24 Mar 2003
Posts: 49
Location: Switzerland

PostPosted: Mon May 19, 2003 4:27 pm    Post subject: Reply with quote

1. About SWAP

I have only 3 entries in my /etc/fstab. One for the CD-Rom, one for the /proc and one for tmpfs.

A SWAP filesystem need a disk ... I think ... (SWAP in RAM looks a bit strange 8O ... And really useless :lol: ). So you're no more on a diskless setup. And if you have a look at the cost of the RAM it's really incredibly cheap now ! Maybe you could mount a SWAP partition via NFS :?: :?: :?:

2. About TFTP

First of all, I don't think there's a way to use SSH with a network card ...
Then, there are several aspects that make TFTP not so dangerous : TFTP run as user nobody, is (normally) in read-only mode and has only access to the kernel file and to the GRUB config file ... nothing really dangerous. But a good firewall may help, and fo course you have to be sure your network is secure, I mean the physical access to the network. You may also have a look at the file /etc/hosts.allow.
_________________
EPFL
http://www.epfl.ch
Swiss Federal Institute of Technology
Back to top
View user's profile Send private message
GurliGebis
Retired Dev
Retired Dev


Joined: 08 Aug 2002
Posts: 509

PostPosted: Mon May 19, 2003 4:48 pm    Post subject: Reply with quote

I was thinking of having a swapfile on one of the root "partition", but I don't think swap over nfs i very stable.
_________________
Queen Rocks.
Back to top
View user's profile Send private message
ctford0
l33t
l33t


Joined: 25 Oct 2002
Posts: 774
Location: Lexington, KY,USA

PostPosted: Mon May 19, 2003 4:51 pm    Post subject: Reply with quote

Ok, say I decide to setup 6 diskless clients. What directories can be shared between them all?

/usr
/bin
/sbin
/etc ?????
/opt
/lib ???

I really dont want to have duplicates of things that I dont need to. I know that these I will have to have for each terminal.

/dev
/tmp
/var

Any others to add to this list?

Chris
Back to top
View user's profile Send private message
Swiss.Mage
n00b
n00b


Joined: 24 Mar 2003
Posts: 49
Location: Switzerland

PostPosted: Mon May 19, 2003 5:00 pm    Post subject: Reply with quote

Hum ... It depends.

Something you can try is, at least, /usr/portage/* (I have done it between 3 computers and it works quite well).

If the diskless clients are exactly the same, you can try sharing /lib /bin /opt /sbin and /usr but doing this means that all the libraries and binaries will be shared between the computers and so, installing something on one client will install it for all the others ...

If the users, groups, ... are the same on each machine, you could even try sharing /etc and /home ...

I have to "confess" I have never try to share all of this system dirs ... So if you do it, post a message here to provide feedback for the other users (and me too).
_________________
EPFL
http://www.epfl.ch
Swiss Federal Institute of Technology
Back to top
View user's profile Send private message
ctford0
l33t
l33t


Joined: 25 Oct 2002
Posts: 774
Location: Lexington, KY,USA

PostPosted: Mon May 19, 2003 5:11 pm    Post subject: Reply with quote

Well, what I have is basically dumb terminals, just for X purposes connecting through XDMCP to the server. The only user on any of the machines will be root because right after bootup I plan to execute an rc-script to launch X doing a query to the server. This is actually in an office, so with every new office mate another dumb terminal will be added. Just trying to save myself some work (hehe). I will probably try to implement this within the next 2 weeks, so I will definately post my results here when finished.

Chris
Back to top
View user's profile Send private message
Swiss.Mage
n00b
n00b


Joined: 24 Mar 2003
Posts: 49
Location: Switzerland

PostPosted: Mon May 19, 2003 5:43 pm    Post subject: Reply with quote

Something I can add about this setup is that it will need about 1 GB including the X server.

To connect to a remote X server, the only thing you have to do is to run "X -broadcast" on the client. This can be done with this rc-script :
Code:
#!/sbin/runscript

depend() {
    after *
}

start() {
    X -broadcast
}

stop() {
    killall X
}

_________________
EPFL
http://www.epfl.ch
Swiss Federal Institute of Technology
Back to top
View user's profile Send private message
ctford0
l33t
l33t


Joined: 25 Oct 2002
Posts: 774
Location: Lexington, KY,USA

PostPosted: Mon May 19, 2003 5:46 pm    Post subject: Reply with quote

The method that I prefer to use, since there are so many XDMCP hosts around me is to do
Code:

XFree86 -query xxx.xxx.xxx.xxx


this way you always get the server you want, not your neighbor's :wink:

Chris
Back to top
View user's profile Send private message
HAsker
n00b
n00b


Joined: 20 May 2003
Posts: 15

PostPosted: Tue May 20, 2003 3:36 pm    Post subject: Reply with quote

Hello.. I have read your how-to and realy likes it.. but there is a problem i am having the dhcpd on another computer and when i'm telling it to redirect to that one it does like that but when it is connected to the tftpd it only says that it cant find the file..
Code:

May 20 17:33:23 hasker in.tftpd[1706]: RRQ from 192.168.0.10 filename /htpc/boot/pxegrub
May 20 17:33:23 hasker in.tftpd[1706]: sending NAK (1, File not found) to 192.168.0.10



This is how my /boot at the diskless client disk..
Code:
root@hasker boot # ls
boot  bzImage  grub  grub.lst  pxegrub
root@hasker boot #
Back to top
View user's profile Send private message
Swiss.Mage
n00b
n00b


Joined: 24 Mar 2003
Posts: 49
Location: Switzerland

PostPosted: Tue May 20, 2003 4:23 pm    Post subject: Reply with quote

Is your DHCP and TFTP server different from your NFS server ?

If it's the case, we are in the same situation (I didn't talk about this into the howto in order to "generalize" it). In fact, in my situation, I copied all the pxegrub image, the kernel image and the grub config file to a directory of the DHCP server : /diskless/boot/eta.

Here's my real /ets/dhcp/dhcpd.conf :
Quote:
option option-150 code 150 = text ;
host eta {
hardware ethernet ...;
fixed-address 192.168.1.10;
option option-150 "/eta/grub.lst";
filename "/eta/pxegrub";
}


And for /etc/conf.d/in.tftpd :
Quote:
INTFTPD_PATH="/diskless/boot"
INTFTPD_USER="nobody"
INTFTPD_OPTS="-u ${INTFTPD_USER} -l -vvvvvv -p -c -s ${INTFTPD_PATH}"


Hope this help ...
_________________
EPFL
http://www.epfl.ch
Swiss Federal Institute of Technology
Back to top
View user's profile Send private message
HAsker
n00b
n00b


Joined: 20 May 2003
Posts: 15

PostPosted: Tue May 20, 2003 4:33 pm    Post subject: Reply with quote

The in.tftpd server and the nfs server is on the same machine but the in.tftpd cant find the pxegrub image and the grub.lst .. :/
Back to top
View user's profile Send private message
Swiss.Mage
n00b
n00b


Joined: 24 Mar 2003
Posts: 49
Location: Switzerland

PostPosted: Tue May 20, 2003 4:36 pm    Post subject: Reply with quote

I think the in.tftpd server must be on the same machine than the DHCP server ... but I'm not sure !

Check that the directory is accessible by the user in.tftpd is running as and look at the log files to see if there is a special reason given.
_________________
EPFL
http://www.epfl.ch
Swiss Federal Institute of Technology
Back to top
View user's profile Send private message
ghuug
Bodhisattva
Bodhisattva


Joined: 07 May 2003
Posts: 53
Location: West Africa

PostPosted: Tue May 20, 2003 7:51 pm    Post subject: Reply with quote

actually there is nothing wrong with having NFS as a SWAP. I'm using nearly the same setup as described here in some nodes of our openmosix cluster, and SWAP is exported through NFS.
Back to top
View user's profile Send private message
GurliGebis
Retired Dev
Retired Dev


Joined: 08 Aug 2002
Posts: 509

PostPosted: Tue May 20, 2003 8:05 pm    Post subject: Reply with quote

How do I have swap over nfs?
Do I just make a 256 mb swapfile on the nfs mounted root, and add the file to /etc/fstab?
_________________
Queen Rocks.
Back to top
View user's profile Send private message
ghuug
Bodhisattva
Bodhisattva


Joined: 07 May 2003
Posts: 53
Location: West Africa

PostPosted: Tue May 20, 2003 10:39 pm    Post subject: Reply with quote

Yes, create file on NFS server.
e.g.:
Code:

dd if=/dev/zero of=/tmp/swap seek=100 count=1 bs=1M
mkswap /tmp/swap
chmod 0600 /tmp/swap

then on NFS client:
Code:

swapon -a /nfs/tmp/swap
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2, 3, 4, 5, 6, 7  Next
Page 1 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum