Search This Blog

Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

2014-11-11

Network Ubuntu Install via PXE Using Preseed - Kickstart Alternative

Ubuntu has a method of automatic network installation similar to redhat's kickstart install.

It's called "debian-installer" and it is the recommended method of installing ubuntu automatically.

Similar to kickstart you have a preconfiguration file called "preseed" in which you answer questions asked by the installer.

You can either:
  1. Install ubuntu manually and export answers to questions
  2. Create answers to questions manually

#1 you can perform using:

# Generate a sample preseed.cfg with some default values you selected during manual install
apt-get install debconf-utils
debconf-get-selections --installer > preseed.cfg
debconf-get-selections >> preseed.cfg


Then you make this file available in the kickstart menu.

I've included a sample menu file (which points to the preseed) as well as the contents of a basic preseed file.
Menu File:

default linux

SERIAL 0 115200

label linux
kernel images/ubuntu/14.04/install/netboot/ubuntu-installer/amd64/linux
append initrd=images/ubuntu/14.04/install/netboot/ubuntu-installer/amd64/initrd.gz auto=true priority=critical interface=auto url=ftp://fbsd-ftp/images/ubuntu/14.04/preseed/sandvine.seed -- console=ttyS0,115200n8
IPAPPEND 2


Preseed File:

# Primary network interface:
d-i netcfg/choose_interface select auto

# Locale Configuration
d-i debian-installer/locale string en_US

# Set Keyboard to American English
d-i console-keymaps-at/keymap select American English
d-i debian-installer/keymap string us

# Set timezone
d-i time/zone string American/Toronto

# Do not make a user account
d-i passwd/make-user boolean false

# Assign the password for root
d-i passwd/root-password password sandvine
d-i passwd/root-password-again password sandvine

# Allow root login
user-setup-udeb passwd/root-login boolean true

# Partitioning
# Partition using LVM on the first and only detected disk
d-i partman-auto/method string lvm
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean false
partman-lvm partman-lvm/device_remove_lvm boolean true
partman-lvm partman-lvm/confirm_nochanges boolean true
partman-lvm partman-lvm/confirm boolean true
unknown partman-lvm/confirm boolean true
partman-lvm partman-lvm/vgdelete_confirm boolean true

# Choose automatic partitioning recipes where automatic puts
# All configuration on the same partition
d-i partman-auto/choose_recipe select automic
# Complete partitioning without further confirmation
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true

#Choose some additional packages to instal
d-i pkgsel/include string openssh-server


### Finishing up the installation
# During installations from serial console, the regular virtual consoles
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
# line to prevent this.
d-i finish-install/keep-consoles boolean true

# Send command to pxeboot server to tell it to boot from HDD after imaging is successful
d-i preseed/late_command string /bin/echo "$(hostname -s)" | nc -w 3 lab-nfsbootlinux 2509

# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note


Ubuntu does have support for kickstart but there are some important features that may not be fully featured in kickstart that are available in debian installer. Ubuntu even has system-config-kickstart utility to build kickstart files but because of the lack of full functionality it does not end up being as useful as the more fully funcitoning debian installer.

References:
Serial Console - http://blather.michaelwlucas.com/archives/638
Package Install (openssh) - http://www.stratuslab.eu/fp7/doku.php/tutoral:examplepreseed.html
Remove LVM Parts - http://ubuntuforums.org/showthread.php?t=1505174
Debian Example Preseed - http://d-i.debian.org/manual/example-preseed.txt
Ubutntu Example Preseed - https://help.ubuntu.com/lts/installation-guide/example-preseed.txt
Ubuntu 12.04 Preseed Explained - https://help.ubuntu.com/12.04/installation-guide/i386/preseed-contents.html
Ubuntu 10.04 Preseed example - https://help.ubuntu.com/10.04/installation-guide/example-preseed.txt
Generate a preseed - http://searchitchannel.techtarget.com/feature/Performing-an-automated-Ubuntu-install-using-preseeding
Puppet and Preseed - http://ghantoos.org/2012/10/21/cocktail-of-pxe-debian-preseed-ipmi-puppet/
Add Console and debug to menu - http://christian.hofstaedtler.name/blog/2008/09/debian-installer-preseeding-autostart-from-pxe.html
Ubuntu 14.04 install bug - http://www.michaelm.info/blog/?p=1378
What you need to append to menu - https://saz.sh/2011/07/30/preseed-debian-squeeze-using-pxe/
Create User Accounts - https://help.ubuntu.com/community/Cobbler/Preseed
Debian links:
https://www.debian-administration.org/article/394/Automating_new_Debian_installations_with_preseeding
https://www.debian.org/releases/wheezy/i386/apbs04.html.en
https://www.debian.org/releases/wheezy/i386/apbs03.html.en

Official Documentation:
http://www.debian.org/releases/stable/i386/apb.html.en
https://wiki.debian.org/DebianInstaller/Preseed
http://searchitchannel.techtarget.com/feature/Performing-an-automated-Ubuntu-install-using-preseeding
http://www.debuntu.org/how-to-unattended-ubuntu-deployment-over-network-page-5-preseed-file/

New Docs:
http://web.theurbanpenguin.com/auto-installing-ubuntu-16-04/
https://www.debian.org/releases/stable/example-preseed.txt
http://hands.com/d-i/

How to get a post-install command working:
http://www.50ply.com/blog/2012/07/16/automating-debian-installs-with-preseed-and-puppet/
https://ubuntuforums.org/showthread.php?t=1977570


2010-09-16

Adding Ubuntu to Windows 7 bootloader

This is a tutorial to add Ubuntu to the Windows 7 bootloader and the tool bcdedit which is native to Windows. This requires Windows 7 to be installed first.
NOTE: When installing Ubuntu, install GRUB on the partition you are installing Ubuntu on, and NOT on the Windows partition.

Step 1:

Create a backup folder for your bootloader entries incase of emergencies or errors under C:\BCD

At the command prompt enter(Press Windows Key + R and type "cmd" and hit enter):
Bcdedit /export "C:\BCD\bcdBackup"

Step 2:

Now create an entry to the boot loader:
Enter the following Commands
bcdedit /create /d "Title for Ubuntu" /application bootsector
Notes:
-/create create the entry
-/d is the descrption command
-/application bootsector is the type of entry to create
-Also the entry is not automatically added to the boot list menu

The following output will appear. Note copy your entry id (your unquie id is string of characters that has {..})
The entry {bfa3653c-8d1e-11de-9d35-ed9cb53ede31} was successfully created.

Step 3:

Now we have to point the boot entry to a boot loader file. (This file will be created later)
bcdedit /set {id of your entry} path \ubuntu.bin
You should get the output message if it is properly created.
The operation completed successfully.

Step 4:

We need to set the partition where the bootloader can find the file we referred to in the previous step. Since this is a Windows bootloader, it has to point towards a readable Windows partition (ie NTFS or FAT32).
bcdedit /set {id of your entry} device partition=C:
You should get the output message below if it is properly created
The operation completed successfully.

Step 5:

Now we add the entry to the bootmenu list. The following command will add it to the bottom of the list.
bcdedit /displayorder {id of your entry} /addlast
Again, you should get the same output message.
The operation completed successfully.

Step 6:

Restart the computer and Install Ubuntu but stop at the "Ready to install" which is the last screen with the "Install" button.
Make note of the partition you are installing the Ubuntu OS on (ie sda2 or hda2).

Once at the "Ready to install" screen, click on the Advanced button and select the partition you are installing Ubuntu in

Step 7:

click OK to continue and then Install button to proceed installing.

Step 8:

In terminal (Applications > Accessories > Terminal) type:
dd if=/dev/ [the partition of the Ubuntu installation partition] of=/media/[the partition you set to store the ubuntu.bin file in the bootloader entry]ubuntu.bin bs=512 count=1

Example:
dd if=/dev/hda2 of=/media/C/ubuntu.bin bs=512 count=1

And once you restart you can boot into your Windows and Ubuntu with the Windows bootloader.