Reinstall OpenBSD 5.7 automatically, perfect for VPS! You don't need a KVM!

 

What do you need ?

 

  • A running OpenBSD 5.7 system
  • The source files : sys.tar.gz (kernel) & src.tar.gz (userland) to compile the new ramdisk kernel : bsd.rd
  • Internet connection

 

Please, first read the man pages : autoinstall(8) and don't forget to make a backup before!

 

 

 Step 1 - Get the source files and extract them

 

 cd /tmp

 ftp http://ftp2.fr.openbsd.org/pub/OpenBSD/5.7/src.tar.gz

 ftp http://ftp2.fr.openbsd.org/pub/OpenBSD/5.7/sys.tar.gz

 

 tar zxf src.tar.gz -C /usr/src

 tar zxf sys.tar.gz -C /usr/src

 

 

 

 Step 2 - Create the answer file auto_install.conf, and modify at your convenience

 

 touch /usr/src/distrib/miniroot/auto_install.conf

 

 Here's a sample :

 

 Choose your keyboard layout = fr

 System hostname = obsd

 Password for root account = YOUR_PASSWORD_HASH

 Start ntpd(8) by default = y

 What timezone are you in = Indian/Reunion

 Location of sets = http

 HTTP Server = ftp2.fr.openbsd.org

 Set name(s) = -g* -x* +xb*

 

 Generate hash for password :

 

 encrypt -b 8

 

 

 Step 3 - add the following line to the file /usr/src/distrib/$(machine)/common/list :

 

COPY    ${CURDIR}/../../miniroot/auto_install.conf   auto_install.conf

 

 

 

 Step 4 - compile

 cd /usr/src/distrib/special

 make clean

 make obj

 make

 make install

 

 cd /usr/src/distrib/$(machine)

 make clean

 make obj

 make depend

 make

 

 

 

 Step 5 - install the new ramdisk kernel

 

 cd /usr/src/distrib/$(machine)/ramdisk_cd/obj/

 cp bsd.rd /

 

 echo "boot bsd.rd" >> /etc/boot.conf

 

 reboot

 

Enjoy, you will have now a new fresh OpenBSD installed!

© Copyright 2015

contact : wesley [at] mouedine [dot] net