Loading...

The Arch Way





I don't normally write down anything personal about the usage of an operating system. And I am pretty much used to Microsoft User-Friendly surface of Windows 7 and 8/8.1. But after using and getting familiarised with the Arch Linux, I feel in love with it. Just the perfect operating system anyone can think of. It gives you the power of choosing what you want to do with the operating system. Your dependencies, your desktop environment and your base system.. everything you want with it.

Intuitive in its own way,, I simply love that operating system and the concept of "The Arch Way"

Installing Arch Linux - Minimalist Version

This is a step by step version to install ArchLinux.
First, What is ArchLinux?

The concept of  "The Arch Way" . . Simplicity, Code-Correctness over Convenience, User Centric, Openess and Freedom.
Quote - 'Simplicity is the ultimate sophistication.'  
ArchLinux gives you the freedom to do anything, whatever you want, supported by a huge Wiki.
But the distro is for the intermediate linux users who have some experience in using a linux distro and know how to operate on a non-GUI operating system and build a file from source.

Now, without any time wastage, the process of installing a minimalist version of ArchLinux

  1. Get the latest image of ArchLinux from its page ArchLinux Download.
  2. Boot it into the system or the virtual machine, whichever you like.
  3. Select 'Boot Arch Linux (x86_x64)'
  4. Its is recommended to have an internet connection and to test the connection use 'ping command'.
  5. Using fdisk -l command, prepare the hard drives for the installation.
  6. Using cfdisk command, enter the preparation menu and make a root partition (/dev/sda1) as primary, swap partition (/dev/sda2) as primary, and home partition (/dev/sda5) as logical.
  7. Save the configuration and exit it. You can use fdisk -l command to get the view of the hard drives now.
  8. Use mkfs.ext4 /dev/sda1 and mkfs.ext4 /dev/sda5 to create the disk file system.
  9. To initialise SWAP use  mkswap /dev/sda2 and the swapon /dev/sda2 commands.
  10. Run lsblk command to check evrything is right or not.
  11. Then comes, installing the Arch Base system. Use the following commands:
    mount /dev/sda1 /mnt
    mkdir /mnt/home
    mount /dev/sda5 /mnt/home
  12. Initialise the package manager list by nano /etc/pacman.d/mirrorlist command. And press Enter(default)
  13. To boot from partitions we use genfstab -U -p /mnt >> /mnt/etc/fstab command.
  14. Now comes the system configuration, Configure the chroot by arch-chroot /mnt and set language by editing locale.gen file by nano /etc/locale.gen
  15. Exit it and type
    locale-gen
    echo LANG=en_US.UTF-8 > /etc/locale.conf
    export LANG=en_US.UTF-8
  16. Enter the location as ln-s /usr/share/zoneinfo/Asia/Kolkata /etc/locatime (List can be seen on ls /usr/share/zoneinfo)
  17. Configure hardware clock by hwclock --systohc -utc
  18. Uncomment [multilib] from pacman.conf file by nano /etc/pacman.conf
  19. Synchronise and update database using pacman -Syu
  20. Change the password using passwd command.
  21. Add new user in the system using useradd -mg users -G wheel,storage,power -s /bin/bash your_new_user
  22. Change its password using passwd command.
  23. Install sudo package bu pacman -S sudo
  24. Edit /etc/sudoers file using nano and uncomment “%wheel ALL=(ALL) ALL
  25. Last step is to install the bootloader:
    pacman -S grub
    grub-install /dev/sda
    pacman -S os-prober
    grub-mkconfig -o /boot/grub/grub.cfg
  26. Congratulations, ArchLinux is installed with minimalist base.
    Now exit the chroot environment by
    exit
    exit
    umount /mnt/home
    umount /mnt
    reboot




    You can also add a desktop environment to ArchLinux to make it a GUI based OS, which will be covered in later tutorials.

How to find and return a Maximum occurring Character in a Input String.


/***Write an efficient C function to return maximum occurring character in the input string e.g., if input string is “test string” then function should return ‘t’.
Input string = “test”
1: Construct character count array from the input string.
  count['e'] = 1
  count['s'] = 1
  count['t'] = 2

2: Return the index of maximum value in count array (returns ‘t’).
****/
#include <stdio.h>
#include <stdlib.h>
#define NO_OF_CHARS 256

int *getCharCountArray(char *);
char getIndexOfMax(int *, int);

/* Returns the maximum occurring character in
 the input string */
char getMaxOccuringChar(char *str)
{
  int *count = getCharCountArray(str);
  return getIndexOfMax(count, NO_OF_CHARS);
}

/* Returns an array of size 256 containg count
   of characters in the passed char array */
int *getCharCountArray(char *str)
{
  int *count = (int *)calloc(NO_OF_CHARS, sizeof(int));
  int i;

  for (i = 0; *(str+i);  i++)
    count[*(str+i)]++;

  return count;
}

char getIndexOfMax(int ar[], int ar_size)
{
  int i;
  int max_index = 0;

  for(i = 1; i < ar_size; i++)
    if(ar[i] > ar[max_index])
      max_index = i;

  /* free memory allocated to count */
  free(ar); 
  ar = NULL;

  return max_index;
}

int main()
{
  char str[] = "sample string";
  printf("%c", getMaxOccuringChar(str));

  getchar();
  return 0;
}

}

Hello World !


/*************************************************************************
 *  Compilation:  javac HelloWorld.java
 *  Execution:    java HelloWorld
 *  Traditionally First Program
 *************************************************************************/
public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello, World !");
    }

}

Guidelines of Commenting

~~GuideLines of Commenting~~


  1. First, Please do not Spam. It is meant for education so please do not spam or use any abusive language.
  2. There is a "HTML Encode Tool" for the people who want to ask or optimise the code snippets in the post. It is simple to use. You just have to enter the code and it'll produce a HTML friendly version of the code.
  3. If you want to share a post that can benefit others, feel free to contact me and I'll publish your article.
  4. If you have any complaints or Content that you want to put me down from the blog, you can contact me.




© Copyright Zenith Profundity
Back To Top