DragonFly users List (threaded) for 2007-06
DragonFly BSD
DragonFly users List (threaded) for 2007-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Remote Install


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Jun 2007 11:25:43 -0700 (PDT)

:Hi guys, me again!
:
:Is there currently a way to install over ssh, or a way of hacking the
:installer to do so? I have sshd etc starting boot which is all fine,
:however obviously the installer wants a real console.  Alternatively,
:can someone point me towards a good guide for scripting it?
:
:Thanks,
:-- 
:Joe Holden
:T: (UK) 02071009593 (AU) 282442321
:E: joe@joeholden.co.uk

    The installer has numerous installation mechanisms but ssh isn't one
    of them.  I've never used anything but the console installer so I
    just don't know how the other methods operate.

    There is also rconfig, which basically allows you to script the
    install.  The idea is that you maintain the rconfig script(s) on
    a server and run rconfig in server mode on that machine.

    On the client you boot with the ISO, login as root, configure your
    network (e.g. by doing 'dhclient em0' or whatever), then run rconfig -a.
    The client finds the rconfig server, downloads the script, and runs it.

    I haven't done this in a while so this script may be out of date.
    You'd have to experiment with it.  I suggest setting up rconfig and
    playing around.  What I like about rconfig is that it is really easy
    to test scripts... since you are booting from the CD, and the script
    is stored on the server, you just rconfig -a, check the results, mess
    around with the script on the server, and rconfig -a again until you
    have it right.

					-Matt
					Matthew Dillon 
					<dillon@backplane.com>

#!/bin/csh
#
# A file like this is typically copied to /usr/local/etc/rconfig/auto.sh on
# the rconfig server and the rconfig demon is run via 'rconfig -s -a'.  When
# you boot the DragonFly CD you have to bring up the network, typically
# via 'dhclient interfacename', then run 'rconfig -a' or 
# 'rconfig -a ip_of_server' if the server is not on the same LAN.
#
# WARNING!  THIS SCRIPT WILL COMPLETELY WIPE THE DISK!

set disk = ad0
set slice = s1
set xdisk = $disk$slice

# Refuse to do anything if the machine wasn't booted from CD
#
set cdboot = 0
foreach i ( `df / | awk '{ print $1; }'` )
    if ( $i =~ acd* ) then
	set cdboot = 1
    endif
end

if ( $cdboot == 0 ) then
    echo "Aborting auto init script, machine was not booted from CD"
    exit 1
endif

# Wipe the disk entirely
#

echo "FDISK - ALL DATA ON THE DRIVE WILL BE LOST"
foreach i ( 5 4 3 2 1 )
    echo -n " $i"
    sleep 1
end

dd if=/dev/zero of=/dev/$disk bs=32k count=16
fdisk -IB $disk
boot0cfg -B $disk
boot0cfg -v $disk
dd if=/dev/zero of=/dev/$xdisk bs=32k count=16

echo "DISKLABEL"
sleep 1

disklabel -B -r -w $xdisk auto
disklabel $xdisk > /tmp/disklabel.$xdisk
cat >> /tmp/disklabel.$xdisk << EOF
a: 256m * 4.2BSD
b: 1024m * swap
d: 256m * 4.2BSD
e: 256m * 4.2BSD
f: 6144m * 4.2BSD
g: * * 4.2BSD
EOF
disklabel -R $xdisk /tmp/disklabel.$xdisk
disklabel $xdisk

echo "NEWFS"
sleep 1

newfs /dev/${xdisk}a
newfs -U /dev/${xdisk}d
newfs -U /dev/${xdisk}e
newfs -U /dev/${xdisk}f
newfs -U /dev/${xdisk}g

echo "MOUNT"
sleep 1

mount /dev/${xdisk}a /mnt
mkdir /mnt/var
mkdir /mnt/tmp
mkdir /mnt/usr
mkdir /mnt/home

mount /dev/${xdisk}d /mnt/var
mount /dev/${xdisk}e /mnt/tmp
mount /dev/${xdisk}f /mnt/usr
mount /dev/${xdisk}g /mnt/home

echo "CPDUP ROOT"
cpdup / /mnt
echo "CPDUP VAR"
cpdup /var /mnt/var
echo "CPDUP ETC"
cpdup /etc /mnt/etc
echo "CPDUP DEV"
cpdup /dev /mnt/dev
echo "CPDUP USR"
cpdup /usr /mnt/usr

echo "CLEANUP"
chmod 1777 /mnt/tmp
rm -rf /mnt/var/tmp
ln -s /tmp /mnt/var/tmp

cpdup /mnt/var/crash /mnt/usr/var.crash
rm -rf /mnt/var/crash
ln -s /usr/var.crash /mnt/var/crash

cat >/mnt/etc/fstab << EOF
# Example fstab based on /README.
#
# Device                Mountpoint      FStype  Options         Dump    Pass#
/dev/${xdisk}a		/		ufs	rw		1	1
/dev/${xdisk}b		none		swap	sw		0	0
/dev/${xdisk}d		/var		ufs	rw		2	2
/dev/${xdisk}e		/tmp		ufs	rw		2	2
/dev/${xdisk}f		/usr		ufs	rw		2	2
/dev/${xdisk}g		/home		ufs	rw		2	2
proc			/proc		procfs	rw		0	0
# example MFS remount (for a pristine MFS filesystem do not use -C)
#swap			/mnt		mfs	rw,-C,-s=4000	0	0
EOF

cat >/mnt/etc/rc.conf << EOF
ifconfig_em0="DHCP"
sshd_enable="YES"
usbd_enable="YES"
sendmail_enable="NONE"
dumpdev="/dev/${xdisk}b"
EOF

if ( ! -d /mnt/root/.ssh ) then
    mkdir /mnt/root/.ssh
endif
cat > /mnt/root/.ssh/authorized_keys << EOF
ssh-dss ... put your SSH public keys here ...
EOF

# Allow public-key-only access to the root account
#
sed -e 's/#PermitRootLogin no/PermitRootLogin without-password/' < /mnt/etc/ssh/sshd_config > /mnt/etc/ssh/sshd_config.new
mv -f /mnt/etc/ssh/sshd_config.new /mnt/etc/ssh/sshd_config




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]