CloudAtCost Custom OS: Difference between revisions

From eddynetweb's cesspit
Jump to navigation Jump to search
m (Fixed issue with generic kernel download wget not working - causing the script to fail.)
Line 31: Line 31:


Special thanks to [https://www.reddit.com/user/rschulze /u/rschulze] for the script.  
Special thanks to [https://www.reddit.com/user/rschulze /u/rschulze] for the script.  
'''Update:''' Script has been fixed! The other generic kernel was moved to a different directory from boot.netboot.xyz.


<source lang="bash">
<source lang="bash">
Line 44: Line 46:


cd /boot || exit 1
cd /boot || exit 1
wget --continue --output-document=/boot/generic-ipxe.lkrn https://boot.netboot.xyz/ipxe/generic-ipxe.lkrn
wget --continue --output-document=/boot/generic-ipxe.lkrn https://boot.netboot.xyz/ipxe/netboot.xyz.lkrn


_Dev="$(ip route list | awk '/^default/ {print $5}')"
_Dev="$(ip route list | awk '/^default/ {print $5}')"

Revision as of 14:02, 30 January 2021

This tutorial attempts to remake the original one present on the original CloudAtCost wiki. The original wiki had become rather overrun with spam, so the owner shut it down.

Supported OS

The following OS's are supported, according to netboot.xyz:

  • Antergos
  • Arch Linux
  • Architect Linux
  • CentOS
  • CoreOS
  • Debian
  • Fedora
  • FreeBSD
  • Gentoo
  • Mageia
  • Manjaro Linux
  • Microsoft Windows
  • MirOS
  • OpenBSD
  • OpenSUSE
  • RancherOS
  • Scientific
  • Tiny Core Linux
  • Ubuntu
  • Many more (check the site)!

Script

Simply create and execute this script to boot directly into the generic iPXE kernel without hassle.

Special thanks to /u/rschulze for the script.

Update: Script has been fixed! The other generic kernel was moved to a different directory from boot.netboot.xyz.

#!/usr/bin/env bash

cdr2mask ()
{
   # Number of args to shift, 255..255, first non-255 byte, zeroes
   set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
   [[ $1 -gt 1 ]] && shift ${1} || shift
   echo "${1-0}.${2-0}.${3-0}.${4-0}"
}

cd /boot || exit 1
wget --continue --output-document=/boot/generic-ipxe.lkrn https://boot.netboot.xyz/ipxe/netboot.xyz.lkrn

_Dev="$(ip route list | awk '/^default/ {print $5}')"
_Gateway="$(ip route list | awk '/^default/ {print $3}')"
_IP="$(ip -o -4 addr show "${_Dev}" | awk '{print $4}')"
_Netmask="$(cdr2mask "${_IP#*/}")" 
_IP=${_IP%/*}

cat <<_EOF_ > /boot/netboot.xyz-initrd
#!ipxe
#/boot/netboot.xyz-initrd
imgfree
set net0/ip ${_IP%/*}
set net0/netmask ${_Netmask}
set net0/gateway ${_Gateway}
set dns 208.67.222.222
ifopen net0
chain --autofree https://boot.netboot.xyz
_EOF_

cat <<_EOF_ > /etc/grub.d/09_custom
echo "
menuentry 'netboot.xyz' {
    set root='hd0,msdos1'
    linux16 /generic-ipxe.lkrn
    initrd16 /netboot.xyz-initrd
}
"
_EOF_
chmod +x /etc/grub.d/09_custom

update-grub2 || { grub2-mkconfig -o /boot/grub2/grub.cfg; grub2-set-default 0; }

reboot

Prerequisites

I would advise doing this on a fresh CloudAtCost server, preferably using the Debian 8 Jessie image. Make sure your console works, as you'll need it throughout the entire installation.

It appears that the console works much more consistently on DC-2 as opposed to DC-3, so I'd give it a shot there for the most successful installation (plus, DC-2 is probably as stable you're gonna get at the moment).

Steps

1. Login into your fresh server, preferably using the console (SSH will work too).

2. Run the following command:

cd /boot && wget -c "https://boot.netboot.xyz/ipxe/netboot.xyz.lkrn"

Note: This is where you'll need the console. If you're not already on it, do so now.

3. Reboot your server using Ctrl+Alt+Del (or clicking the blue square in the corner of the console), or using the "reboot" command.

4. Right after the VMWare splash screen, the GRUB boot menu will appear. Quickly press the letter "C".

Note: You should now see a "grub>" prompt. If not, you'll need to reboot and try step 4 again.

5. In the grub prompt, type the following command:

linux16 /boot/netboot.xyz.lkrn

Note: Be prepared to quickly press "M" after this next command:

6. Then boot into it using the following command:

boot

7. Quickly press "M" to bring up the menu.

8. Select "Manual network configuration".

9. Now you'll need to provide the following information in order for the script to download the image. This can all be found on the information icon in the CloudAtCost panel:

IP address (found in panel)
Subnet mask (if you have issues relating to networking, try leaving this blank)
Default gateway (found in panel)
Set DNS to 8.8.8.8

Note: To avoid HTTP/S timeouts when fetching iPXE bootfiles, avoid inputting netmask while performing the previous steps. If iPXE times out HTTP/s connections, reboot and perform the steps above starting from the grub prompt. This is a handshake bug between CloudAtCost VMs and our iPXE host server that we are currently working on addressing.

10. If everything is successful, you should now get a list of OS's which you can choose to your hearts content. Pick the OS you'd like and then follow the instructions. The script will lead you to installing the operating system of your choice.

netboot.xyz.gif

That's it!


If you have any issues, check the ##CloudAtCost channel on Freenode or /r/CloudAtCost on reddit. Plenty of people there available to help.