Getting Started with TinyCoreLinux, a 12MB OS
TinyCoreLinux is a small lightweight (12 MB) Linux environment which holds a lot of potential.
I came across TinyCoreLinux only recently. The tiny size of the ISO really caught my attention and it got me curious on how and for what purposes people might use such a small OS for. I’m still learning and getting used to the world of Linux and the terminal life. So, I took this opportunity to explore and learn a bit about this intriguing version of Linux. I hope this guide will help other new comers to TinyCoreLinux.
What we’ll be doing in the guide are,
- Install TinyCoreLinux
- Set a local static IP
- Make it SSH ready
- An Internet Connection
- The ISO file (I will be using the Core version, which is the 12MB version).
From the Virtualbox Manager, launch the Host Network Manager via the File menu or with the Ctrl + W Shortcut and create a new Host-Only Ethernet Adapter with DHCP disabled.
Create a new Virtual Machine with the VM creation wizard. Set Type as “Linux” and Version as “Other Linux (64-bit)”, give it a name and proceed with the default settings for rest of the VM creation process.
After creating the VM, go to its Settings
-> Network and enable Adapter 2 and choose the host-only adapter which we previously created.
Start the Virtual Machine with the ISO loaded. And when you reach
tce-load –wi tc-install sudo tc-install.sh
Note: you will need an active internet connection for the first command to succeed.
Follow the onscreen instructions and respond to each prompt as follows,
- Press c and hit [enter key] to install from cdrom.
- Press f and hit [enter key] to install to the VM hard drive.
- Press 1 and hit [enter key] to use the whole disk space.
- Press y and hit [enter key] to install the bootloader.
- Hit [enter key] when it prompts for installation of extensions
- Press 3 and hit [enter key] to use ext4 file system.
- Enter the following as the boot options and hit the [enter key] .
user=tomato host=pizza vga=normal showapps opt=sda1 home=sda1 waitusb=5
8. Press y and hit [enter key] to confirm the installation.
Note: the user and host variables in the boot options (boot arguments) can be changed to what you may see fit. They set the system username and hostname of the installed OS.
After installation, power off the VM and power it back on without the iso mounted.
SETTING UP A STATIC IP
Create the file /opt/eth1.sh
sudo vi /opt/eth1.sh
Note: if you are not comfortable with vi text editor and is more of nano person, run the command
tce-load -wi nano to download and install the nano editor.
#!/bin/sh sleep 10 # kill dhcp client for eth1 if [ -f /var/run/udhcpc.eth1.pid ] then kill `cat /var/run/udhcpc.eth1.pid` fi # configure interface eth1 ifconfig eth1 192.168.10.11 netmask 255.255.255.0 broadcast 192.168.10.255 up
Note: those are not regular single quotes around
cat /var/run/udhcpc.eth1.pid. They are called backquotes, backticks, grave accents etc.. (it’s on the key beside “1” key on the keyboard)
Note: Modify the IP addresses on the script according to your network adapter settings, if you have them different from mine.
Add the following line to /opt/bootlocal.sh so the eth1.sh script will run on system startup
And set permission of /opt/eth1.sh to 775
sudo chmod 775 /opt/eth1.sh
INSTALL AND SET UP OPENSSH
First of all, we need to set a password for the system user. So that we can use it on the ssh password prompt.
$ sudo su # passwd tomato ... ... ... # exit
Note: replace tomato with the system username. If you followed this guide by the letter it will be tomato and won’t need to be changed.
Note: don’t input the $ and # while entering the commands. I used them to show that the passwd and exit commands are being run as root user.
Install openssh with the command,
tce-load –wi openssh
update /opt/.filetool.lst to include these two lines.
Note: Remove the lines opt and home from the file /opt/.filetool.lst why? With our current boot options, both /opt and /home are already persistent (file changes persist after system reboots). There is no need to backup and restore files and folders in them.
Start openssh for the first time to generate the required public/private key pairs and all those good stuff.
sudo /usr/local/etc/init.d/openssh start
Add the following line to /opt/bootlocal.sh so that openssh can start up at boot
/usr/local/etc/init.d/openssh start &
Run the following command to make the changes to the files and folders listed in /opt/.filetool.lst persist after system (the VM) reboot.
Note: If we don’t do this, any changes made to files and folders listed in /opt/.filetool.lst will revert to a previous state on next reboot.
And finally, we can reboot the system.
If everything went smoothly, we won’t need to struggle with typing into the VM anymore. SSH will help us to feed our little OS in a more productive way.