How to build your own yVM: step-by-step process

The following instructions were tested on VMware Player, standalone ESXi and clustered vSphere 6.0.

Prerequisites:

  1. Download Core 5.4
  2. Create a new VM with following characteristics:
  • 1vCPU
  • 64MB HDD (IDE0:0)
  • 64MB RAM (in the end you will switch it to 48MB but you may need more for the installation process)
  • Remove unnecessary peripherals such as floppy drive etc.

Core Installation

Once the boot process is completed, the first step is to install TinyCore on a hard drive. Run following commands to install binaries that you will need in later process:

$ tce-load -wi cfdisk.tcz grub-0.97-splash.tcz

$ sudo su

Check which drive is representing your IDE vmdk file. By default it should be /dev/sda or /dev/sda1 :

fdisk -l

Open cfdisk in order to create necessary persistent partitions :

$ cfdisk /dev/sda1 (sda stands for your VMDK file)

In cfdisk, create two partitions:

  • 1 x 32MB bootable partition and
  • 1 x Swap partition (code 82 for type of partition)

Note: After creating partitions do not forget about committing changes and setting the EXT partition as bootable!

exit cfdisk

rebuild the filesystem information:

$ rebuildfstab

Create an ext3 filesystem :
$ mkfs.ext3 /dev/sda1

(mount your newly created Linux partition and ISO file)
$ mount /mnt/sda1

$ mount /mnt/sr0

Create necessary folders where grub and boot files will be copied to:
$ mkdir -p /mnt/sda1/boot/grub

$ mkdir -p /mnt/sda1/tce

Copy boot and installation files :

$ cp -p /mnt/sr0/boot/* /mnt/sda1/boot/

$ touch /mnt/sda1/tce/mydata.tgz
$ cp -p /usr/lib/grub/i386-pc/* /mnt/sda1/boot/grub/

Create e a new grub menu list

$ vi /mnt/sda1/boot/grub/menu.lst

press “i” key to enter edit mode. then include the following information:

default 0
timeout 0
title <yourVMtitle>
kernel /boot/vmlinuz quiet
initrd /boot/core.gz

type “:wq” to exit and save changes.

Open Grub setup:
$ grub
In the grub prompt, type

$ root (hd0,0)
$ setup (hd0)
$ quit

type umount /mnt/sr0, then eject /dev/sr0
type reboot

Note: Make sure that ISO file is unmounted from your VM to avoid a boot from it during the restart.

Software installation

After the reboot you should end up in a bash shell. Continue with the installation of openssh, nano, nginx and open-vm-tools.

Let’s start with openssh:

$ tce-load -iw openssh
$ cd /usr/local/etc/ssh
$ sudo cp ssh_config.example ssh_config and then sudo cp sshd_config.example sshd_config
$ sudo /usr/local/etc/init.d/openssh start
$ passwd (and change password for user tc)
$ sudo passwd (and change password for user root)

From now on you may continue the installation process via an ssh session but beware, this is not the end! Do not reboot your VM yet.

Install nano:

$ tce-load -iw nano

Install nginx:

$ tce-load -iw nginx

Install open-vm-tools:

Download open-vm-tools binary and dependencies from here.

Unpack them and upload them via scp (or winscp if you use Windows OS):

$ scp /<unpacked_packages>/* tc@<yVM_ip_address>:/tmp

Install packages in the following order:

tce-load -i openssl.tcz openssl-dev.tcz  libdnet.tcz  open-vm-tools-modules-3.8.13-tinycore.tcz libtirpc glib2 fuse open-vm-tools

Check if all aforementioned packages are present in /mnt/sda1/tce/optional/

If not, copy missing tcz’s :

sudo cp /tmp/name_of_the_package.tcz /mnt/sda1/tce/optional/

Now save all your work before performing a reboot:

$ sudo nano /opt/.filetool.lst

opt
home
/usr/local/etc/ssh
/etc/passwd
/etc/shadow
/etc/hostname
/usr/local/etc/nginx
/usr/local/etc/init.d/nginx

$ sudo nano/opt/bootlocal.sh

#!/bin/sh
# put other system startup commands here
/usr/local/etc/init.d/openssh start
/usr/local/etc/init.d/nginx start

$ sudo nano /mnt/sda1/tce/onboot.lst

openssh.tcz
openssl.tcz
nginx.tcz
nano.tcz
libtirpc.tcz
glib2.tcz
libdnet.tcz
open-vm-tools-modules-3.8.13-tinycore.tcz
open-vm-tools.tcz
fuse.tcz

verify that open-vm-tools is up and running:

$ sudo /usr/local/etc/init.d/open-vm-tools start

Eventually, save all configuration with the following command:

$ sudo filetool.sh -b

You may now shut down your VM, change the amount of necessary RAM to 48MB and reboot it again.

5 comments

  1. Pingback: yVM: Download Page | cloudarchitectblog
  2. Pingback: yVM: An ultra small VM with VM tools installed | cloudarchitectblog
  3. Pingback: open-vm-tools tcz extension for TinyCore 6.4 | cloudarchitectblog
  4. Marcin L. · December 3, 2015

    Grub section needs to be updated:
    type rebuildfstab (rebuild the filesystem information)
    type mkfs.ext3 /dev/sda1 (create an ext3 filesystem)
    type mount /mnt/sda1
    type mkdir -p /mnt/sda1/boot/grub
    type mount /mnt/sr0
    type cp -p /mnt/sr0/boot/* /mnt/sr0/boot/
    type mkdir -p /mnt/sda1/tce
    type touch /mnt/sda1/tce/mydata.tgz
    type cp -p /usr/lib/grub/i386-pc/* /mnt/sda1/boot/grub/ (install grub)
    type vi /mnt/sda1/boot/grub/menu.lst to make a new grub menu list

    Like

  5. Pingback: Linux Quickie: Persistent Static IP Address on Tiny Core Linux – brainXploit

Leave a comment