sudo su
fdisk /dev/sda
#create 1 primary partition sda1,
#a smaller extended partition sda4
#with a logical partition sda5
mkswap /dev/sda5
sync; sync; sync
swapon /dev/sda5
mkfs.ext4 /dev/sda1
mkdir /mnt/ubuntu
mount /dev/sda1 /mnt/ubuntu
mkdir /work
cd /work
apt-get update
apt-get install debootstrap
debootstrap vivid /mnt/ubuntu
nano /new/etc/apt/sources.list
#add restricted universe multiverse
sudo mount --bind /dev /mnt/ubuntu/dev
sudo mount --bind /dev/pts /mnt/ubuntu/dev/pts
sudo mount -t proc proc /mnt/ubuntu/proc
sudo mount -t sysfs sys /mnt/ubuntu/sys
sudo chroot /mnt/ubuntu
#Create device files
cd /dev
MAKEDEV generic
#create fstab
editor /etc/fstab
>> # file system mount point type options dump pass
>> /dev/sda1 / ext4 errors=remount-ro 0 1
>> /dev/sda5 none swap sw 0 0
>> proc /proc proc defaults 0 0
>> sys /sys sysfs defaults 0 0
>> /dev/fd0 /media/floppy auto noauto,rw,sync,user,exec 0 0
>> /dev/cdrom /media/cdrom iso9660 noauto,ro,user,exec 0 0
mkdir /media/cdrom
mkdir /media/floppy
mount -a
#set timezone
locale-gen en_US.UTF-8
dpkg-reconfigure tzdata
#configure networking
editor /etc/network/interfaces
>> # To use dhcp:
>> #
>> # auto eth0
>> # iface eth0 inet dhcp
>>
>> # An example static IP setup: (broadcast and gateway are optional)
>> #
>> # auto eth0
>> # iface eth0 inet static
>> # address 192.168.0.42
>> # network 192.168.0.0
>> # netmask 255.255.255.0
>> # broadcast 192.168.0.255
>> # gateway 192.168.0.1
#OPTIONAL name server
editor /etc/resolv.conf
#Set your computer's host name
echo UbuntuHostName > /etc/hostname
#OPTIONAL configure Apt w/ more sources
deb-src http://archive.ubuntu.com/ubuntu vivid main
deb http://security.ubuntu.com/ubuntu vivid-security main
deb-src http://security.ubuntu.com/ubuntu vivid-security main
#If you want to boot, install a kernel
apt-cache search linux-image
apt-get install linux-image-2.6.35-22-generic openssh-server bash-completion
#comes with grub, install it on /dev/sda
#OPTIONAL??? setup the boot loader (will probably be done after installing kernel)
apt-get install grub
grub-install /dev/sda
update-grub
#Create a user
adduser myusername
gpasswd -a username sudo
#setup bash completion
nano /etc/bash.bashrc
#look for "enable bash completion and uncomment the code
#exit the chroot
unmount /new
#may need to umount the sub directories first {/sys /proc /dev/pts /dev}
reboot