Thursday, December 10, 2020

Chapter 1 : Building a LINUX System from scratch

Hi,

In this post/chapter we shall discuss how to create a new linux system from scratch...

The entire story of having a fresh linux system is narrated using Virtual Box.

The below section discusses the pre-requisites to have the new linux system in place


The host system, in my case I am going to use ubuntu-20.04.1 as operating system.

In order to proceed, let us have some preliminary works done by referring the details below...

Checking the versions of the package...

cat > version-check.sh << "EOF"

#!/bin/bash# Simple script to list version numbers of critical development tools

export LC_ALL=C

bash --version | head -n1 | cut -d" " -f2-4

MYSH=$(readlink -f /bin/sh)

echo "/bin/sh -> $MYSH"

echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"

unset MYSH

echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-

bison --version | head -n1

if [ -h /usr/bin/yacc ]; then

echo "/usr/bin/yacc -> 'readlink -f /usr/bin/yacc'";

elif [ -x /usr/bin/yacc ]; then

echo yacc is `/usr/bin/yacc --version | head -n1`

else

echo "yacc not found"

fi

bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-

echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2

diff --version | head -n1

find --version | head -n1

gawk --version | head -n1

if [ -h /usr/bin/awk ]; then

echo "/usr/bin/awk -> 'readlink -f /usr/bin/awk'";

elif [ -x /usr/bin/awk ]; then

echo awk is `/usr/bin/awk --version | head -n1`

else

echo "awk not found"

fi

echo "---------------------------------------------------------------------"

gcc --version | head -n1

g++ --version | head -n1

ldd --version | head -n1 | cut -d" " -f2- # glibc version

grep --version | head -n1

gzip --version | head -n1

cat /proc/version

m4 --version | head -n1

make --version | head -n1

patch --version | head -n1

echo Perl `perl -V:version`

python3 --version

sed --version | head -n1

tar --version | head -n1

makeinfo --version | head -n1 # texinfo version

xz --version | head -n1

echo 'int main(){}' > dummy.c && g++ -o dummy dummy.c

if [ -x dummy ]

then echo "g++ compilation OK";

else echo "g++ compilation failed"; fi

rm -f dummy.c dummy

EOF


Copy & Paste the above code in a terminal and press enter.... you should be having file named "version-check.sh" in your present working directory.

Change the mode of the file "version-check.sh" for its execution.

$ chmod 777 version-check.sh

Now the file is ready and set for execution, execute the file in a terminal

$ ./version-check.sh

The file execution would result in something like the image given below...

Execute the following command to have "command not found" fixed...

$ sudo apt install bison gawk texinfo

"ERROR: /bin/sh does not point to bash" is an other error, which can be fixed using the following commands...

On the terminal window execute the following commands one after the other in the order given...

$ sudo mv /bin/sh /bin/dsh
$ sudo ln -s /usr/bin/bash /bin/sh

This will ensure what is required to have a fresh linux, you can cross check by executing the following command again

$ ./version-check.sh

the sample of the result is furnished in below image....



No comments:

Post a Comment

How to change the root password in linux when it is forgotten/to change

This blog is all about changing the root password of the Linux system when it is forgotten or to reset the password...   Let's get it ...