$Id: acmpc2.txt,v 1.3 2004/10/22 18:53:23 jschauma Exp $ Short ACM PC2 Server Creation HOWTO =================================== This document will briefly outline how to set up a machine to act as the PC2 server for the ACM Programming Challenge using the bootable ACM Contest CD. In summary, the server needs to provide dhcpd, yp and nfs services to the clients and a regular internet network connection to the remote sites PC2 server. 1 Install NetBSD 2 Configure the kernel 3 Configuration of basic services 3.1 NFS 3.2 YP 3.3 Create Accounts 3.4 Configure dhcpd 4 Start services 5 Install Java and PC2 5.1 Install Java 5.2 Install PC2 1 Install NetBSD ================ First, we install NetBSD on a regular machine. Of course any other UNIX-like OS would be fully capable of providing the services, but since we're using NetBSD anyway, we might as well make the server run the same OS. A basic installation is fully sufficient -- X does not need to be installed. 2 Configure the kernel ====================== The ACM PC2 server needs a couple of options that may not enabled per default in the generic kernel. You should build a new kernel with the appropriate devices for your machine as well as a number of other options. You can start with the kernel configuration file located at http://www.cs.stevens.edu/~jschauma/acm/ACM_PC2. Refer to http://www.NetBSD.org/Documentation/kernel/#how_to_build_a_kernel for detailed instructions on how to build a new kernel. 3 Configuration of basic services ================================= 3.1 NFS ======= Set aside a partition for the users home directories on your machine. This partition will be shared with all clients, who will mount the home directory via NFS. Add the following line to your /etc/exports file: /home -alldirs -maproot=0 -network 192.168.1.0 -mask 255.255.255.255 3.2 YP ====== All clients will authenticate against the local acm pc2 server, so we need to set up YP. To do this, first set the domainname: $ domainname acm Next, initiate the yp server: $ ypinit -s (You can specify localhost as the only yp server.) 3.3 Create Accounts =================== You need to create the accounts for all teams on the acm pc2 server and assign passwords. This can be done automatically by using a shell script similar to this: #! /bin/sh i=0 while [ $i -lt 100 ]; do passwd=`hexdump -e \"%08x\" -n 4 /dev/urandom` num=`printf "%03d" $i` user=acm$num echo "$user: $passwd" >> ~/acm.accounts i=$(( $i + 1 )) useradd -c \"ACM Team $num\" -s /bin/ksh -m -d /home/$user $user echo "Set password fpr $user to $passwd" passwd $user done 3.4 Configure dhcpd =================== Here is an example configuration file to be stored in /etc/dhcpd.conf allow unknown-clients; ddns-update-style none; subnet 192.168.1.0 netmask 255.255.255.255 { range 192.168.1.2 192.168.1.254; default-lease-time 43200; max-lease-time 64800; option subnet-mask 255.255.255.255; } 4 Start services ================ Add the following lines to your /etc/rc.conf: ifconfig_ex0="inet netmask 255.255.255.0" ifconfig_epic0="inet 192.168.1.1 netmask 255.255.255.255" defaultroute= domainname=acm rpcbind=YES ypserv=YES ypbind=YES dhcpd=YES dhcpd_flags="epic0" nfs_server=YES mountd=YES In this example, the 'ex0' interface is connected to the internet, the 'epic0' interface is used to connect to all the clients. After adding these lines, make sure that the services start. Run /etc/rc.d/ypserv start /etc/rc.d/dhcpd start /etc/rc.d/nfsd start If all goes well, reboot the machine to make sure that all services come up automatically. Try to get a dhcp lease from another machine and mount the home directories. Finally, remember to update the YP information, if you haven't done so already. This needs to be done each time you change any of the account information: cd /var/yp make 5 Install Java and PC2 ====================== 5.1 Install Java ================ In order to run the PC2 server software, you need to install the following packages: - suse_base - suse_compat - suse_x11 These packages are available as binary packages from - ftp://ftp.netbsd.org/pub/NetBSD/packages/1.6.2/i386/All/suse_base-7.3nb5.tgz - ftp://ftp.netbsd.org/pub/NetBSD/packages/1.6.2/i386/All/suse_compat-7.3.tgz - ftp://ftp.netbsd.org/pub/NetBSD/packages/1.6.2/i386/All/suse_x11-7.3nb2.tgz Since Sun's license prevents the redistribution of binary packages of their Java SDK and JRE, binary packages are not currently available. You can install the software from pkgsrc: - Download ftp://ftp.netbsd.org/pub/NetBSD-current/tar_files/pkgsrc.tar.gz - extract the tarbal into /usr/pkgsrc - cd /usr/pkgsrc/lang/sun-jdk14 - make install 5.2 Install PC2 =============== Install PC2 following the instructions on http://www.ecs.csus.edu/pc2/. 5.3 Install apache and the Java Documentation ============================================= 5.3.1 Install software ====================== Install unzip from the NetBSD Packages Collection; ftp://ftp.netbsd.org/pub/NetBSD/packages/1.6.2/i386/All/unzip-5.50nb2.tgz Install apache from the NetBSD Packages Collection: ftp://ftp.netbsd.org/pub/NetBSD/packages/1.6.2/i386/All/apache-2.0.49nb1.tgz 5.3.2 Extract Java Documentation ================================ Download the Java Documentation .zip file from http://java.sun.com/j2se/1.4.2/download.html#docs Extract the Java Documentation into the appropriate directory: $ cd /usr/pkg/share/httpd $ rm -fr htdocs $ unzip .../j2sdk-1_4_2-doc.zip $ mv docs htdocs 5.3.3 Start apache ================== Add the line apache=YES to the file /etc/rc.conf Edit /etc/rc.local so that it contains the lines if [ -f /usr/pkg/etc/rc.d/apache ]; then /usr/pkg/etc/rc.d/apache start fi This ensures that apache is started when the machine reboots. To test your installation, just run /usr/pkg/etc/rc.d/apache start and connect to the machine on port 80.