Saturday, August 1, 2009
History of Linux
In 1991, a student at the University of Helsinki in Finland named Linus Torvalds who had been using Minix, a non-free Unix-like system, began writing his own kernel. He started by developing device drivers and hard-drive access, and by September had a basic design that he called Version 0.01. This kernel, which is called Linux, was afterwards combined with the GNU system to produce a complete free operating system.
On October 5th, 1991, Torvalds sent a posting to the comp.os.minix newsgroup announcing the release of Version 0.02, a basic version that still needed Minix to operate, but which attracted considerable interest nevertheless. The kernel was then rapidly improved by Torvalds and a growing number of volunteers communicating over the Internet, and by December 19th a functional, stand-alone Unix-like Linux system was released as Version 0.11.
On January 5, 1992, Linux Version 0.12 was released, an improved, stable kernel. The next release was called Version 0.95, to reflect the fact that it was becoming a full-featured system. After that Linux became an underground phenomenon, with a growing group of distributed programmers that continue to debug, develop, and enhance the source code baseline to this day.
Torvalds released Version 0.11 under a freeware license of his own devising, but then released Version 0.12 under the well established GNU General Public License. More and more free software was developed for Linux over the next several years.
Linux continued to be improved through the 1990's, and started to be used in large-scale applications like web hosting, networking, and database serving, proving ready for production use. Version 2.2, a major update to the Linux kernel, was officially released in January 1999. By the year 2000, most computer companies supported Linux in one way or another, recognizing a common standard that could finally reunify the fractured world of the Unix Wars. The next major release was V2.4 in January 2001, providing (among other improvements) compatibility with the upcoming generations of Intel's 64-bit Itanium computer processors.
Although Torvalds continued to function as the Linux kernel release manager, he avoided work at any of the many companies involved with Linux in order to avoid showing favoritism to any particular organization, and instead went to work for a company called Transmeta and helped develop mobile computing solutions, and made his home at the Open Source Development Labs (OSDL)..
Advantages of Linux over other operating systems
The advantages of Linux that are often cited when comparing Linux with other operating systems:
1, Low cost: You don’t need to spend time and money to obtain licenses since Linux and much of its software come with the GNU General Public License.
2, Stability: Linux doesn’t need to be rebooted periodically to maintain performance levels.
3, Performance: Linux provides persistent high performance on workstations and on networks. It can handle unusually large numbers of users simultaneously.
4, Network friendliness: Linux was developed by a group of programmers over the Internet and has therefore strong support for network functionality
5, Flexibility: Linux can be used for high performance server applications, desktop applications, and embedded systems.
6, Compatibility: It runs all common Unix software packages and can process all common file formats.
7, Choice: The large number of Linux distributions gives you a choice. Each distribution is developed and supported by a different organization.
8, Fast and easy installation: Most Linux distributions come with user-friendly installation and setup programs.
9, Full use of hard disk: Linux continues work well even when the hard disk is almost full.
10, Multitasking: Linux is designed to do many things at the same time; e.g., a large printing job in the background won’t slow down your other work.
11, Security: Linux is one of the most secure operating systems. “Walls” and flexible file access permission systems prevent access by unwanted visitors or viruses. Linux users have to option to select and safely download software, free of charge, from online repositories containing thousands of high quality packages.
12, Open Source: If you develop software that requires knowledge or modification of the operating system code, Linux’s source code is at your fingertips.
Linux directories explanation
Root Filesystem
The contents of the root filesystem must be adequate to boot, restore, recover, and/or repair the system.
The following directories, or symbolic links to directories, are required in /.
==========================================================
Directory Description
bin Essential command binaries
boot Static files of the boot loader
dev device files
etc Host-specific system configuration
lib Essential shared libraries and kernel modules
media Mount point for removeable media
mnt Mount point for mounting a filesystem temporarily
opt Add-on application software packages
sbin Essential system binaries
srv Data for services provided by this system
tmp Temporary files
usr Secondary hierarchy
var Variable data
==========================================================
/bin : the bin directory contains several useful commands that are of use to both the system administrator as well as non-privileged user
/boot : for GRUB (GNU Grand Unified Bootloader). This directory contains everything required for the boot process.
/dev : the location of device files. In linux you have to remember that everything is a file or directory
/etc : contains all system related configuration files
/home : user home directories
/initrd : provides the capability to load a RAM disk by the bootloader this RAM disk can then be mounted as the root filesystem and programs can be run from it
/lib : contain kernel modules and those shared library
/lost+found : files that are recovered from crash or unproper shutdown are placed here
/media : this directory contains subdirectory which are used as mount points for removable media such as cdrom and flashdisk
/opt : reserve for all the software add-on packages that are not part of the default installation
/proc : this directory is special because it is also a virtual filesystem, it doesn’t contain real file but runtime system information (system memory, devices mounted, hardware configuration etc). It is also regarded as a control and information center for the kernel
/root : the home directory of the system administrator
/sbin : contain binaries essential for booting, restoring, recovering and/or repairing the system in addition to the binaries in /bin
/usr : contains all the user binaries their documentation, libraries, header files etc. This directory only contain read-only data
/var : contains variable data like system logging files
/srv : contains site-specific data which is served by the system
/tmp : this directory contains mostly files that are required temporarily.
Basic Linux Commands
eg:- mkdir vishnu
cd - change directories. Use cd to change directories.
eg:- cd /home/vishnu/test/
mv- used to move files or directories and also used to chage its name
eg:- mv test.txt /home/vishnu/example/
mv test.txt example.txt
pwd - print working directory or present working directory
eg:- pwd
/home/vishnu/test/example/
rmdir - Remove an existing directory
rm -rf
eg:- rmdir test
rm -rf test
chown - change file owner and group
eg:- chown vishnu.vishnu example.txt
chown vishnu. * -R
chown vishnu. example.txt
chgrp - change group
eg:- chgrp vishnu text.txt
chgrp vishnu example
chmod - change file access permissions
eg:- chmod 644 test.txt
chmod 777 example
usage;- chmod [ .. ] file/folder
u - User who owns the file.
g - Group that owns the file.
o - Other.
a - All.
r - Read the file.
w - Write or edit the file.
x - Execute or run the file as a program.
Numeric Permissions:
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
ls - Short listing of directory contents
eg:- ls
ls -la
usage:-
-a list hidden files
-d list the name of the current directory
-F show directories with a trailing '/'
executable files with a trailing '*'
-g show group ownership of file in long listing
-i print the inode number of each file
-l long listing giving details about files and directories
-R list all subdirectories encountered
-t sort by time modified instead of name
cp - Copy files
eg:- cp text.txt /vishnu/example/
cp -pr example /home/folders/
cal month year - Prints a calendar for the specified month of the specified year.
clear - Clears the terminal screen.(ctrl + l)
cmp file1 file2 - Compares two files, reporting all discrepancies. Similar to the diff command, though the output format differs.
diff file1 file2 - Compares two files, reporting all discrepancies. Similar to the cmp command, though the output format differs.
passwd - change password
Linux Filesystem Management
du :- disk usage
du -sh :- disk usage in human readable format
cat /proc/swap :- see swap details
free- free memory usage
cat /proc/meminfo :- get info about RAM in ur system
fdisk :- Used to fix or create partitions on a hard drive
mount :- Used to mount a filesystem.
umount :- Unmounts a filesystem
File compression, backing up and restoring
gunzip :- unzip - unzip a gz file.
gzip :-gzip - zip a file to a gz file.
tar :- Can store files on tapes.
Usage: tar -cvf - Archive copy groups of files
zip :-zip - make a zip file.
grep :- grep pattern filename
File editing and managing tools
emacs :-Full screen editor.
gitview :-A hexadecimal or ASC file viewer.
Head:- head linuxdoc.txt - Look at the first 10 lines of linuxdoc.txt.
Jed:- Editor
less :- Used to view files.
more :- Used to view files.
pico :-Simple text editor.
tail :-tail linuxdoc.txt - Look at the last 10 lines of linuxdoc.txt.
vi :-Editor with a command mode and text mode. Starts in command mode.
Vim :- advanced text editor
Linux Process management
kill :- To stop any process by PID i.e. to kill process
eg:- kill process id
killall :- To stop processes by name i.e. to kill process
eg:- killall firefox
ps -ag :- To get information about all running process
ps aux :- To display the owner of the processes along with the processes
top :- To see currently running processes and other information like memory and CPU usage with real time updates.
pstree :- To display a tree of processes
skill :- Report process status.
gitps :- a graphical process viewer and killer program
Linux Network Manangement.
finger :-Display information about the system users.
ifconfig :-Configure a network interface.
ifdown :-Shutdown a network interface.
ifup :-Brings a network interface up.
netconf :- A GUI interactive program to let you configure a network on Redhat systems.
netconfig :-Another GUI step by step network configuration program.
netstat :-Displays information about the systems network connections, including port connections, routing tables, and more. The command "netstar -r" will display the routing table.
nslookup :-Used to query DNS servers for information about hosts.
ping :-Send request packets to network hosts.
route :-Show or manipulate the IP routing table.
telnet :-User interface to the TELNET protocol, setting up a remote console session.
traceroute :-Print the route that packets take to the specified network host.
Directory Structure of Cpanel
Directory Structure of Cpanel
APACHE
/usr/local/apache/conf/httpd.conf - configuration file
bin - apache binaries are stored here - httpd, apachectl, apxs
conf - conf files - httpd.conf
cgi-bin
domlogs -log files are stored here
htdocs
include - header files
libexec - shared object (.so) files are stored here - libphp4.so,mod_rewrite.so
logs - apache logs - access_log, error_log, suexec_log
man - apache manual pages
Init Script :/etc/rc.d/init.d/httpd - apache start script Cpanel
script to restart apache - /scripts/restartsrv_apache
EXIM
Conf : /etc/exim.conf - exim main configuration file
/etc/localdomains - list of domains allowed to relay mail
Log : /var/log/exim_mainlog - incoming/outgoing mails are logged here
/var/log/exim_rejectlog - exim rejected mails are reported here
/var/log/exim_paniclog - exim errors are logged here
Mail queue: /var/spool/exim/input
Cpanel script to restart exim - /scripts/restartsrv_exim
Email forwarders and catchall address file - /etc/valiases/domainname.com
Email filters file - /etc/vfilters/domainname.com
POP user authentication file - /home/username/etc/domainname/passwd
catchall inbox - /home/username/mail/inbox
POP user inbox - /home/username/mail/domainname/popusername/inbox
POP user spambox - /home/username/mail/domainname/popusername/spam
Program : /usr/sbin/exim (suid - -rwsr-xr-x 1 root root )
Init Script: /etc/rc.d/init.d/exim
ProFTPD
Program :/usr/sbin/proftpd
Init Script :/etc/rc.d/init.d/proftpd
Conf: /etc/proftpd.conf
Log: /var/log/messages, /var/log/xferlog
FTP accounts file -/etc/proftpd/username - all ftp accounts for the domain are listed here
Pure-FTPD
Program : /usr/sbin/pure-ftpd
Init Script :/etc/rc.d/init.d/pure-ftpd
Conf: /etc/pure-ftpd.conf
Anonymous ftp document root - /etc/pure-ftpd/ip-address
FRONTPAGE EXTENSIONS
Program - (Install): /usr/local/frontpage/version5.0/bin/owsadm.exe
Uninstall and then install for re-installations
FP files are found as _vti-bin, _vti-pvt, _vti-cnf, vti-log inside the public_html
MYSQL
Program : /usr/bin/mysql
Init Script : /etc/rc.d/init.d/mysql
Conf : /etc/my.cnf, /root/.my.cnf
Data directory - /var/lib/mysql - Where all databases are stored.
Database naming convention - username_dbname (eg: john_sales)
Permissions on database - drwx 2 mysql mysql
Socket file -/var/lib/mysql/mysql.sock, /tmp/ mysql.sock
SSHD
Program :/usr/local/sbin/sshd
Init Script :/etc/rc.d/init.d/sshd
/etc/ssh/sshd_config
Log: /var/log/messages
Perl
Program :/usr/bin/perl
Directory :/usr/lib/perl5/5.6.1/
PHP
Program :/usr/local/bin/php, /usr/bin/php
ini file: /usr/local/lib/php.ini - apache must be restarted after any change to this file
php can be recomplied using /scripts/easyapache
Named(BIND)
Program: /usr/sbin/named
Init Script: /etc/rc.d/init.d/named
/etc/named.conf
db records:/var/named/
/var/log/messages
CPANEL INSTALLATION DIRECTORY STRUCTURE
/usr/local/cpanel
3rdparty/ - tools like fantastico, mailman files are located here
addons/ - AdvancedGuestBook, phpBB etc
base/ - phpmyadmin, squirrelmail, skins, webmail etc
bin/ - cpanel binaries
cgi-sys/ - cgi files like cgiemail, formmail.cgi, formmail.pl etc
logs/ - cpanel access log and error log
WHM related files
/var/cpanel - whm files
bandwidth/ - rrd files of domains
username.accts - reseller accounts are listed in this files
packages - hosting packages are listed here
root.accts - root owned domains are listed here
suspended - suspended accounts are listed here
users/ - cpanel user file - theme, bwlimit, addon, parked, sub-domains all are listed in this files
zonetemplates/ - dns zone template files are taken from here
COMMON CPANEL SCRIPTS
cpanel/whm Scripts are located in /scripts/
addns - add a dns zone
addfpmail - Add frontpage mail extensions to all domains without them
addfpmail2 - Add frontpage mail extensions to all domains without them
addnetmaskips - Add the netmask 255.255.255.0 to all IPs that have no netmask
addnobodygrp - Adds the gorup nobody and activates security
addpop - add a pop account
addservlets - Add JSP support to an account (requires tomcat)
addstatus - (Internal use never called by user)
adduser - Add a user to the system
bandwidth - (OLD)
betaexim - Installs the latest version of exim
biglogcheck - looks for logs nearing 2 gigabytes in size
bsdcryptoinstall - Installs crypto on FreeBSD
bsdldconfig - Configures the proper lib directories in FreeBSD
bsdpkgpingtest - Tests the connection speed for downloading FreeBSD packages
buildbsdexpect - Install expect on FreeBSD
builddomainaddr - (OLD)
buildeximconf - Rebuilds exim.conf
buildpostgrebsd-dev - Installs postgresql on FreeBSD.
chcpass - change cpanel passwords
easyapache - recompile/upgrade apache and/or php
exim4 - reinstall exim and fix permissions
fixcommonproblems - fixes most common problems
fixfrontpageperm - fixes permission issues with Front Page
fixmailman - fixes common mailman issues
fixnamed - fixes common named issues
fixndc - fixes rndc errors with named
fixquotas - fixes quota problems
fullhordereset - resets horde database to a fresh one - all previous user data are lost
initquotas - initializes quotas
installzendopt - installs zend optimizer
killacct - terminate an account - make sure you take a backup of the account first
mailperm - fixes permission problems with inboxes
park - to park a domain
pkgacct - used to backup an account
restartsrv - restart script for services
restorepkg - restores an account from a backup file ( pkgacct file)
runlogsnow - update logs of all users
runweblogs - update stats for a particular user
securetmp - secures /tmp partition with options nosuexec and nosuid
suspendacct - suspends an account
unsuspendacct - unsuspends a suspended account
upcp - updates cpanel to the latest version
updatenow - updates the cpanel scripts
updateuserdomains- updates userdomain entries
/etc/httpd/conf/httpd.conf - apache configuration file
/etc/exim.conf - mail server configuration file
/etc/named.conf - name server (named) configuration file
/etc/proftpd.conf - proftpd server configuration file
/etc/pure-ftpd.conf - pure-ftpd server configuration file
/etc/valiases/domainname - catchall and forwarders are set here
/etc/vfilters/domainname - email filters are set here
/etc/userdomains- all domains are listed here - addons, parked,subdomains along with their usernames
/etc/localdomains - exim related file - all domains should be listed here to be able to send mails
/var/cpanel/users/username - cpanel user file
/var/cpanel/cpanel.config - cpanel configuration file ( Tweak Settings )*
/etc/cpbackup-userskip.conf -
/etc/sysconfig/network - Networking Setup*
/etc/hosts -mapping of some hostnames to IP addresses before DNS can be referenced. This mapping is kept in the /etc/hosts file
/var/spool/exim - exim mailling logs
/var/spool/cron - cron job logs
/etc/resolv.conf - Networking Setup--> Resolver Configuration
/etc/nameserverips - Networking Setup--> Nameserver IPs ( FOr resellers to give their nameservers )
/var/cpanel/resellers - For addpkg, etc permissions for resellers.
/etc/chkserv.d - Main >> Service
Configuration >> Service Manager *
/var/run/chkservd - Main >> Server Status >> Service Status *
/var/log/dcpumon - top log process
/root/cpanel3-skel- skel directory. Eg: public_ftp, public_html. (Account Functions-->Skeleton Directory )*
/etc/wwwacct.conf - account creation defaults file in WHM (Basic cPanel/WHM Setup)*
/etc/cpupdate.conf - Update Config *
/etc/cpbackup.conf - Configure Backup*
/etc/clamav.conf - clamav (antivirus configuration file )
/etc/my.cnf - mysql configuration file
/usr/local/Zend/etc/php.ini
OR
/usr/local/lib/php.ini - php configuration file
/etc/ips - ip addresses on the server (except the shared ip) (IP Functions-->Show IP Address Usage )*
/etc/ipaddrpool - ip addresses which are free
/etc/ips.dnsmaster - name server ips
/var/cpanel/Counters - To get the counter of each users.
/var/cpanel/bandwidth - To get bandwith usage of domain