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

Re: Not sure how to do this tricky install...


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Aug 2006 09:28:30 -0700 (PDT)

    One thing that you can do if you have multiple DragonFly boxes is to
    automate some of the post-install work by creating an 'rconfig'
    script on a master server on the same network.  Then doing 'rconfig -a'
    on the newly installed client after manually configuring the network.
    See 'man rconfig'.

    I have rconfig running in server mode on a box with the following script 
    as /usr/local/etc/rconfig/auto.sh.  Whenever I do new a CD install on a 
    test box, I login as root on the video console, 'dhclient em0' to get
    the network up (or whatever is appropriate), and then run 
    'rconfig -a' and let the script do the rest of the basic setup work for
    me.  I have it fix up rc.conf, adjust /etc/ssh/sshd_config, and install
    my public keys into the root account.

    The boot2 code does run over both the serial port and the video console
    which means that you get the boot2 boot menu on the serial port as well
    as the video console and you can choose option 6 to break into the CLI,
    then boot the kernel manually in single-user mode with the console
    on the serial port using 'boot -s -h'.

    But we do not have the kernel try to automatically run a getty on ttyd0
    any more.  I tried that on the 1.0 CD and it just blew up on machines
    that didn't happen to have a serial port (which is many these days).

						-Matt


#!/bin/csh
#
# /usr/local/etc/rconfig/auto.sh
#
# Adjust rc.conf to DHCPup the network and install my keys for remote
# ssh logins to root.

set echo

# Add the network interface, set it up for DHCP
#
set ifc = `route -n get default | fgrep interface | awk '{ print $2; }'`
echo -n "ifconfig_$ifc=" >> /etc/rc.conf
echo '"DHCP"' >> /etc/rc.conf
cat >> /etc/rc.conf << EOF
sshd_enable="YES"
dntpd_enable="YES"
hostname=""
EOF
cat >> /etc/sysctl.conf << EOF
net.inet.ip.portrange.first=4000
EOF
cat >> /etc/dntpd.conf << EOF
server pool.ntp.org
EOF
fgrep 'PermitRootLogin without-password' /etc/ssh/sshd_config >& /dev/null
if ( $?status ) then
    echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
endif

# Fix up /etc/fstab
#
foreach i ( /usr/dfports /usr/src /usr/doc /cvs /ftp /rdbms /archive )
    if ( ! -d $i ) then
	mkdir $i
    endif
end
fgrep -v /proc /etc/fstab > /etc/fstab.new
cat >> /etc/fstab.new << EOF
[ ADDITIONAL MOUNT POINTS, E.G. NFS MOUNTS (and reinstall /proc at the end) ]
crater:/usr/src		/usr/src	nfs	ro,bg		0	0
crater:/usr/doc		/usr/doc	nfs	ro,bg		0	0
crater:/cvs		/cvs		nfs	ro,bg		0	0
crater:/ftp		/ftp		nfs	ro,bg		0	0
pkgbox:/archive		/archive	nfs	ro,bg		0	0
proc			/proc		procfs	rw		0	0
EOF
mv -f /etc/fstab.new /etc/fstab
rm -rf /usr/pkgsrc
ln -s /archive/NetBSD-pkgsrc /usr/pkgsrc
mkdir /usr/obj/distfiles

# Get sshd working
#
mkdir -p ~root/.ssh
cat > ~root/.ssh/authorized_keys << EOF
ssh-dss ....
ssh-dss ....
EOF

if ( ! -f /etc/ssh/ssh_host_dsa_key ) then
    cd /etc/ssh
    ssh-keygen -t dsa -f ssh_host_dsa_key -N ""
endif

if ( -f /var/run/sshd.pid ) then
    kill `cat /var/run/sshd.pid`
    sleep 1
endif
/usr/sbin/sshd

sleep 1
mount -a




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