COMP 3000 2011 part1 ttian1

From Soma-notes

Part1

Background

The name of the distribution I choose is CRUX. It is a lightweight, i686-optimized Linux distribution. CRUX is delivered by a tar.gz-based package system with BSD-style initscripts(initialization scripts follow the BSD-style)<ref name="BSD-style"> BSD-style initscripts. Retrieved December 12, 2011 from http://crux.nu/Main/Handbook2-7#ntoc50</ref> and also utilizes a ports system to install and upgrade applications.<ref name="About Crux"> About CRUX Linux. Retrieved October 18, 2011 from http://crux.nu/</ref> BSD is a definition which stands for Berkeley Software Distribution and it has been considered a branch of UNIX—"BSD UNIX". <ref name="BSD"> Retrieved December 12, 2011 from http://en.wikipedia.org/wiki/Berkeley_Software_Distribution</ref> and the ports system is a term refers to a remote repository containing ports and a client program capable of downloading ports from that repository.<ref name="ports-system"> About Ports system. Retrieved December 12, 2011 from http://crux.nu/Main/Handbook2-7#ntoc32</ref>

VMsetting

Unlike other distributions, the primary goal of CRUX is not to be popular or to put as many features as possible into the system. In fact, CRUX is targeted at experienced Linux users especially. CRUX is first created by Per Liden (found through wikipedia) and the project has grown into a reasonable team whose members are all volunteers sharing a common philosophy, so it is not derived from any other distribution. The team provides the core and optional packages for CRUX.

The crux-2.7.iso file is 226 MB. However, after installed, it will become 1.3GB and even more which depends on the ports and packages the user wants to install.

Installation/Startup & Basic Operation

Attention: My installation section and basic operation section are together.

Firstly, I run the iso file through VMware and it shows me interface which looks like the scs.lambda machine, in other words a shell with command line. Then I follow the handbook <ref name="handbook">Handbook. Retrieved October 18, 2011 from http://crux.nu/Main/Handbook2-7 </ref> provided by the crux.nu to do the installation.

Commands to install CRUX

1. As introduced in the handbook, the first thing I need to do is to partition my hard disk(the virtual one in fact). I login as root and use “fdisk /dev/sda” command to do partition, but I get a bad partition table and fail to mount my partition.

As a result, I try “cfdisk /dev/sda” command and I get a good partition table.

Partition

2. I use “mkfs.ext4 /dev/sda1” command to build my file system. Then I use “mount /dev/sda1 /mnt” to mount my sda1 partition to /mnt, so I can access my sda1 partition from /mnt.

3. I use “mkdir /mnt/var” command to make /mnt/var directory which is for the later installation.

4. I use “mount /dev/sda1 /mnt/var” command to mount /dev/sda1 to /mnt/var directory, so I can access my sda1 partition from /mnt/var.

5. I use “setup” command to go into the CRUX setup windows to start the package installation script.

Setup

After the setup, I can compile the kernel by using following commands:.

6. I use "# Mount --bind /dev /mnt/dev" command, so /dev is remounted to /mnt/dev, in other words, /dev and /mnt/dev are bound together.

7. I use "# Mount --bind /tmp /mnt/tmp" command, so /tmp is remounted to /mnt/tmp, in other words, /tmp and /mnt/tmp are bound together. //Attention: the bind option for Mount command make the first parameter of the arguments inherits the properties of the second parameter.

8. I use "# Mount –t proc proc /mnt/proc" command, so I can mount proc to /mnt/proc with vfstype proc.

9. I use "# Mount –t sysfs none /mnt/sys" command, so I can mount none to /mnt/sys with vfstype sysfs.

10.I use "# Chroot /mnt /bin/bash" command, so I can change root of current processes to the directory /mnt and run command /bin/bash.

Compile kernel

11.I use passwd command to initiate the password by using command.

12.I use "vim" to edit files such as fstab, rc.conf, /rc.d/net and so on to set the environment of the kernel.

Then I go to the /usr/src/linux-2.5.35.6 directory to make instal the kernel.

Vim systemfile

13.I use "# Cd /usr/src/linux-2.6.35.6" command to go to the /usr/src/linux-2.6.35.6 directory.

14.I use "# Make menuconfig" command to go into the configuration whindows to do further configurations for the kernel.

15.I use "# Make all" command to install files.

16.I use “make modules_install” for another installation.

17.I use "# Cp arch/x86/boot/bzImage /boot/vmlinuz" to copy arch/x86/boot/bzImage to /boot/vmlinuz.

19.I use "#Cp System.map /boot" command to copy System.map to /boot.

20.The last step is to edit the /etc/lilo.conf by using "vim /etc/lilo.conf" to boot the kernel which I have just compiled and then run lilo to make the new system bootable.

After performing these steps, the CRUX should be installed successfully.

What I learn through the installation

Though I fail to run the kernel for CRUX, I learn a lot through the installation.

MD5MD5<ref name="de5"> Retrieved December 12, 2011 from http://en.wikipedia.org/wiki/MD5 </ref> is the Message-Digest Algorithm which has been employed in a wide variety of security applications, and is also commonly used to check data integrity. After I have downed the CRUX ISO image (crux-2.7.iso), the first thing I should do is to examine its checksum using md5sum, so I can know whether the file is modified or changed by others. If the MD5 matches, the file is the exactly one I want and safe to run.

When a command can not work in the terminal and the reason is difficult to find, there may be some other way to achieve the purpose of using that command. For example, after I failed to use fdisk /dev/sda command to partition my hard disk several times, I use cfdisk /dev/sda command whose function is similar to fdisk /dev/sda and finally get a good partition table.

Because I use which and whereis commands to find the locations of files several times, I have found that there are some differences between them. Which command use the name of the executable file as its argument and it locates that executable file by using the PATH variable, whereas whereis command uses the name of the file or directory as its argument(we can also regard the name as a key word) and returns all the files whose names contain the key word of the argument. As a conclusion, which command is used to locate an executable file and whereis command is used to locate all the files which are related to its argument. As a result, it is better to use which command rather than whereis to find an executable file , because which returns the exact path but whereis returns many results including the exact path which makes it harder to find the result the user want. For example, when I use "which bash" command, I get /bin/bash. However, when I use "whereis bash", I get both /bin/bash and /usr/man/man1/bash.1.gz.

When I am trying to build up the kernel, I use "Chmod 777 *" to change the permissions of all the files in the current directory so they are writable, readable and executable to all the groups. Though Chmod 777 * command helps me to avoid some problems such as permissions denied easily, I find it dangerous because when files are made writable, readable and executable to all the groups, anyone can read, execute and edit them and protected files may be modified, which means that a hacker can attack my computer easily.

Usage Evaluation

From my point of view, as I am a fresh man to Linux, CRUX is really quite targeted to experienced users. Just as the developer says, I have to do almost everything by myself by using the shell, even compile my own kernel! The command line is only the “#” symbol, rather than showing the directory in other distribution of Linux such as Ubuntu. As a result, I have to be very familiar with the directory commands and clearly know what I am doing and where I am, or I have to use “cd ..” command to go back to top directory and go into the directory I want to go to a again which makes me feel that CRUX is not user friendly. However, as one of the features of CRUX, it really makes the screen “light and clean”. Another feature of CRUX is its ports system which makes it much easier to install and update packages.CRUX does not install KDE automatically, so the UI looks like the lambda machine we use at laboratory. CRUX does not contain the gcc C compiler. As a conclusion, I think using Crux is much more difficult than using other distributions such as Ubuntu. At last, I want to say that I choose CRUX because it sounds cool and it is a lightweight distribution of Linux. Though it really takes me a lot of time to do with and be familiar with CRUX, I love this distribution because it forces me to learn much more about Linux from the surface to the kernel.

Reference

<references />