15 August 2009

How to Install Virtual Box on Linux (Fedora)

This is how to get VirtualBox up and running on Linux Fedora 10.  Also, this tutorial is for the 32-Bit version of VirtualBox, so you’ll have to customize a little more to get the 64-bit version running. Everything in the “code” sections should be copy/pasted/typed into the terminal.
Right, let’s get to it:

PreStep.) Open the terminal and get into super user mode:

    su -

1.) Get the latest VirtualBox package (as of now, 2.0.6) from the VirtualBox website for Fedora 9 and install it (generally, after a few months, the Fedora 10 link will be available).

    wget http://download.virtualbox.org/virtualbox/2.0.6/VirtualBox-2.0.6_39765_fedora9-1.i386.rpm && rpm -ivh VirtualBox-2.0.6_39765_fedora9-1.i386.rpm

2.) Get the kernel-devel package:

    yum install make automake autoconf gcc kernel-devel dkms

3.) Run the setup file for VirtualBox:

    /etc/init.d/vboxdrv setup

4.) Add yourself to the “vboxusers” group and fix the SELinux Permissions:

    usermod -G vboxusers -a username
    chcon -t textrel_shlib_t /usr/lib/virtualbox/VirtualBox.so

5.) Run, and enjoy!

    VirtualBox

6.) To Get USB Support:

    1 – create a new group called “usb”;
    2 – locate file usbfs: in my case is /sys/bus/usb/drivers (I suggest to find the file with a usb device inserted;
    3 – modify file /etc/fstab inserting a line containing the right path and the number corresponding the “usb” group :
    none /sys/bus/usb/drivers usbfs devgid=503,devmode=664 0 0
    4 – command mount -a;
    5 – start VB and try…;

Source: Fedora Forums
7.) To Properly Backup the VirtualBox Machine (.vdi):
Please refer to my other page here:
How To: Properly Backup a VirtualBox Machine (.VDI)
8.) To Get Sound Working:
Highlight your virtual machine and click on the “Settings” button. Click on the “Sound” category, and then check the “Enable Sound” option. In the drop-down box, select “PulseAudio”. You should now have sound.
That’s it!

12 July 2009

File System in Linux

I see not so much people really know the difference about Linux files system. In fact there is a whole lot to it more than just generalizing the usage of each file system, they have different usage purposes and different futures that you might or might not want. The information bellow are freely available on the world wide web, and they are not special information whatsoever , meaning that anyone could find such information, but I thought a good short article about the subject will do no harm. This article will cover EXT2, EXT3, XFS and ReiserFS so no talking about UNIX file systems like UFS or any other "different" OS specific file system, so please don't bring other OS's file system discussions over here.
There will be no historical information here whatsoever, this article main purpose is to provide technical yet simple information about these various file systems to help you in the decision making process of choosing one over the other or better is mixing between them to maximize efficiency.


EXT2:
File allocation: bitmap (free space), table (meta data)
Bad blocks: table
Max file size: 2-64 TiB
Max number of files: 10^8
Max filename length: 255 bytes
Max volume size: 16-32 TiB
Allowed characters in filenames: Any byte except 'NUL' and 0x2F
Dates recorded: modification (mtime), attribute modification (ctime), access (atime)
Date range: December 14, 1901 - January 18, 2038
Date resolution: 1s
File system permission: POSIX
Transparent compression: NO (available through patches)
Transparent encryption: NO
Supported OS's: Linux, BSD, Windows (through an IFS), Mac OS X

EXT3:
Directory contents: table, H tree with dir_index* enabled
File allocation: bitmap (free space), table (meta data)
Bad block: table
Max file size: 16 GiB - 2 TiB
Max number of files: Variable*
Max filename length: 255 bytes
Max volume size: 2-32 TiB
Allowed characters in filenames: Any byte except 'NUL' and 0x2F
Dates recorded: modification (mtime), attribute modification (ctime), access (atime)
Date range: December 14, 1901 - January 18, 2038
Date resolution: 1s, Nanosecond (using undocumented big i-node)
Attributes: No-atime, append-only, synchronous-write, no-dump, h-tree (directory), immutable, journal, secure-delete, top (directory), allow-undelete
File system permission: Unix permissions, ACLs and arbitrary security attributes (Linux 2.6 and later)
Transparent compression: NO
Transparent encryption: NO (provided at the block device level)
Supported OS's: Linux, BSD, Windows (through an IFS)

ReiserFS:
Directory contents: B tree
File allocation: bitmap
Max file size: 8 TiB
Max number of files: 2^32
Max filename length: 4032 bytes, limited to 255 by Linux VFS (Virtual File System)
Max volume size: 16 TiB
Allowed characters in filenames: Any byte except 'NUL' and 0x2F
Dates recorded: modification (mtime), attribute modification (ctime), access (atime)
Date range: December 14, 1901 - January 18, 2038
Date resolution: 1s
Forks: Extended attributes
File system permission: Unix permissions, ACLs and arbitrary security attributes
Transparent compression: NO
Transparent encryption: NO
Supported OS's: Linux

XFS:
Directory contents: B tree
File allocation: B tree
Max file size: 8 EiB minus one byte (on x64 bit system) 16 TiB (on x32 bit system)
Max filename length: 255 bytes
Max volume size: 16 EiB
Allowed characters in filenames: Any byte except 'NULL'
Dates recorded: modification (mtime), attribute modification (ctime), access (atime)
Date resolution: 1ns
Attributes: YES
File system permission: YES
Transparent compression: NO
Transparent encryption: NO (provided at the block device level)
Supported OS's: IRIX, Linux, FreeBSD (experimental)

As we see here there are different structures, and they differ between the B trees and H trees, the B tree data structure keeps data sorted and allows searches, insertions, and deletions in logarithmic amortized time, it is commonly used in databases and file systems. In the other hand we have the H trees structure which is commonly used in VLSI as a clock distribution network (Basically it's a revised version of a B tree data structure for larger directories).

* dir_index is an option that allows indexing which is turned on by typing the command tune2fs -O dir_index /dev/hdXXX.
* If V is the volume size in bytes, then the default number of inodes is given by V/(2^13) or the number of blocks, whichever is less. And the minimum is V/(2^23). The max number of subdirectories in one directory is fixed to 32000.

I think the information above are self explanatory, so I don't have comments on this part of information except to get your attention on the difference between 'NUL' and 'NULL', they are in fact different and mean totally different things, the 'NUL' is a string termination character while 'NULL' means NO thing.

10 June 2009

Some Type of Linux User

In Linux world, there are many type of Linux User based on how they used Linux and contribute to linux community. Some of them categorized into bellow classification :

The Computer User:
This is a person that feels no emotional ties to FOSS/Linux. The computer is only tool to get the job done and they use Linux because they need the tool which can be found in linux for the job they are trying to accomplish. This type of user may have no idea of what FOSS or Linux is. They glad to just know that their computer works when they need it.

The Dual Booter:
This is the person who typically has some computer savvy about them. Some of them are person who decided to give Linux a try because of an interesting article about a new Linux distro or because they know a Linux geek who recommended it. They might make a forum post or two to try and solve an issue they are having, but odds are if the distro doesn't "just work" they will start going on about how Linux "isn't ready for the average user" or "will never make it as a desktop operating system".

Linux Advocate:
This type of person is someone who uses Linux because they feel it is a superior, secure, or more stable operating environment. Typically this is someone who knows about the computer a bit and isn't afraid to post on a forum asking a question or get their system up and running. They are typically willing to use restricted codecs and closed source video drivers to get the performance and functionality they need out of their system. While it is not uncommon for them to recommend Linux to their family and friends, most times they will even help them get it setup, they realize that some people are happy with Windows and they acknowledge this.

FOSS Extremist:
This type is someone who they use Linux not only because it is fast, secure, and stable, but because it is FOSS. Usually they know the ins and outs of their system. If their hardware does not work right "out of the box" on their favorite distro they are willing to spend hours pouring over manuals and help pages to get it working. They almost constantly preach about the evils of Windows and Apple and take every chance they get to convert those they know to Linux or and FOSS operating system.

24 May 2009

Commonly used Linux/Unix commands

Bellow are some of commonly used Linux shell command which usually used every day



Starting and Ending

login: `Logging in'
ssh: Connect to another machine
logout: `Logging out'

File Management


emacs: `Using the emacs text editor'
mkdir: `Creating a directory'
cd: `Changing your current working directory'
ls: `Finding out what files you have'
cp: `Making a copy of a file'
mv: `Changing the name of a file'
rm: `Getting rid of unwanted files'
chmod: `Controlling access to your files'
cmp: Comparing two files
wc: Word, line, and character count
compress: Compress a file

Communication


e-mail: `Sending and receiving electronic mail'
talk: Talk to another user
write: Write messages to another user
sftp: Secure file transfer protocol

Information


man: Manual pages
quota -v: Finding out your available disk space quota
ical: `Using the Ical personal organizer'
finger: Getting information about a user
passwd: Changing your password
who: Finding out who's logged on

Printing


lpr: `Printing'
lprm: Removing a print job
lpq: Checking the print queues

Job control


ps: `Finding your processes'
kill: `Killing a process'
nohup: Continuing a job after logout
nice: Changing the priority of a job
&: `What is a background process?'
Cntrl-z: Suspending a process
fg: `Resuming a suspended process

24 April 2009

How to Add DNS in Linux using shell script

If you want to add DNS server in linux. The fastest way is using shell script.
Here is fastest way to add DNS server in Linux

edit /etc/resolve.conf with your favorite editor (gedit,nano,vim, vi...etc)

for each name server add
nameserver <ip>

06 March 2009

How to make partition in Linux using Gparted

If you want to make partition in Linux, you can use Gparted for that.
Here is how to make partition using gparted

  1. Downloaded Gparted Live 0.3.1-1 Burned as ISO using K3B.
  2. Booted into XP and verified that I had all my music, videos, and documents backed up to the fat32 partition. Deleted all copies on ntfs partition. Opened add remove programs and uninstalled all the Windows versions of programs that I also have on Ubuntu and all programs that I rarely used. Retained all programs that I might use if I ever boot into XP again. Opened and ran disk cleanup wizard. Ran disk defragmenter about five times.
  3. Rebooted with Gparted Live disk. Wow! Amazing program. Only 85MB on the disk and loads linux to ram in less than two minutes! Resized ntfs from 97GB to 40GB.
  4. Decided to use some of that 50GB of free space to try Edgy Eft Knot3. Downloaded, burned as ISO (K3B again), and rebooted. Booted live Edgy disk, clicked the install icon, and ran into a little problem. My disk already had four primary partitions and the newly freed space was not in the extended partition. Was unable to proceed using installation partitioner.
  5. Rebooted with Gparted Live disk. First, I moved my second primary partition (/home) as far left as I could enlarging it by about 10GB as I did. This placed the free space next to my extended partition. Second, I enlarged the extended partition to encompass the free space.

05 February 2009

How to check IP In Linux

In Linux, you can use Shell Command to find or get IP address
It displays Ethernet IP address, Mac address, subnet mask and other information.
Type /sbin/ipconfig command to display IP address:

Code:

$ /sbin/ifconfig

Code:

$ /sbin/ifconfig | less


Under Solaris and other Unixish oses you may need to type ifconfig command with -a option as follows:

Code:

$ /sbin/ifconfig -a
Output sample

Code:

eth0     Link encap:Ethernet  HWaddr 00:0F:EA:91:04:07
  inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
  inet6 addr: fe80::20f:eaff:fe91:407/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:31167 errors:0 dropped:0 overruns:0 frame:0
  TX packets:26404 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:38338591 (36.5 MiB)  TX bytes:3538152 (3.3 MiB)
  Interrupt:18 Base address:0xc000

03 January 2009

Package Management in Linux

Here are some package managemen in Linux

Synaptic
Synaptic is a graphical user interface (GUI) for managing software packages on Debian-based distributions. If you are using Debian or Ubuntu you will easily find Synaptic in the System Tools menu or in the Administration menu. Synaptic uses the GTK graphic libraries . So, if you are using GNOME on your debian-based distro you will probably have Synaptic installed as well. Synaptic is a graphical package management program for apt. It provides the same features as the apt-get command line utility with a GUI front-end based on Gtk+. http://www.debianadmin.com/

Yum
Yum is the easiest way to keep all programs up to date. It downloads and installs the latest version of a program. A single command can update all software installed, including third-party software, security updates and operating system. It can do the updating automatically in the night. In this howto, we install yum and make it do all the above.
Yum is similar to, but better than apt, apt4rpm, windows update, up2date, yast and many other package managers I have seen. Yum works in a safe, standardized way. It uses rpm (Red Hat package manager) for installing programs. Authenticity of packages is checked with strong gpg encryption. Package repositories are just folders on a web server.