Linux is fun with Multipass

afeez_adeyemo

Afeez Adeyemo

Posted on November 19, 2024

Linux is fun with Multipass

Multipass is a tool developed by Canonical that allows you to create and manage Ubuntu virtual machines (VMs) with ease. It is a container designed to provide a cloud-like experience on your local machine, making it ideal for developers who need quick access to Ubuntu environments for testing and development12.

Key Features of Multipass:

  • Cross-Platform: Available for Linux, macOS, and Windows.
  • Quick Setup: Launches VMs with a single command, providing a fresh Ubuntu environment almost instantly.
  • Cloud-Init Support: Allows you to configure VMs using cloud-init, similar to how you would in a public cloud.
  • Minimal Overhead: Uses native hypervisors (KVM on Linux, Hyper-V on Windows, and QEMU on macOS) for efficient performance.
  • File Sharing: Easily share files and folders between your host and VMs.

Common Uses:

  • Development and Testing: Quickly spin up isolated environments to test applications or configurations.
  • Learning and Experimentation: Ideal for learning Linux, trying out new software, or experimenting with different configurations without affecting your main system.
  • Local Cloud Simulation: Create a mini-cloud on your local machine to simulate cloud deployments2.

This tutorial demonstrates how to download and deploy basic commands on multipass.

  1. Downloading Multipass
    • Search for download multipass on google. Igoogle search for multipass
  • Install now
    Install

  • Select the operating system of your computer
    choose appropriate OS

  • Launch multipass, select any of the options
    launch multipass

  1. Executing basic commands with Multipass
  • Entering the Root environment. The command (sudo su) allows users into the root environment without asking for password. This environment grants administrative rights which permits administrative commands i.e create folders/files, deleting etc.
    Sudo su

  • Navigating the file system

    • pwd command. This is the printing work directory command. This enables you find your current location starting from the home. More like showing you direction to your current location starting from home on a google map. pwd
    • mkdir name command. This is the create a directory command that creates the directory with unique name given. This is similar to create a cabinet/resource group that can be further partitioned used to store files or similar items. mkdir This has created 2 file - afeezspace1 and afeezspace2
    • cd command. This is the change directory command which enables a user to enter into a pre-existing directory and also to leave a directory. cd command with a name takes you to the named directory while cd without a name takes you out of the current location to home. cd notice we are now in afeezspace2
    • ls command. This is the list command that lists the items (files and directory) in a directory. ls command Notice the ls command didn't list anything because the afeezspace2 directory is empty. The pwd command is showing us that we are in afeezspace2 located in the ubuntu-homepage.
    • exit command takes the user out of the whole environment, in this case out of the administrative/root environment to home. exit command Notice we have been taken out of the whole root environment. sudo su takes us back into the homepage of the administrative environment. -using the ls command at this point will show us the 2 directories previously created. Is command
    • Lets go back into afeezspace1. with the command cd afeezspace1 Image description
    • cd .. command - This takes you out of the space you are to the space just above, as against the cd that takes you back to home cd ..
    • Enter cd afeezspace1 to enter the afeezspace1 directory again.
  • Creating text files: touch name of file is the commands that create an empty test file to host codes and tect documents.

    touch

Notice 3 files (World, Africa and Nigeria) have been created. Using the ls command lists out the files in the afeezspace1 directory

  • Deleting - rm deletes a file. rm Nigeria will delete the Nigeria file. Enter ls command to see the files left in the directory.

RM

Notice the file Nigeria is gone

  • Writing in a text file - The commands vi name of text file or vim name of text file will open up the text file for content to be added/edited.
    vi

    • To write into the file, press i then go ahead to type adding content to a text file
    • Exiting a text file - Press esc to exit to writting mode and shift :wq will save and exit the text file.

entering text
Notice we are back to the multipass window

  • Viewing the content of a text file: The command cat name of text file will display the content of a text file. Enter cat world to see what we have just written in the world text file.

cat
Notice the display

  • The copy command: The command cp name destination copies the content of the text file named to the destination directory. cp world afeezspace2 will copy the text file world to afeezspace2.

copy

  • deleting a directory: the command rmdir name will delete the directory with the specified name, while rm name will delete a file with the specified name.
  • Generating a report of all commands used: The command history will list out all the commands that have been used in the current shell

history

Thanks for reading this article which shows that Linux is fun, taking us through basic commands in multipass.

Drop comments and questions in the comment session.

💖 💪 🙅 🚩
afeez_adeyemo
Afeez Adeyemo

Posted on November 19, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related