206694886-linux
TRANSCRIPT
-
RHCE (Red Hat Certified Engineer)
Linux is an open source operating system made by Linus Benedict Torvalds, a young man who was in second year of computer science at the University of Helsinki in 1991.
The Linux operating system is written in the C programming language. Linux is implementation of UNIX. Linux uses GNU tools, a set of freely available standard tools for handling
Linux Distribution :There are more than 100 Linux distributions (distribution Companies) some of them are:
Red Hat Debian Linux SUSE Linux Mandriva (former mandrake soft) Knoppix: an operating system that runs from your CD-ROM Slack ware Linux Ubuntu Linux: an OS that runs from CDROM (Live) and Hard Drive. Topology: Designed to run on top of Microsoft Windows does not need any
partition changes Flash Linux: A distribution that can fit onto a 256 MB USB flash drive Corel Linux, etc for more information about distribution visit:
http://en.wikipedia.org/wiki/list_of_Linux_distributions
Red Hat Linux 9.0Red Hat Linux is the production of Red Hat company which has stopped producing it on April 30, 2004 the Red Hat company now produces two editions one fedora Core which is free, And second Red Hat Enterprise Linux (RHEL) which is for business purpose.
1
-
RHCE (Red Hat Certified Engineer)
Red Hat Linux 9.0 Hardware Requirements:
Text Mode Graphical ModeRAM (Min) 64 MBs 128 MBsRAM (Rec) 192 MBsProcessor (Rec) 200 MHz (Pentium
class)400 MHz (Pentium 2)
Impartation Disk Space
4GB
Linux Modes: Text or CLI (command Lin Interface) GUI (Graphical User interface)
GUI Modes: KDE GNOME
CLI Modes C Shell Bash (Default) Borne K Shell
Linux Installation Modes
Text (CLI) Mode installation (from three CDs) Graphical (GUI) mode installation (from three CDs)
2
-
RHCE (Red Hat Certified Engineer)
Through FTP installation Through HTTP installation
Red Hat Linux Has three installation CDs which includes all software Built-in E.g. proxy server, SQL server, DHCP, DNS, Mail server. Open office .org.etc
Linux file system (comparison with Windows):Windows Linux
FAT 16 Ext2 (not in use now) FAT32 Ext3 (current file system) NTFS
Boot Loaders:Boot loader is used operating system selectionBoot loader is stored in MBR in the Hard DriveLinux has two boot Loaders
Grub Boot loader Lilo Boot Loader
Windows has one boot loader. Windows has one boot loader
When we install windows It formats the MBR and remove every thing in it and Linux doesnt format the MBR it adds it Boot Loader there.Therefore we should first install windows then Linux.
Partition:Partition layout and types:There are two kinds of major partitions on a Linux system:
Data partition : normal Linux system data. Including the boot partition containing al the data to start up and run the system
Swap partition: Expansion of the computer s physical memory . extra memory on hard disk.
Partition Methods:During the installation of Red Hat Linux you will be asked to start which partition method.
Automatic: Manual ( through disk druid)
3
-
RHCE (Red Hat Certified Engineer)
Automatic: this will remove all data on your hard drive and will partition your hard drive . if you are selection this method be sure you have no saved data.
Manual (disk druid): disk druid is software which is used for manually partition.
Hard Drive C: D: Un partition space 4000MBs( depend
upon the packages and users data)
Partitions:Name space Description
/ 3000MBs (80% space) Root directory ( Drive C)/boot 100 MBs Main directory ( Windows folder)/home 500MBs(depend upon users data Users data and users Disk Quotaswap Twice of RAM Virtual Memory
Red Hat Linux 9.0 installation steps
1. Insert CD 12. Boot from CD3. A text mode will come press the enter button to start graphical mode
installation. To start text mode installation. Write Linux text and press Enter button.
4. Click ok button of you want to check CDs of dont click on skip to cancel CDs check.
5. Click on the next button or press f126. Select Language 7. Next8. Select Keyboard9. Next10.Select Mouse11.Next 12.Select custom Box13.Next14.Select manually partition with disk druid15.Next 16.partitioning: Select free space at the top click on new select / in the
mount point enter size for it e.g.3000 MBs click on ok click on ok click on continue save procedure for / boot and /home for swap select free space
4
-
RHCE (Red Hat Certified Engineer)
at the top click on new select swap in the file system type field enter size for swap Ok. Partitions are made!
17.Next18.Next19.Next20.select no firewall at the top21.Next22.select language 23.next 24.select time setting 25.Next26.Enter password for root Account ( Administrator Account )27.Next28.Next29.Next30.Select required software (or select first tow packages and uncheck all
others below)31.Next32.Next33.Installation will be started and required CDs will be asked.34.Installation is completed!
Linux TerminalsLinux is a multi user operating system therefore it has seven terminals so we can logon to a Linux machine through seven users accounts at a time Six of them can login to Text (CLI)Mode and one can login to Graphical (GLI) mode.
Terminal = users logon Area
Multi users OS
7 Terminals6= Text (CLI) mode1= Graphical (GUI) mode
5
Linux
-
RHCE (Red Hat Certified Engineer)
We can change terminal by pressing Alt+Ctrl+f1, f2.f3.f4, f5, f6,f7Alt+Ctrl+f1Alt+Ctrl+f2Alt+Ctrl+f3Alt+Ctrl+f4Alt+Ctrl+f5Alt+Ctrl+f6 Text (CLI) modeAlt+Ctrl+f7 Graphical (GUI) Mode
Linux Directory StructureNo Name Description1 /Boot The directory where the operating system boots from2 /root The administrative users home directory3 /home Contains the home directories of normal users users
disk quota4 /bin Contains executable programs5 /sbin Contains executable programs6 /dev Contains drivers for hardware devices
7 /etc Contains important configuration files of several program
8 /var Storage for variable files and temporary files created by users, such as log files the mail queue, the print spooler area space for temporary files downloaded from the internet, or to keep an image of a CD before burning it.
9 /lib Contains dynamic library modules10 /proc Contains information about system resources11 /mnt You can access CD-ROM, Floppy, windows
drives, flash drives Digital camera drive and network drive here.
12 /tmp Contains temporary files 13 /user Program libraries, documentation etc. file all user-
related program.14 /opt A partition for third party and extra sotware
Linux Basic CommandsShutdown
CommandInit 0 Shutdown the system
6
-
RHCE (Red Hat Certified Engineer)
Halt Shutdown the systemShutdown_-h_now Shutdown the system nowShutdown_-h_5 Shutdown the system in 5 minutes
Restart
Command DescriptionInit 6 Shutdown the systemReboot Shutdown the systemAlt+Ctrl+Del Shutdown the systemShutdown_-r_5 Shutdown the system in 5 minutes
LogoffCommand DescriptionExit Logout the current userLogout Logout the current userCtrl+d Logout the current user
Clear screenCommand DescriptionClear Clear the screen Ctrl+l(L) Clear the screen
FindCommand DescriptionFind/-name fname Search for file named fname in /directory Find /-name*book*
Search for file containing text bookin/directory
Grep book/root Search for file containing the specified text in text /root directory
File /Directory BasicsCommand DescriptionMkdir name Makes a folder (directory)Touch name Creates a fileTouch .fname Creates a hidden fileRmdir name Remove an empty folder (directory)Rm name Removes a file or an empty folder (directory)Rm-rname Removes a file or an full folder (directory)with
confirmation Rm-rf name Removes a file or an full folder (directory)without
confirmationMore name Opens the file read-only mode page by pageCat name Opens the file in read only mode
7
-
RHCE (Red Hat Certified Engineer)
Cp fname/home Copy file named fname to /home directoryCp fname / home/a Copy file named fname to/homedirectory with new
name aCp fname fnamel Copy file named fnameto the same directory with new
fnamelCp-r fname /home Copy folder named fname to /home directoryMv fname/home Cut file or folder named fname to /home directoryMv fname linux Rename file or folder named fname to linuxIs Shows the contents of the current directory with out
hidden files colors:White=file, Blue= folder, Green =full permission. Red =compressed files.
Is a Shows hidden files within the current directory Is F Shows the contents of the current directory with files
typesIs-1 Shows files and directories with permissionsPwd It show present working directoryCd.. Change directory one step backCal Show calendar of the month Cal 2007 more Show calendar of the year page by page Cd/home Go to /home directory
General CommandsCommand Description
Date It show present date and timeUsers It shows current logged in usersWho Shows current userwhoami Shows all logged in usershistory Shows 1000 previously used commandsHistory-c Clears historyMan command Shows help about the specified commandCommand-help Shows a short help about the specified commandStartx Starts x window systemupdated Update the database of files on all file
System attached to the Linux root directoryXterm When you run this command at graphical terminal. It
opens the black & white terminal
Mounting & Unmounting DrivesMounting & Unmounting CDROM Drive
8
-
RHCE (Red Hat Certified Engineer)
Command DescriptionMount/mnt/cdrom or mount/dev/cdrom/mnt/cdrom
Mounts CD-ROM Drive
Mount/mnt/cdrom1 ORMount/mnt/cdrom1/mnt/cdrom1
Mounts secondary CD-ROM drive
Unmount /mnt/cdrom, umount/mnt/cdrom1 Unmounts CD-ROM Drive Eject or eject t/dev/cdrom, eject/mnt/cdrom,eject cdrom
Ejects CD-ROM
Eject t or eject t/dev/cdrom,Eject-t/mnt/cdrom,eject t cdrom
Close CD-ROM tray
Usermount Launches a graphical application for mounting
Note: you can use cdrom1,2, and 3 instead of CDrom in the commands for secondary and other CD-ROM drives.
Mounting & Unmounting Floppy DriveCommand DescriptionMount/mnt/floppy orMount/dev/fdo/mnt/floppyMount/mnt/floppy
Mounts floppy driveFdo (for drive A)Fd1 (for drive B:)
Umount/mnt/floppy Unmounts floppy drive
Mounting & Unmounting USB driveCommand DescriptionCd/mntMkdir flash
Create a directory in/mnt directory
mount/dev/sda or sdal/mnt/flash Mount USB drive to / mnt/flash directoryUnmount/dev/sda or sdal Unmounts USB drive
Note. If the USB drive (flash drive. Digital camera drive .etc) is in USB pot 1 mount it through sda. If the it is in port 2 mount it through sda 1.
Mounting &Unmounting Windows FAT drivesCommand DescriptionCd/mnt Mkdir cdrive Create a directory in/mnt directoryFdisk-1 Shows file system listMount/dev/hdc1/mnt/cdrive Mount hdc1 to/mnt/cdrive directoryUnmount/dev/hdc1 Unmounts hdc1
9
-
RHCE (Red Hat Certified Engineer)
Note. Hdc1 contrary on the drive you want to mount. It might be hdc2 for drive D. you can see the file system list for information
AutomountIf you want you Linux O/S to automatically mount your windows FAT drive so do the following open /etc/fstab file and write the first command at the end or the file/dev/hdc1 /mnt/c auto defaults 11/dev/cdrom / mnt/cdrom auto defaults 11To amount cdrom use the second command.
VI EditorThis is one of the LINUX standard text editors the text editors work as windows notepad There are three text editors in Linux:
VI Vim: this stands for VI improved, it is VI but with an X interface. It is still
powerful but menus, ICON and buttons make it easier to use. Emacs: this editor has become a standard next to VI it is also very complex
but has a X interface so it is easier to learn it can browser the web send and check e-mail
Vi editor commandsCommand Description
Vi abc To create and open a new file in vi editor or to edit in a created file/
I To go to insert mode (editing mode)ESC To quite insert mode.X Click under the character and press x to delete it.4 x Lines x to delete specified letters. I.e . 4 xDw Lines x to delete a complete word.4 dw Lines dw to delete specified word I.e.4 wDd To delete a complete line4 dd Lines dd to delecte specified lines .I.e.4ddDe To delete the coming text of the word/linux To search forward?linux To search backwardN To search againCtrl+g Show the name of current file being edited
10
-
RHCE (Red Hat Certified Engineer)
ggVG Select allU To Undo4 shift +g Line number shift+g to go the specified line.I.e.4 shift+gYy Lines yy to copy current line4 yy Lines yy to copy specified lines I.e.4yyP To paste copied lines:wq To save and exit:w Saves the file:q! To exit the file without saving
User Account & group Management User accounts & group types
Super user account & group (Built in user Account & groups) Non built-in user accounts & groups System user account & group
Super user accounts & groupsSuper user account & groups are those which are automatically created.
Root = Administrator Nobody = Guest
Non Built-in user accounts & GroupsNon built in user accounts & groups are those which we manually create I.e.ali, Ahmad
System user accounts & GroupsSystem user accounts & groups are those which are automatically generated with installation of different services
RIDs User accounts & Groups RIDsRoot 0Nobody 99System user accounts 1-499Non built-in user accounts 500-65,000
Users and groups files11
-
RHCE (Red Hat Certified Engineer)
File Description/etc/passwd Shows all created users with their RIDs/etc/shadow Shows all created users with encrypted passwords/etc/group Shows all created groups with their RIDs/etc/skel This is like the all users folder in windows
When you open/etc/passwd file the user record will be save as the following:Ali:x:500:comment:/home/ali:bin:bashAli=U/A,X=password exist, 500 = UID, 500 = GID, comment, /home/ali=profile, To remove a user password just remove the x from user record
User account & group commands Command DescriptionUseradd ahmad Creates user named ahmad.
When an user is created it creates a group with the same name and member the user of the group
Passwd ahmad To give password to user named ahmadPasswd To change password of current logged in user.
Userdel ahmad Deletes user named ahmadUsermod-1 ali ahmad L (login)
Deletes user named ahmad
Groupadd abc Creates group named abcGroupdel abc Deletes group named abcUseradd-g root abc Creates user named abc and make it member of
root and nobody groups Usermod-g root abc Moves user named abc to root groupUsermod-G root,nobody abc Moves user named abc to root and nobody
groupsGroups abc Show user s group membershipPasswd-1 zabeeh To lock a usern account Passwd- u zabeeh To unlock an user account
User Disk QuotaUser disk quota is used to set a limited amount of disk to user.
12
-
RHCE (Red Hat Certified Engineer)
Disk quota is divided into tow parts: Hard Quota Soft Quota
Hard disk Quota is used to set a limited amount of Disk to a userDisk quota is divided into two parts:
Hard Quota Soft Quota
Hard Quota Hard quota is limited and can not be exceeded
Soft quotaLimited, but can be exceeded
Steps for setting disk Quota 1. open th fstab file vi/etc/fstab2. write,usrquota near defaults:
LABEL=/home /home ext3 defults, usrquota 3. Go to /home directory and created a file name aquota.user. #CD/home
#touch aquota.user = file where the quota information will be saved in encrypted form
4. mount-o rmount/home = refresh information in fsttab 5. Qoutacheck-auv = scan and updates quota set on users 6. edquota-u ahmad =To set Hard or soft quota on user a 7. edquota-t = To set grace time Executed with the command edquto-f.grace period is a time limit before the soft limit is enforced for a file system with quota enabled time units of sec(onds), min(utes), hour(s), day(s), week(s), and month (s) can be used to set grace time write time, min or time minutes under the grace E.g. 1,min.10. minutes 8. quotaon- auv = To turn on disk Quota
Quotaoff auv = To turn off disk Quota.Repquota a = Show report about Disk QuotaQuota = When a user is logged on the quota Command shows the current user disk quota limit, used disk quota by user and grace time.
Red Had Package Management Command Description
13
-
RHCE (Red Hat Certified Engineer)
Rpm ivh packagename.rpm To install the packageRpm ivh nodeps package.rpm
Dont do a dependency check before installing
Rpm-ivh oldpackage name.rpm
Allow an upgrade to replace a newer package with an older one
Rpm Uvh oldpackage name.rpm
To upgrade the package
Rpm-qa Show all installed packagesRpm qa gzip Check package whether installed or not Rpm-qa grep zip Show packages contains zipRpm-qa-list Show all installed packages (order by last
installed package)Rpm-qs kudzu Display the states of file in the package the
state of each file is one of normal, not installed or replaced.
Rpm-qi zip To show information about the package Rpm ql gzip Show all installed filesRpm qd bzip2 Show document file Rpm qc named Show configuration fileRpm e kudzu To remove the packageRpm enodeps kudzu To remove the package by forexe
Note: .rpm (Red Hat package manager) is the Binary package in Red Hat Linux
Packaging and compressionPackaging software
Tar Zip(both package and compress the file)
Compression software Gzip Bzip2 Zip(both package and compress the file)
Packaging14
-
RHCE (Red Hat Certified Engineer)
Command DescriptionTar cvf abc,tar 1 2 3 4 5 6 Package files named 1 2 3 4 5 6 in abc.tarTar tvf abc.tar View contents of the file named abc.tar
If we want to use gzip and bzip2 compression the files first should be packaged using tar.
Gzip compression command DescriptionGzip.abc.tar Compress the package named abc.tar using gzipBunzip2 ac.tar.gz Uncompress the file named abc.tar.gz
Bzip2 compression Command DescriptionBzip2 abc.tar Compress the package name abc.tar using bzip2Bunzip abc.tar.gz Uncompress the file named abc.tar.bz2
zip packaging and compression Command DescriptionZip xyz.zip 1 2 3 4 5 6 Compress and package the file named 1 2 3 4 5 6
with a name xyz zip software Unzip xyz.zip Uncompress the file named xyz.zip
Size checking Command DescriptionDu khan shows size of file or directory named khanDu-h khanDisk usage
Shows size of file or directory named khan on KBs, MBs, GBs
Du h /bin Show size of /bin directory on KBs, MBs, GBsDf h / home Disk free
Show fie system, total. Used and free space of /home directory
Run LevelsThere are 7 run levels in Linux
Run levels Description/etc/rc.d/init 0 Shutdown mode/etc/rc.d/init 1 Single user mode (password recovery ,etc)/etc/rc.d/init 2 Text mode without networking/etc/rc.d/init 3 Text mode with networking/etc/rc.d/init 4 Undefined (empty)/etc/rc.d/init 5 GUI mode/etc/rc.d/init 6 Reboot mode
15
-
RHCE (Red Hat Certified Engineer)
Each of them could be accessed from CLI mode by writing simply initor complete line/etc/rc.d/init 0.
When we start the Linux it starts the GUI mode automatically if you want to change it to CLI mode. Open/etc/inittab file and search for id:5: initdefault and then change the 5 to 3 to start CLI mode automatically.
Services ManagementManaging services
Command DescriptionChkconfig list more show service disabled or enable in modesChkconfig list grep kudzu Shows specific service Chkconfigkudzu on On service in all modesChkconfig kudzu off Off service in all modesChkconfig level 35 kudzu on
On the service in specific modes (Run Levels)
Chkconfiglevel 35 kudzu off
Off the service in specific modes (Run Levels)
Service network start /stop/restart
Start stop or restart a service in the current mode temporarily
/etc/init.d/kudzu start /stop/restart
Start stop or restart a service in the current mode temporarily
Single User ModeSingle user mode is used when a service causes starting the O/S and you want to stop the service or recovery your roots password .etc
If the Bind service causes to start the O/S turn it off as the following:#chkconfig named off
Password recovery If you lost your root account password you can recovery it through the following way.
1. start the computer select Red Hat Linux in grub and press E 2. Select second line (kernel/) and press E again3. press the space button and write single the press the enter button and press
B to boot into single user mode (init2)4. when the single user mode starts write passwd press the enter button and
write new password and confirm password Sh-2.05# passwd
16
-
RHCE (Red Hat Certified Engineer)
The password has been recovery!
Process Management (Ps and Kill Commands)Command DescriptionTop Shows all running tasks live with PID,Memory
usage ,CPU usage etcCtrl+c to close it
ps Show a snapshot current terminal s processespstree Show a snapshot all terminals processes with a
tree shape Ps -aux Show a snapshot all terminals processes with user
PID memory usage, CPU usage. Process name etcKill 3190 To stop the 3190 process (end task)Kill q 3219 To stop the 3219 process immediately
Network Commands Command Descriptionnetconfig to assign the primary IP to the PCNetconfig - - device eth0: 1,2, etc To assign more IPs to the computer/etc/init.d/network start /stop/restart
The stacdard command for start, stop or restarting a service
Ifconfig Show own IP addressIfconfig eth0 10.0.0.1 network 255.0.0.0 up
To assign the primary IP to the PC and start the network service
Ping 10.0.0.2 To ping a computerIfdown/up eth0 To disable or enable the LAN cardIfdown eth0:1,2, etc To disable secondary IPs/etc/sysconfig/network-scripts/iffg eth0
The IP, sudnet mask and gateway are save here
/etc/resolv. conf Contains DNS information/etc/hosts The hostname. FQDN, and IP of the PC
are changed from herehostname Show current hostnameHostname corvit To change the hostname
17
-
RHCE (Red Hat Certified Engineer)
nslookup To check DNS serverTraceroute www.yahoo.com Shows IP of the yahoo websiteNetstat an Shows Ports and IPs
Source compilationRed Hat for the first time created executable packages called.rpm file as the .exe of windows most of the software doesnt come in this type executable file .you will find most of the Linux software in source code(C or C++ code)compiling source is called source compilation Compiling source code has three steps.
RequirementsGcc Glibc-develGcc-c++Libstdc++-devel
make kernel-headers
CompilationSource code comes with a compressed package so uncompress the package and then go to the uncompressed directory and follow the bellow commands.
Running Configure
Most of the packages comes with a configure script which checks if the program can be compiled on the current system if an thing is missing it will inform you about that. You can run this script by typing the following command in the directory of a source code.
#./configure (takes a few minutes)
Running makeIf the configure script was successful you can go ahead by typing the make command in the source codes directory for compiling the code.
#make (takes a few minutes)#make install (takes a few minutes)
18
-
RHCE (Red Hat Certified Engineer)
for uninstalling the program go to the source codes folder and write the following command.#make uninstall (takes a few minutes)
Files and Folders Permission Numerical Method Read = 4Write = 2Execute = 1To give full permission add all of the them. E.g. 4+2+1=7
To show file type and permissions set on users. Use is l #is -1
Owner Same Group Users
D rwx rwx rwx
File type other users
To set permission on a file or folder use chmod command. Others
#chmod 7 5 5 file or folder
Owner Group4+2+1=7 means full permission. 4+1=5 means the write and executes permissions.
Symbolic MethodRead = rWrite = wExecute = xTo set full permission write all together .E.g. rwx
19
-
RHCE (Red Hat Certified Engineer)
Owner = oOther users = uGroup = g
To set permission on a file folder use chmod command.To set permission on can be o u.
#chmod g+rwx file or folder Full permission#chmod +x file or folder
Can be r wMake the file or folder executable to all users.
Ownership
To take or give ownership of a file or folder to a user we use the following commandThe user to which you want to give ownership of the file or folder.
#chown ali:guest fileorfolder
A group to which you want to give ownership too.
If you don't specify group the ownership will be given to the specified user and the group which the user is member of.#clown ali fileorfolder
User account (password) policiesThe password policies could be accessed in the below files./etc/login.defs
There are four password policies:PASS_MAX_DAYSPASS_MIN_DAYSPASS_MIN_LENPASS_WARN_AGE
20
-
RHCE (Red Hat Certified Engineer)
PASS_MAX_DAYS= Maximum password age.PASS_MIN_DAYS= Minimum days allowed between password changes,PASS_MIN_LEN= Minimum password length to be accepted.PASS_WARN_AGE=number of days when the OS starts warning before a password expires.
VSFTP (Very Secured File Transfer Protocol)VSFTP is the FTP server of Linux.
PackageVsftpd.rpmThe package is in CD3
Configuration File/etc/vsftpd.confIt contains all configuration of VSFTPD
Default file storage Location/var/ftpThis is the default location for FTP file storage.
Steps for installation & configuration1. insert CD3 and install VSFTPD.rpm packages2. Go to/var/ftp and put files 3. Start FTP service
#service vsftpd startTo start the vsftpd service temporarily
#chkconfig vsftpd on When computer start the vsftpd service automatically starts.
Accessing FTP
21
-
RHCE (Red Hat Certified Engineer)
To access FTP server go to explorer in Linux or either in windows machine and write.ftp://ip of ftp servere.g. ftp://10.0.0.1
Linux software RouterThe software to router is used for joining different subnets
Configuration1. Assign IPs from every subnet to the computer2. Open the configuration file. #vi/etc/sysctl.conf and change the zero to one
net.ipv4_forward= 0 13. If you want to prevent restarting the PC to take effect. Then open another
configuration file #vi/proc/sys/net/ip_forward and change the zero to one.4. On client sides give the IP of server of same range as the client in getway.
22
-
RHCE (Red Hat Certified Engineer)
Samba serverSamba server is used for Linux to windows files and hardware sharing
PackagesSamba...rpmSamba-commonrpmSamba-clientrpmThe packages are in CD 1
Configuration file /etc/samba/smb.conf
Steps for installation & Configuration1. insert CD 1 and install Samba packages sambarpm, samba-common
rpm, samba-clientrpm2. Open the configuration file and configure the samba as following:
#vi/etc/samb/samb.conf
23
Work group=workgroup
#search for security and change user shareSecurity=share
#search for [tmp]; [tmp] ; Path = /tmp ; read only = no ; public = yes
#remove all semicolons from tmp and below text#the tmp directory has been shared. Now when you put a folder in the tmp directory it will be shared.
To share CDROM and floppy just search for mnt.and remove the semicolons.
To share your own folder from a specific location:[Pc] #share name Path =/home/pc #location of the folder Read only= no # not read-only Public =yes # allowed to everyone Writable-yes #writes permission#Remember: a folder in the root directory cannot be shared.
#save the file :wq
-
RHCE (Red Hat Certified Engineer)
3. Start the Samba service. #service smb start4. accessing Linux shared folders from windows
Run> \\10.0.0.1 #IP of Linux machine 5. Accessing windowsip-U administrator # show windows sharing enter password of the
Administrator account#sumclient //windowsip/folder-U administrator #Open shared folder enter
password of The administrator account
NFS (Network file system)
NFS server is used for Linux to Linux files and Hardware sharing.
PackagesNfs-utilsrpmRedhat-config-nfsrpm(for GUI Mode)The packages are in CD 1
Configuration file/etc/exports
Steps for installation & configurationInsert CD 1 and install NFS packages nfs-utilsrpm and redhat-config-nfsrpm
3. Open the configuration file and configure the NFS as following: #vi/etc/exports
24
For sharing CDROM and Floppy:/mnt/cdrom 10.0.0.0/8 (ro)/mnt/floppy 10.0.0.0/8 (rw)10.0.0.0/8 the network IP for which the share is allowed /8 is prefix Mask means the network Bits in class A. /16 for class B. /24 for class c.(rw) read and write permissions.(ro) read only permission
For sharing a specific folder /tmp/info 10.0.0.0/8 (rw)/home/info 10.0.0.1/8 (ro) #the share is available to the specific IP only
Remember: if you don not specify the IP class or specific IP share will be available to every one. And a folder in the root directory cannot be shared
#save the file:wq
-
RHCE (Red Hat Certified Engineer)
2. Start the NFS service. #service nfs start
3. Start the NFS service on client. #service nfs strat 4. accessing others sharing #showmount e 10.0.0.1 #shows sharing of 10.0.0.1 #mount t nfs 10.0.0.1:/mnt/cdrom ahmad #mount (map) remote CDROM to folder named ahmad #umount 10.0.0.1:/mnt/cdrom #unmounts the remote CDROM #mount 10.0.0.1:/tmp/info aa #mounts (map) remote folder to aa
DNS (Bind) (Domain Name System) GULDNS is a very well known protocol. It is used for resolving Hostnames and Domain names to IP addresses
PackagesBind-utiles-9.rpmBind-9.rpmRedhat-config-bind.rpmThe first three packages are in CD 1 and the Last package is in CD2
Configuration file File Description/etc/resolv.conf Setting files for client/etc/named.conf Setting files for DNS server
Step for installation & configuration 25
-
RHCE (Red Hat Certified Engineer)
1. Install Bind (DNS) packages2. Set IP to your computer. E.g. 192.168.0.13. Change computer name.
#hostname LinuxThe open this file;/etc/hosts".Write IP, FQDN and Hostname of your computerIP"192.168.0.1" FQDB "Linux.redhat.com" Hostname "Linux"
4. Configuration DNS (Bind) can be configured both from text mode and Graphical mode we are going to configure it from Graphical mode.
1. Click on Red Hat Main menu and select system settings. Select server settings click on Domain name service
2. Or Run> bindconf
Marking Forward Lookup Zone (forward Master Zone)1. Click on the new button2. Select master lookup Zone and write the zone name"redhat.com" and click
ok3. In SOA field write "@" and click edit4. click add in name server field and write the hostname "Linux"5. Click OK and again click OK 6. Click Add go to host tab write hostname in host field and IP Address in
Address field. Host name "Linux" .IP address "192.168.0.1". and click OK
7. Click add go to Alias tab and write Alias "www" then write hostname in second field "Linux"
8. Click OK and again click OK
Marking reverse Lookup Zone ( Reverse Master Zone)1. Click on the new button. Select reverse master zone write three
octets of IP"192.168.0" click OK2. In SOA field write"@"3. Click add in servers field writer the Hostname "Linux" and Click
OK 4. Click Add in reverse address table field write FQDN and IP address
FQDN "Linux.redhat.com" IP address "192.168.0.1" 5. Click Ok and again Click OK6. Click Save to save the DNS configuration and Close the Window6. Start the DNS service #service named start#chkconfig named on
26
-
RHCE (Red Hat Certified Engineer)
7. Checking DNSDNS could be checked through several commands the best the dig .
#nslookup >www.linux.com or IP Write "nsloolup" and then write the FQDN or IP #dig www.linux .com #host www.linux.com or IP
DHCP Server (Dynamic Host Configuration Protocol)DHCP allows bosts on a TCP/IP network to request and be assigned IP addresses, and also to discover information about the network to which they are attached
PackageDhcp-3rpmThe package is in CD2
Configuration file/etc/dhcpd.conf
We will created the configuration file it wouldn't be available before we create it /usr/share/docs/dhcp-3.0p11/dhcpd.conf.sampleIs the ready made DHCP configuration file
Step for installation & Configuration1. insert CD 2 and install dhcp-3. Rpm packages:2. Open configuration file and configuration the DHCP server with the
following Code3. #vi/etc/dhcpd.conf
27
Dns-update-style interim; Ignore client updates; Subnet 10.0.0.0 netmask 255.0.0.0 { #Optional Option routers 10.0.0.1; Option domain-name-server 10.0.0.1 Option subnet-mask 255.255.255.0 Option domain-name-server "saifkhan.com" #Range Defining Range dynamic-bootp 10.0.0.2 10.0.0.100; Default-lease-time 21600; Max-less-time 43200;
#reservation Host max{
# Client MAC address Hardware Ethernet 00:11:05:80:f4:3T Fixed-address 10.0.02 } }
# Save the File : Wq
-
RHCE (Red Hat Certified Engineer)
4. Start the DHCP service #service DHCPD start #chkconfig service dhcpd on
To check the list of assigned IPs by DHCP# vi/var/lib/dhcp/dhcp.leases
Samba PDC (Primary Domain Controller)Samba PDC is used for to windows client/server (Linux as server and windows as client of Linux).
28
-
RHCE (Red Hat Certified Engineer)
PackagesSambarpmSamba.-commonrpmSamba-client rpmThe packages are in CD 1
Configuration File /etc/samba/smb.comf
Step for installation & configuration 1.Insert CD 1 and install samba packages samba . Rpm, samba- common rpm, samba-client .rpm2.Open the configuration file and configure the samba as following: #vi/etc/samba/smb.conf
29
Workgroup = pc.com# write the name of Domain in front of workgroup Netbios name = pc # write nebios name= netbios name
# search for encrypted and change no to yesEncrypted password = yes
# Search for security and ensure it is userSecurity =user
# Search for local master and change no to yesLocal master = yes
# Search for domain master and change no to yes Domain master = yes
# Search for preferred master and change no to yesPreferred master =yes
# Search for so and change it to 255So level =255
# Search for domain logon and change no to yes Domain logon = yes
# Search for [netlogon] ;[netlogon] ;EXAMPLE ;EXAMPLE ;EXAMPLE ;EXAMPLE
#Remove all semicolons from Netlogon and below text
// Search for [rmp];[tmp] ;EXAMPLE ;EXAMPLE ;EXAMPLE ;EXAMPLE #removes all semicolons from tmp and below text # Save the file :wq
-
RHCE (Red Hat Certified Engineer)
3. Start the samba service. #service smb start4. Registering Windows client on Linux machine #useradd pc2$ =client computer name with a $ sign #smbpasswd-am pc1 = client PC account without $ sign
5. Changing Local Root to Domain root #smdpasswd a root Then enter the new password for domain root account
6. Creating Domain Users #useradd zabeeh #smbpasswd a zabeeh Enter the password
7. Update the database #updated b
8. Make the windows machine member of Linux Domain and restart the PC Windows is now client of Linux domain, but you can't login as Linux user.9. Allow login on windows client
30
-
RHCE (Red Hat Certified Engineer)
Run>regedit> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\service\netlogn \parameters
Open the string Value named requiresignorseal and change the 1 to 0click
OK
Now you can login As Linux User! Apache Web ServerApache web server is used for hosting web sites within a LAN as well on the internet
PackagesHttpd-2 rpmThe package is in CD1
Configuration file/etc/httpd/conf/httpd.conf
Steps for installation & configuration 6. insert CD 1 and install Apache package httpd-2 rpm 7. Assign different IPs to the computer for Virtual and IP based Hosting. 8. Change the computer Name. #hostname pc1 open the following file and write IP, Hostname and FQDN. #vi/etc/hosts 9. put or create the web sites in following location. /var/www/html To vreate an Html file write #vi index.html 10. Open the configuration file and configure the Apache as following: #vi/etc/httpd/conf/httpd.conf
31
-
RHCE (Red Hat Certified Engineer)
32
Search for 80. Go to the start of the line and remove #. Then remove localhost.localdomain. write your system FQDN for example www.pc1.com:80
Go to the end of the file to add entries
Virtual Hosting Name virtual host 10.0.0.2
Server name www.yahoo.comDocument Root "/var/www/html/yahoo"
,Name Virtual Host 10.0.0.2
IP Based hosting Name virtual host 10.0.0.3 # It can be accessed by both IP and name
Server Name www.Linux.o.gDocument root "/var/www/html/Linux"
#save the file
Hosting FTP on Apache Web serverAfter installing and configuration FTP open the apache configuration file
Name virtual host 10.0.0.2
Server name freshrpns.netDocument root "/var/ftp"
#save the file
Add DNS entry fro FTP Site.The FTP site could be accessed as:FTP://freshrpm.net
-
RHCE (Red Hat Certified Engineer)
6. DNS Configuration Open DNS and configuration the DNS normal. Add forward Master zone for each sit. In zone name write site name.i.e urf.net7. Start the Apache and DNS services #service named start #DNS#service hrrpd start # apache The sites are now accessible on the network!
Installing new hardwareTo install a new hardware we use the kudzu command the hardware like USB are automatically detected no installation is needed for themFor installation of a new device use the following command#kudzuAnd then select the configure button
For mouse and printer configuration use the #setup command.For device information in gnome go start +system tools+ hardware browser
33