Let’s Install Linux In CLI

Ayush Garg
7 min readAug 30, 2020

Hey guys In this article I am going to show you how to install linux in CLI. But before we go ahead to the installation part let’s first understand need of installing Linux in CLI(Command Line interface)

Why install Linux CLI instead of GUI

Memory issue isn’t new if you have 4GB RAM or less then you find lot of difficulties (screen stuck or system hang up) in the installation of Linux in VM(Virtual machine). Because as a beginner we Generally like to install linux in GUI which consume some serious amount of RAM. Moveover if you plan to do such practical which involve use of multiple OS then 8GB RAM will not be sufficient if you install OS in GUI. One last thing In industries command is use to perform the tasks and for just running command CLI installation prefer because GUI installation is very heavy on RAM.

Now Let’s Begin.

If you don’t have any virtualization product installed in your system I recommend you first install it. In this Article I am using Oracle VirtualBox. Which you can download it from here and install it.

Basic of Linux

Linux isn’t an operating system it is kernel which is developed by linus torvalds. Because Linux kernel is open source many OS release throughout three decades based on Linux kernel Like ubuntu, redhat, centos, BOSS Linux, etc. The OS which use Linux kernel come under the Linux family and this is a reason sometime we refer all the OS use linux kernel as an Linux Operating system.

In this article I am using Red Hat linux but if you want you can use ubuntu, fedora, debian, centos, etc. whatever flavor of linux you like. The installation process for every OS will be same.

Installing Linux in CLI is a three step process

  1. Create VM.
  2. Install Linux OS.
  3. Configure package manager.

Let’s create Virtual Machine.

If you are using Oracle VirtualBox follow the steps given below (I added Image for reference at the end of the steps):-

  1. Click New (Blue color button)which you will find at top of screen → A dialog box will appear → Give some name to Virtual machine, select OS type, and version and click next.
  2. Allocate RAM to virtual machine I recommend to allocate 2 GB(2048 MB) if you want you can allocate 1 GB (1024MB) too. → click next.
  3. Select “create a virtual hard disk now” in Hard Disk dialog box → click next.
  4. Select “VID (VirtualBox disk image)” in Hard Disk file type dialog box → click next.
  5. Select “Dynamically allocated” in Storage on physical hard disk dialog box → click next
  6. Allocate Hard disk to virtual machine I recommend to allocate 100 GB but if you have less space you can allocate 50 GB or 10 GB too. → click create.
  7. Now VM is created we have to insert ISO image. To insert ISO file select VM and click setting → Go to storage and select “Controller: IDE” → In right corner select ISO file you have and click OK.

Let’s Install Linux OS

Now To Install Linux Double click VM to power ON the machine and You will see console like shown in image. Select Install Red Hat Enterprise linux and hit Enter.

After five to seven minute you asked to Select language which will be use during the installation process. Select whatever language you want and hit continue.

Now you will see Installation summary consel where we need to make lot of changes. (for reference I am added images at the end of steps)

  1. select Time and Date and set timezone as per your country and region → click Done.
  2. select Software selection → in software selection select minimal Installation →click done
  3. Select KDUMP → if “Enable Kdump is selected deselect it”
  4. select network and host management → and if ethernet is OFF switch ON → click Done
  5. At last click Begin Installation. Depend on your RAM, computing power and internet connection installation may take 20 to 60 minute. while installing OS user setting console appear.
  6. Select Root and set root user password.
  7. After the completion of installation of click on Reboot

After reboot if the console doesn’t appear as shown in image power off machine by closing the window. (Click cross symbol)

Select VM and open settings → Select “system” and in system select motherboard → And change boot order → click Ok. Boot order should be look like the image shown below.

Now the installation part is done we have to configure package manager. We are Configuring package manager because we may have to download package/ software which aren’t already available in system.

Let’s Configure package manager.

To configure package manager start the VM and follow the following steps.

  1. Create a directory by using command mkdir (mkdir <directory name>).
  2. The OS image come with the bundle of software but we can’t perform any read or write operation on the Image. To perform any operation we have to mount image to a some directory. We perform mounting/connection of image to folder/directory so that we can perform read operation. To mount just write “mount /dev/cdrom <directory name>”. Directory name is the name of directory we created in the first step.
  3. Now we have to create a repo file to configure package manager. In redhat yum/dnf are the package manager which I am going to configure here. if you are using ubuntu or other OS then you have to configure your underline OS package manager. To configure package manager create file via a VI editor by using following command “vi /etc/yum.repo.d/<filename>.repo”. Press “I” from keyboard to write line shown in image below.

To save file press ESC and write “:wq”

4. To confirm that yum configure properly use command “yum repolist” or “dnf repolist” you will be seeing output shown in image below.

5. Now we have configure the yum/dnf we have to make it permanent so that whenever we power on VM we don’t have to configure package manager again and again. For this use following command

→ chmod +x /etc/rc.d/rc.local

→ open rc.local file via a vi editor. For this type “vi /etc/rc.d/rc.local” and press “I” from keyboard to insert or write data in a file. Append following line in the file “mount /dev/cdrom <directory name>”. Directory name is the name of directory we created in the first step.To save file press ESC and write “:wq”

“Voila your Linux CLI si ready.”

If you want to check the system and package manager configure properly install net-tools package in system.

To install net-tools package use command “yum install net-tools -y”

To check system configuration type “ifconfig” command. Now you will see IP address and if you see IP address then you have done everything right. You Linix CLI VM is fully operational and you can perform whatever practical you want.

--

--

Ayush Garg

I am Engineer. I believe in simplicity. Life and stuff are already complicated so Why make it more complicated. I try to make things simple as simple as I can.