Create custom image for gcp

besides following the steps in the video below
some of the commands were updated

keep in mind this only can be done on MacOS and Linux machines (no windows)
steps provided in the video are on MacOS
updated commands are for Linux Ubuntu

Upload Operating System to Google Cloud Platform Kali Linux
https://www.youtube.com/watch?v=25csweVVqLE

kali build steps in virtual box with Oracle VM Virtual Box
new
name:         kali-032020
platform:     Linux
os:             Ubuntux64
ram:            4gb
disk            20gb    | expert mode and select qcow read and write on save
ok to finish

before you start the instance
select settings
systems:     uncheck the floppy disk
storage: select the IDE controller for cdrom media and point it to your kali iso image (where to install from)
audio: disable audio
network: select advance and change the type to: Paravirtualized network (virtio-net)
OK to safe changes

star the instance
select graphical install
lang EN
geo location USA
keyboard:     American English
loading media from CDRom or mapped iso image
configure network
hostname:     kali-032020
domain name: not needed /skip
full name of the local user: pen daemon
set username and pw: kali/kali
config clock: eastern
partition disk: manual
select SCSI1 VBOX HardDISK
create new empty partition table on the device: Yes
select the free disk space
create new partition
new partition size 21.5 GB
type for new partition: Primary
partition settings: done setting up the partition
system overview: finish partition and write changes to disk
do you want to return to partition menu: No
write changes to disk: yes
software selection: keep default (if you have disk space select "large -- additional tools")
install GRUB boot loader to your primary drive: Yes
device for boot loader instalaltion: /dev/sda (ata-vbox_harddisk_vb0-1a2b3c4d)
this will complete the install and reboot
installation complete: continue
reboot

now some house keeping items:
login to kali with the same creds that we setup during install
open up terminal
install openssh-server
# sudo apt-get install openssh-server
on the new versions of Kali it might be already installed

now enable root login with password
edit the /etc/ssh/sshd_config
# sudo vi /etc/ssh/sshd_config
if you set the numbers for the file with
: set number
on line number 34
#PermitRoorLogin prohibit-password

either edit this line or copy and paste on new line and edit that one
shift Y (to copy)
shift P (to paste)
make it look like this
PermitRoorLogin yes

save and exit the file
:wq

enable ssh server to survive and start automatically on every system start
# sudo update-rc.d -f ssh enable 2 3 4 5

start the sshd service with the following command:

$ sudo /etc/init.d/ssh start

 

Commands are:

Create RAW disk using command

VBoxManage clonehd -format RAW ~/VirtualBox\ VMs/Kali/kali.qcow ~/disk.raw

pwd:
/home/rootman/VirtualBox VMs/kali

VBoxManage clonemedium -format RAW kali.qcow disk.raw

Convert into tar format using command

gtar -cSzf kali.tar.gz disk.raw

Move the tar file to Google storage (gs) using command

gsutil cp kali.tar.gz gs://VirtualBox/kali.tar.gz

Create new virtual machine image using command

gcloud compute images kali –source-uri

gs://VirtualBox/kali.tar.gz

my file located here:
gs://cigar-win-keller1/kali.tar.gz

gcloud compute images create kali –source-uri gs://cigar-win-keller1/kali.tar.gz

Create new virtual machine instance using command

gcloud compute instances create kali –image kali –machine-type n1-standard-1 –zone us-central1-b