Linux Admin
Linux Admin
Linux Admin
4. You will now be presented with a CD Check, I always skip this step I live life on the edge when
it comes to media checking on Linux installs. However you might want to check the media.
5. You will now see some black and white text on your screen as your computer loads the
X11 environment for the CentOS install, after 30 seconds or so you will be presented with the
Page No | 1
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
6. Select your Language, I am British (please no jokes about drinking tea on Twitter) so I would
select English (English).
Page No | 2
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
8. Storage type, as I am installing on my local hard drive I selected Basic storage type if you are
using iSCSI or similar technology now would be the time to set it up.
9. As this is a clean install and the drive has never been formatted before I got the
following Initialize drive warning, you might get the same if your drive (or virtual hard disk) is
brand new.
Page No | 3
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
11. Set your root password, something sensible please Dont set weak dictionary passwords or
you will get hacked by a 13yr old russian super hackz0r You might want to check out my guide
Page No | 4
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
12. You will now be set with a bunch of options for your disk partitioning, as this is a new fresh
install I selected the option Create custom for creating own format.
Page No | 5
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 6
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 7
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
14. Format warning, click on Format (this will delete your data.
Page No | 8
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
15. You will now see a warning about writing the changes to disk, click on Write changes to disk.
Page No | 9
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
16. Boot loader options, I left this as default you might want to set a boot loader password.
17. The next part is important selecting which programs to be install on the server follow the
screens .
Page No | 10
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 11
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 12
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Basic command
To view list of files
[root@server ~]# ls
anaconda-ks.cfg
anand2
Documents
Public
Templates webmin-1.590
anand1
rpmbuild
Videos
install.log
Desktop
Downloads
webmin-1.590.tar.gz
install.log.syslog
Music
Pictures
1 root root
drwxr-xr-x.
2 root root
drwxr-xr-x.
2 root root
drwxr-xr-x.
2 root root
drwxr-xr-x.
2 root root
drwxr-xr-x.
2 root root
-rw-r--r--.
1 root root
To view list of files and folders with details human readable format
[root@server ~]# ls -lh
total 19M
-rw-------.
drwxr-xr-x.
drwxr-xr-x.
drwxr-xr-x.
drwxr-xr-x.
drwxr-xr-x.
-rw-r--r--.
1 root root
-rw-r--r--.
1 root root
To clear screen
[root@server ~]# clear or ctrl + l
Page No | 13
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
.bash_logout
.dbus
.local
.pulse
.bash_profile
.pulse-cookie
.gconfd
.gtk.spice-vdagent webmin-
Desktop
.ssh
.gnome2
.gvfs
.xsession-errors
smallicon.gif
tzone4.jpg
zone.gif
./webmin-1.590/zones/lang:
ca
ca.UTF-8
de
de.UTF-8
en
Page No | 14
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
[root@server ~]# ls
To create a directory
[root@server ~]# mkdir india
[root@server ~]# ls
Creating multiple directories
[root@server ~]# mkdir india1 india2 india3
[root@server ~]# ls
Creating multiple nested directories
[root@server ~]# mkdir -p kumar1/kumar2/kumar3
[root@server ~]# ls -lR kumar1/
kumar1/:
total 4
drwxr-xr-x 3 root root 4096 Jul 25 10:48 kumar2
kumar1/kumar2:
total 4
drwxr-xr-x 2 root root 4096 Jul 25 10:48 kumar3
kumar1/kumar2/kumar3:
total 0
Changing directory
[root@server ~]#cd /kumar1
[root@server kumar]# ls
kumar2
Back to directory
[root@server ~]# cd ..
Removing a file
[root@server ~]# rm delhi
rm: remove regular file `delhi'? y
[root@server ~]# ls
Page No | 15
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
anaconda-ks.cfg anand2 Desktop
Downloads india
india2 install.log
kumar
Music
Public
Templates webmin-1.590 anand1
d1
Documents
hyderabad india1 india3 install.log.syslog kumar1 Pictures rpmbuild Videos
webmin-1.590.tar.gz
Page No | 16
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Size
/dev/sda1
9.7G
2.9G
tmpfs
1012M
6.4G
112K 1012M
31% /
1% /dev/shm
/dev/sda3
985M
18M
918M
2% /dev1
/dev/sda5
985M
18M
918M
2% /dev2
Page No | 17
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Start
End
Blocks
Id
System
1275
10240000
83
Linux
/dev/sda2
1275
1785
4096000
82
/dev/sda3
1785
1913
1024000
83
Linux
/dev/sda4
1913
2611
5610496
/dev/sda5
1913
2041
1024000
83
Linux
/dev/sda6
2041
2054
111651+
83
Linux
/dev/sda7
2055
2080
208813+
83
Linux
/dev/sda8
2081
2094
112423+
83
Linux
/dev/sda9
2095
2108
112423+
83
Linux
Extended
Page No | 18
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Editors:
In Linux by default we have 3 editors
hyderabad2
Vi/VIM editor
[root@server ~]# vi hyderabad2
Page No | 19
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Commands in vi editors
x
nx
X
dw
ndw
dd
ndd
D
r
cw
ncw
C
o
O
J
nJ
u
U
delete character
delete n characters
delete character before cursor
delete word
delete n words
delete line
delete n lines
delete characters from cursor to end of line
replace character under cursor
replace a word
replace n words
change text from cursor to end of line
insert blank line below cursor
(ready for insertion)
insert blank line above cursor
(ready for insertion)
join succeeding line to current cursor line
join n succeeding lines to current cursor line
undo last change
restore current line
Page No | 20
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
H
M
L
G
1G
<Control>f
<Control>b
<Control>d
<Control>u
n
N
Page No | 21
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 22
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 23
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Password expires
: never
Password inactive
: never
Account expires
: never
: 0
: 99999
: 7
deleting user
[root@server ~]# userdel u100
deleting user with home directory
[root@server ~]# userdel -r u80
deleting a group
[root@server ~]# groupdel shiva1
[root@server ~]#
Page No | 24
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Permissions
checking user permissions of file
Note: permission can be assigned to files and folders not users and groups.
[root@server ~]# ls -l
drwxr-xr-x.
2 root root
drwxr-xr-x.
2 root root
Page No | 25
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 26
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Stick bit
stick bit can be applied to folders only, which provides full access to all the users but only the user can
delete the files who is owner.
[root@server ~]# mkdir /delhi
[root@server ~]#useradd u150
[root@server ~]#useradd u160
Applying stick bit to delhi folder
[root@server /]# cd ..
[root@server /]# chmod 1777 /delhi/
[root@server /]# ls -l
total 1536
-rw-r--rwx
1 ramesh ramesh
-rw-r--r--.
1 root
root
dr-xr-xr-x.
2 root
root
dr-xr-xr-x.
4 root
root
drwxr-xr-x.
2 root
root
4096 Sep 23
drwxr-xr-x
3 root
root
drwxrwxrwt
2 root
root
2011 cgroup
Page No | 27
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Sudo users
Sudo command will provides normal users to root users permission
[root@server /]# useradd u200
[root@server /]# passwd u200
[root@server /]# vi /etc/sudoers
line number 96
u160
ALL=(ALL)
ALL
Page No | 28
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Basic networking
To view hostname
[root@localhost ~]# hostname
Assigning hostname
[root@localhost ~]# hostname server.example.com
Setting computer name permanent
[root@localhost ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server.example.com
:wq!
ifdown-isdn
ifdown-sit
network-functions
ifup-bnep
ifup-ipv6
ifup-
ifcfg-lo
ifdown-ib
ppp
ifup-wireless
ifdown-post
ifdown-tunnel
network-functions-ipv6
ifup-eth
ifup-isdn
ifup-
ifdown
routes
ifdown-ppp
ifup
ifup-ib
ifup-plip
ifup-
ifdown-routes
ifup-aliases
ifup-ippp
ifup-plusb
ifup-
ifdown-ippp
init.ipv6-global
ifdown-bnep ifdown-ipv6
sit
net.hotplug
Page No | 29
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
HWADDR=00:0c:29:22:0b:fe
PEERROUTES=yes
USERCTL=no
PEERDNS=yes
Assigning IP address
There are 2 ways IP address can be assigned
Using tool
Manually
Using tools 1) system-config-network-tui 2)setup 3)ifconfig
Steep1 :
[root@localhost /]# system-config-network-tui
Page No | 30
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 31
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
To check IP address
[root@server ~]# ifconfig
eth0
lo
or
[root@server ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
qlen 1000
link/ether 00:0c:29:22:0b:fe brd ff:ff:ff:ff:ff:ff
inet 192.168.0.101/24 brd 192.168.0.255 scope global eth0
inet6 fe80::20c:29ff:fe22:bfe/64 scope link
valid_lft forever preferred_lft forever
Page No | 32
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
3: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether be:c0:bf:39:81:a4 brd ff:ff:ff:ff:ff:ff
Assigning Another IP address to same network card which is known as virtual Ethernet card.
Link encap:Ethernet
inet addr:192.168.0.5
HWaddr 00:0C:29:22:0B:FE
Bcast:192.168.0.255
MTU:1500
Mask:255.255.255.0
Metric:1
Note: you can create 0-253 virtual IP address for one network card
Page No | 33
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
2012-07-25 01:25
run-level 5
2012-07-25 01:25
LOGIN
tty2
2012-07-25 01:26
1978 id=2
LOGIN
tty3
2012-07-25 01:26
1980 id=3
LOGIN
tty4
2012-07-25 01:26
1982 id=4
LOGIN
tty5
2012-07-25 01:26
1984 id=5
LOGIN
tty6
2012-07-25 01:26
1986 id=6
+ tty7
2012-07-25 10:08
root
root
root
old
10939 (:0)
pts/0
2012-07-25 08:57
+ pts/1
2012-07-25 12:07
pts/2
2012-07-25 10:08
9413 id=ts/2
term=0 exit=0
pts/3
2012-07-25 13:20
11300 id=ts/3
term=0 exit=0
pts/4
2012-07-25 08:55
10104 id=ts/4
term=0 exit=0
pts/0
2012-07-25 12:11
10471 id=ts/0
term=0 exit=0
11208 (:0.0)
+ pts/2
0 id=/0
.
term=0 exit=0
11915 (192.168.0.100)
Page No | 34
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
1 using rpm
Working with CD/DVD-ROMS and USB devices.
Insert the CD/DVD, then follow the steeps
[root@localhost ~]# mount /dev/dvdrw /media/
mount: block device /dev/sr0 is write-protected, mounting read-only
[root@localhost ~]# cd /media/
[root@localhost media]# ls
[root@localhost media]# cd Packages/
[root@localhost Packages]# ls
--force
########################################### [100%]
########################################### [100%]
Installation Location
Page No | 35
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
[root@localhost Packages]# whereis httpd
httpd: /usr/sbin/httpd.event /usr/sbin/httpd.worker /usr/sbin/httpd
/etc/httpd /usr/lib/httpd /usr/share/man/man8/httpd.8.gz
2) Using yum
Steep1: Listing available packages
[root@localhost /]# yum list samba
[root@localhost /]# yum list updates or all
[root@localhost /]# yum group list
Page No | 36
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 37
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Job scheduling
Job scheduling can be done two ways
1) cron tab
2) at
1) Cron tab
To add new job, edit job, delete a job
[root@server /]# crontab -e
30 08 10 06 * /home/ramesh/full-backup.sh
0 22 * * * poweroff
:wq!
[root@server /]# crontab -l
30 08 10 06 * /home/ramesh/full-backup.sh
0 22 * * * poweroff
# crontab -ir
crontab: really delete root's crontab? n
In crontab total 6 columns which are given bellow
1) MIN
Minute field 0 to 59
2 HOUR
Hour field
0 to 23
3) DOM
Day of Month 1-31
4) MON
Month field
1-12
6) DOW
Day Of Week 0-6
7) CMD
Command Any command to be executed.
1) For first line a backup script will be starts
30 30th Minute
08 08 AM
10 10th Day
06 6th Month (June)
* Every day of the week
0 every minute
22 20 PM
* everyday
* every month
* Every day of the week
Page No | 38
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
2) At Command
Adding a job
[root@server /]# at -m 01:35
at> poweroff
press ctrl+d
at> <EOT>
Viewing jobs
[root@server /]# at -l
1 2011-10-10 01:35AM pweroff
Removing a job 1
[root@server /]# atrm 1
Page No | 39
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Size
/dev/sda1
9.7G
2.8G
tmpfs
1012M
6.4G
31% /
284K 1012M
/dev/sda3
985M
18M
/dev/sr0
3.6G
3.6G
1% /dev/shm
918M
2% /dev1
0 100% /media/CentOS_6.2_Final
Start
End
Blocks
Id
System
1275
10240000
83
Linux
/dev/sda2
1275
1785
4096000
82
/dev/sda3
1785
1913
1024000
83
Linux
/dev/sda4
1913
2611
5610496
/dev/sda5
1913
2041
1024000
83
/dev/sda1
Extended
Linux
delete a partition
Page No | 40
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
p
Start
End
Blocks
Id
System
1275
10240000
83
Linux
/dev/sda2
1275
1785
4096000
82
/dev/sda3
1785
1913
1024000
83
Linux
/dev/sda4
1913
2611
5610496
/dev/sda5
1913
2041
1024000
83
Linux
/dev/sda6
2041
2054
111651+
83
Linux
/dev/sda7
2055
2080
208813+
83
Linux
/dev/sda8
2081
2094
112423+
83
Linux
/dev/sda1
Extended
Steep4 : creating file system for newly created /dev/sda6, /dev/sda7, /dev/sda8.
[root@localhost ~]# mkfs.ext2 /dev/sda6
[root@localhost ~]# mkfs.ext3 /dev/sda7
[root@localhost ~]# mkfs.ext4 /dev/sda8
Page No | 41
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Size
/dev/sda1
9.7G
2.8G
tmpfs
/dev/sda3
Page No | 42
1012M
985M
6.4G
284K 1012M
18M
918M
31% /
1% /dev/shm
2% /dev1
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
/dev/sr0
3.6G
3.6G
0 100% /media/CentOS_6.2_Final
/dev/sda6
106M
1.6M
99M
2% /dev6
/dev/sda7
198M
5.8M
182M
4% /dev7
/dev/sda8
107M
5.6M
96M
6% /dev8
Start
End
Blocks
Id
System
1275
10240000
83
Linux
/dev/sda2
1275
1530
2048000
82
/dev/sda3
1530
2610
8675801
/dev/sda5
1530
1555
201482
83
Linux
/dev/sda6
1556
1581
208813+
83
Linux
/dev/sda7
1582
1607
208813+
83
Linux
/dev/sda1
Extended
Page No | 43
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Start
End
Blocks
Id
System
1275
10240000
83
Linux
/dev/sda2
1275
1785
4096000
82
/dev/sda3
1785
1913
1024000
83
Linux
/dev/sda4
1913
2611
5610496
/dev/sda5
1913
2041
1024000
83
/dev/sda1
Extended
Linux
Page No | 44
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Command (m for help): p
Device Boot
Start
End
Blocks
Id
System
1275
10240000
83
Linux
/dev/sda2
1275
1785
4096000
82
/dev/sda3
1785
1913
1024000
83
Linux
/dev/sda4
1913
2611
5610496
/dev/sda5
1913
2041
1024000
83
Linux
/dev/sda6
2041
2054
111651+
83
Linux
/dev/sda7
2055
2080
208813+
83
Linux
/dev/sda8
2081
2094
112423+
83
Linux
/dev/sda1
Extended
Steep4 : creating file system for newly created /dev/sda6, /dev/sda7, /dev/sda8.
[root@localhost ~]# mkfs.ext4 /dev/sda6
[root@localhost ~]# mkfs.ext4 /dev/sda7
[root@localhost ~]# mkfs.ext4 /dev/sda8
[root@localhost ~]# fdisk -l
Device Boot
/dev/sda1
Start
*
End
Blocks
Id
System
1275
10240000
83
Linux
/dev/sda2
1275
1785
4096000
82
/dev/sda3
1785
1913
1024000
83
Linux
/dev/sda4
1913
2611
5610496
/dev/sda5
1913
2041
1024000
83
Linux
/dev/sda6
2041
2054
111651+
83
Linux
/dev/sda7
2055
2080
208813+
83
Linux
/dev/sda8
2081
2094
112423+
83
Linux
Extended
Page No | 45
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Physical volume "/dev/sda7" successfully created
Writing physical volume data to disk "/dev/sda8"
Physical volume "/dev/sda8" successfully created
/dev/sda6
VG Name
PV Size
109.03 MiB
Allocatable
NO
PE Size
Total PE
Free PE
Allocated PE
PV UUID
abgRMn-cr4I-dyF0-ekY9-SaWm-CeyW-j5ifMS
/dev/sda7
VG Name
PV Size
203.92 MiB
Allocatable
NO
PE Size
Total PE
Free PE
Allocated PE
PV UUID
STQw3d-8ffF-D9Yq-9ji3-xGug-ADcD-FlgHIf
/dev/sda8
VG Name
PV Size
109.79 MiB
Allocatable
NO
PE Size
Total PE
Page No | 46
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Free PE
Allocated PE
PV UUID
RNbNM6-d4v7-qKfM-UVOb-76sa-qTsK-8OUCor
vg1
System ID
Format
lvm2
Metadata Areas
Metadata Sequence No
VG Access
read/write
VG Status
resizable
MAX LV
Cur LV
Open LV
Max PV
Cur PV
Act PV
VG Size
416.00 MiB
PE Size
4.00 MiB
Total PE
104
Alloc PE / Size
0 / 0
Free
PE / Size
VG UUID
u1QKS0-5EiL-jghL-Owj9-0brg-QWD8-1zOooC
Page No | 47
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
--- Logical volume --LV Name
/dev/vg1/lv1
VG Name
vg1
LV UUID
ZzIF11-rkjv-inkb-UiFF-8i3l-YN9n-7qZ2ei
LV Write Access
read/write
LV Status
available
# open
LV Size
200.00 MiB
Current LE
50
Segments
Allocation
inherit
auto
- currently set to
256
Block device
253:0
/lv1/
[root@localhost ~]# df -h
Filesystem
Size
/dev/sda1
9.7G
2.5G
tmpfs
1012M
6.7G
112K 1012M
27% /
1% /dev/shm
/dev/sda3
985M
18M
918M
2% /dev1
/dev/sda5
985M
18M
918M
2% /dev2
/dev/mapper/vg1-lv1
194M
5.6M
179M
4% /lv1
Page No | 48
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Start
End
Blocks
Id
System
1275
10240000
83
Linux
/dev/sda2
1275
1785
4096000
82
/dev/sda3
1785
1913
1024000
83
Linux
/dev/sda4
1913
2611
5610496
/dev/sda5
1913
2041
1024000
83
Linux
/dev/sda6
2041
2054
111651+
83
Linux
/dev/sda7
2055
2080
208813+
83
Linux
/dev/sda1
Page No | 49
Extended
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
/dev/sda8
2081
2094
112423+
83
Linux
Page No | 50
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Labels on physical volume "/dev/sda6" successfully wiped
Labels on physical volume "/dev/sda7" successfully wiped
Labels on physical volume "/dev/sda8" successfully wiped
Labels on physical volume "/dev/sda9" successfully wiped
/dev6
ext2 defaults 0 0
/dev/sda7
/dev7
ext3 defaults 0 0
/dev/sda8
/dev8
ext4 defaults 0 0
Page No | 51
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
RAID- 1/5
steep1: Creating 3 partitions sda5, sda6, sda7 which are 200M, 200M 100M.
[root@ns1 ~]# fdisk /dev/sda
Command (m for help): n
Command action
l
logical (5 or over)
l
First cylinder (1556-2610, default 1556):
Using default value 1556
Last cylinder, +cylinders or +size{K,M,G} (1556-2610, default 2610): +200M
logical (5 or over)
l
First cylinder (1582-2610, default 1582):
Using default value 1582
Last cylinder, +cylinders or +size{K,M,G} (1582-2610, default 2610): +200M
logical (5 or over)
l
First cylinder (1608-2610, default 1608):
Using default value 1608
Last cylinder, +cylinders or +size{K,M,G} (1608-2610, default 2610): +200M
Page No | 52
Start
End
Blocks
Id
System
1275
10240000
83
Linux
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
/dev/sda2
1275
1530
2048000
82
/dev/sda3
1530
2610
8675801
/dev/sda5
1530
1555
201482
83
Linux
/dev/sda6
1556
1581
208813+
83
Linux
/dev/sda7
1582
1607
208813+
83
Linux
/dev/sda8
1608
1633
208813+
83
Linux
Extended
Start
End
Blocks
Id
System
1275
10240000
83
Linux
/dev/sda2
1275
1530
2048000
82
/dev/sda3
1530
2610
8675801
/dev/sda5
1530
1555
201482
83
Linux
/dev/sda6
1556
1581
208813+
83
Linux
/dev/sda7
1582
1607
208813+
fd
/dev/sda8
1608
1633
208813+
fd
Extended
Page No | 53
Start
End
Blocks
Id
System
1275
10240000
83
Linux
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
/dev/sda2
1275
1530
2048000
82
/dev/sda3
1530
2610
8675801
/dev/sda5
1530
1555
201482
83
Linux
/dev/sda6
1556
1581
208813+
fd
/dev/sda7
1582
1607
208813+
fd
/dev/sda8
1608
1633
208813+
fd
Extended
Note: RAID 1 is mirroring, when configuring RAID 1 your HDD partitions size should be
same.
Steep2 : Creating mdadm for raid
[root@ns1 ~]# mdadm --create /dev/md0 --level=1 --raid-devices=2
/dev/sda6 /dev/sda7
mdadm: /dev/sda6 appears to contain an ext2fs file system
size=208812K
mtime=Thu Jan
1 05:30:00 1970
If you plan to
mtime=Thu Jan
1 05:30:00 1970
Page No | 54
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
or
To view the details of raid
[root@ns1 ~]# mdadm -D /dev/md0
/dev/md0:
Version : 1.2
Creation Time : Mon Jul 30 17:59:56 2012
Raid Level : raid1
Array Size : 112411 (109.79 MiB 115.11 MB)
Used Dev Size : 112411 (109.79 MiB 115.11 MB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Mon Jul 30 17:59:58 2012
State : clean
Active Devices : 2
Working Devices : 2
Failed Devices : 0
Spare Devices : 0
Name : ns1.example.com:0
UUID : 4488587c:00e56ff3:854194c1:0845c4fa
Events : 17
Number
Major
Minor
RaidDevice State
active sync
/dev/sda6
active sync
/dev/sda7
Size
/dev/sda1
9.7G
2.4G
tmpfs
Page No | 55
1012M
6.8G
264K 1012M
27% /
1% /dev/shm
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Size
/dev/sda1
9.7G
2.4G
tmpfs
1012M
/dev/md0
6.8G
264K 1012M
107M
27% /
1% /dev/shm
5.6M
96M
6% /raidvol
Page No | 56
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
UUID : 4488587c:00e56ff3:854194c1:0845c4fa
Events : 18
Number
Major
Minor
RaidDevice State
active sync
removed
faulty spare
/dev/sda6
/dev/sda7
Page No | 57
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Name : ns1.example.com:0
UUID : 4488587c:00e56ff3:854194c1:0845c4fa
Events : 21
Number
Major
Minor
RaidDevice State
active sync
removed
/dev/sda6
UUID : 4488587c:00e56ff3:854194c1:0845c4fa
Events : 42
Number
Major
Page No | 58
Minor
6
RaidDevice State
0
active sync
/dev/sda6
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
2
active sync
/dev/sda8
RAID 5
Follow all the steeps same except steep 2
[root@ns1 ~]# mdadm --create /dev/md0 --level=5 --raid-devices=3
/dev/sda6 /dev/sda7 /dev/sda8
Page No | 59
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Backups:
Backups software is used depends upon your requirement of the company. General
tools are used for backup in the market
1)
2)
3)
4)
5)
6)
7)
veritas netbackup
tar
cpio
dd
bacula (network backup server)
Amanda (network backup server)
rsync (remote sync)
1) Tar tool
[root@localhost /]# mkdir /xyz
[root@localhost /]# cd xyz
[root@localhost xyz]# touch shiva shiva1 hyd hyd2
[root@localhost xyz]# cd ..
Steep1: creating tar backup and zip
[root@localhost /]# tar -cvf /backup.tar /xyz/
Or
[root@localhost /]# tar -cvzf /backup.tar.zg /xyz/ (backup with zip)
tar: Removing leading `/' from member names
/xyz/
/xyz/shiva1
/xyz/hyd2
/xyz/shiva
/xyz/hyd
Page No | 60
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
-rw-r--r-- root/root
-rw-r--r-- root/root
-rw-r--r-- root/root
-rw-r--r-- root/root
xyz/
xyz/shiva1
xyz/hyd2
xyz/shiva
xyz/hyd
[root@localhost /]#
filename
To Unzip
[root@localhost /]# gunzip
filename.gz
Page No | 61
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
[root@localhost /]# find /xyz/ | cpio -ov > backup.cpio
/xyz/
/xyz/shiva1
/xyz/hyd2
/xyz/shiva
/xyz/hyd
1 block
2 root
root
-rw-r--r--
1 root
root
-rw-r--r--
1 root
root
-rw-r--r--
1 root
root
-rw-r--r--
1 root
root
1 block
Page No | 62
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
/dev8/
36.47 bytes/sec
speedup is 0.00
hyd2
lost+found
shiva
shiva1
Page No | 63
> backup_20072011.sql
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
To restore backup
[root@localhost /]# mysql u root p databasename
Page No | 64
< backup_20072011.sql
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Process management
To get number of process
[root@localhost /]# ps
PID TTY
TIME CMD
2635 pts/1
00:00:00 bash
2863 pts/1
00:00:00 ps
[root@localhost /]#ps -e
[root@localhost Packages]# ps -ef | grep httpd
root
2894
0 02:57 ?
00:00:00 /usr/sbin/httpd
apache
2897
2894
0 02:57 ?
00:00:00 /usr/sbin/httpd
apache
2898
2894
0 02:57 ?
00:00:00 /usr/sbin/httpd
apache
2899
2894
0 02:57 ?
00:00:00 /usr/sbin/httpd
apache
2900
2894
0 02:57 ?
00:00:00 /usr/sbin/httpd
apache
2901
2894
0 02:57 ?
00:00:00 /usr/sbin/httpd
apache
2902
2894
0 02:57 ?
00:00:00 /usr/sbin/httpd
apache
2903
2894
0 02:57 ?
00:00:00 /usr/sbin/httpd
apache
2904
2894
0 02:57 ?
00:00:00 /usr/sbin/httpd
root
2907
2635
0 02:58 pts/1
Page No | 65
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
used
free
shared
buffers
cached
1006
430
576
35
218
-/+ buffers/cache:
176
830
1999
Mem:
Swap:
1999
swpd
free
0 590232
buff
cache
si
so
bi
bo
in
36404 223876
40
11
83
cs us sy id wa st
196
4 93
Foreign Address
State
tcp
0
1320/rpcbind
0 0.0.0.0:111
0.0.0.0:*
LISTEN
tcp
1686/sshd
0 0.0.0.0:22
0.0.0.0:*
LISTEN
tcp
0
1488/cupsd
0 127.0.0.1:631
0.0.0.0:*
LISTEN
tcp
0
1776/master
0 127.0.0.1:25
0.0.0.0:*
LISTEN
tcp
0
1439/rpc.statd
0 0.0.0.0:49373
0.0.0.0:*
LISTEN
tcp
0
1819/qpidd
0 0.0.0.0:5672
0.0.0.0:*
LISTEN
tcp
0
1320/rpcbind
0 :::111
:::*
LISTEN
0 0.0.0.0:111
0.0.0.0:*
LISTEN
1320/rpcbind
tcp
0 0.0.0.0:22
0.0.0.0:*
LISTEN
1686/sshd
tcp
0 127.0.0.1:631
0.0.0.0:*
LISTEN
1488/cupsd
Page No | 66
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
tcp
0 127.0.0.1:25
0.0.0.0:*
LISTEN
1776/master
tcp
0 0.0.0.0:49373
0.0.0.0:*
LISTEN
1439/rpc.statd
tcp
0 0.0.0.0:5672
0.0.0.0:*
LISTEN
1819/qpidd
1:58,
3 users,
%user
1.85
Device:
3.76
07/30/2012
%steal
%idle
0.00
93.63
0.76
_i686_
tps
Blk_read/s
Blk_wrtn/s
Blk_read
Blk_wrtn
scd0
0.05
0.28
0.00
1872
sda
1.90
71.91
20.63
484066
138848
(1
Page No | 67
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
[1]+
Stopped
vi india
[root@localhost ~]# ps
PID TTY
TIME CMD
2635 pts/1
00:00:00 bash
3028 pts/1
00:00:00 vi
3158 pts/1
00:00:00 ps
TIME CMD
2635 pts/1
00:00:00 bash
3028 pts/1
00:00:00 vi
4298 pts/1
00:00:00 ps
TIME CMD
2635 pts/1
00:00:00 bash
6766 pts/1
00:00:00 ps
[1]+
Killed
vi india
Page No | 68
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
B. Anand kumar
Mobile: +91 96762 77939
email : bandaru.anand@gmail.com
Page No | 69
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
install nfs*
-y
/media/CentOS_6.2_Final/Packages/
-ivh
nfs*
--force
shiva2.txt
shiva3.txt
[root@node2 anand]# cd /
Steep4: Add entries in /etc/exports
[root@node2 /]# vi
/etc/exports
/anand 192.168.0.0/255.255.255.0(rw,sync)
/anand1 *(r,sync)
:wq!
Page No | 70
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
nfs
restart
Page No | 71
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Client Side:
Check the list of folder shared in the network
[root@client /]# showmount
[root@client /]#shomount
[root@clinet /]#mkdir
-e
-e
/shiva
[root@client/]# mount
<nfsservername/IP>:/share folder
[root@client/]# mount
192.168.0.X:/anand
[root@client/]# cd
/shiva
/shiva
/shiva
[root@client/]#ls
Page No | 72
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
-y
Steep2: By default in the main configuration file is black, so u need to copy from
/usr/share/doc/dhc*/dhcp.conf.sample
[root@node2 /]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample
/etc/dhcp/dhcpd.conf
Steep3: open main configuration file
[root@node2 /]# vi /etc/dhcp/dhcpd.conf
Line 7
192.168.0.20; }
:wq!
Steep4: start DHCP start
[root@node2 /]# Service dhcpd start
Steep5: Reservation or fixed IP address for a particular computer
[root@node2 /]# vi /etc/dhcp/dhcpd.conf
Line 75
host server.shiva.com {
Line 76
Line 77
fixed-address 192.168.0.X;
Line 78 }
:wq!
Page No | 73
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 74
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 75
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
/media/CentOS_6.2_Final/Packages/vsftpd-
Or
[root@node2 /]# yum
install
vsftp*
-y
u1
u1
/home/u1
1.txt
2.txt
[root@node2 /]# ls
[root@node2 /]# cd /var/ftp/pub
[root@node2 /]# touch
1.txt
2.txt
vi
/etc/vsftpd/vsftpd.conf
Page No | 76
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Steep 4: if you want block few users user, then add the user in /etc/vsftpd/ftpusers
[root@node2 /]#
vi
/etc/vsftpd/ftpusers
u1
:wq!
Page No | 77
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 78
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Samba Configuration
Samba is a service is used to share data from Linux/Unix to windows operating system.
Steep1: checking and installing samba server
[root@node2 ~]# rpm -qa | grep 'samba'
[root@node2 ~]# cd /media/CentOS_6.2_Final/Packages/
[root@node2 Packages]# rpm
-ivh
samba-3.5.10-114.el6.i686.rpm
Or
[root@node2 Packages]# yum
install
samba*
-y
Steep2: create share folder in samba to share from windows (/shiva) and create some users to log in
from windows
[root@node2 ~]# useradd
[root@node2 ~]# passwd
u1
u1
u2
u2
/shiva
777
/shiva
/shiva
1.txt
2.txt
3.txt
vi /etc/samba/smb.conf
Note: at last
[public-share]
comment = Public Stuff for all
path = /shiva
valid users = u1 u1
public = no
writable = yes
printable = no
Page No | 79
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
:wq!
Steep4: to test the smb.conf script
[root@node2 Packages]#
testparm
[public-share]
comment = Public Stuff for all
path = /shiva
valid users = u1, u1
read only = No
steep5: Adding and enabling users in samba server
[root@node2 ~]# smbpasswd
-a
u1
-a
u2
-e
u1
-e
u2
Page No | 80
service
smb
start
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
smbclient
-L
192.168.0.X
-U
u1
//192.168.0.X/sharefoldername
-U
u1
Or
Ex:
[root@client/]# smbclient
//192.168.0.102/u1
-U
u1
Page No | 81
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
//<winip/name>/foldername
/linuxfolder
/win
-o
-o
Page No | 82
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 83
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Line 18
allow-query
{ any; };
type master;
Line 15
file "fzone";
Line 16
allow-update { none; };
Line 17 };
Reverse Look zone file
Line 31 zone "1.168.192.in-addr.arpa" IN {
Line 32
type master;
Line 33
file "rzone";
Line 34
allow-update { none; };
Line 35 };
Steep7 : creating forward and reverse look up zone files
[root@node2 /]# cd /var/named
[root@node2 named]# cp named.localhost
[root@node2 named]# cp named.loopback
fzone
rzone
Steep8: adding the forward and reverse look up zones to named group
[root@node2 named]# chgrp named fzone
[root@node2 named]# chgrp named rzone
Page No | 84
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
IN SOA
node2.localdomain.com. root.node2.localdomain.com. (
In NS
node2.localdomain.com.
node2
IN A
192.168.1.7
web
IN A
192.168.1.9
www
CNAME
mailser
; serial
1D
; refresh
1H
; retry
1W
; expire
3H )
; minimum
web
IN A
localdomain.com
Page No | 85
192.168.1.10
IN MX
mailser
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
IN SOA
node2.localdomain.com. root.node2.localdomain.com. (
0
; serial
1D
; refresh
1H
; retry
1W
; expire
3H )
; minimum
IN NS
node2.localdomain.com.
IN PTR
node2.localdomain.com.
IN PTR
web.localdomain.com.
10
IN PTR
mailserv.localdomain.com.
(with IP address)
(With Name)
Note: when youre checking DNS server you have to get quary 1 and
answer 1 must.
Page No | 86
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
www.localdomain.com
:wq!
Page No | 87
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 88
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
or
http://localdomain.com
www.localdomain.com
192.168.1.X
www.example.com
192.168.1.X
www.example1.com
192.168.1.XX
www.example2.com
:wq!
Steep2: edit main configuration file /etc/httpd/conf/httpd.conf
[root@node2 ~]# vi /etc/httpd/conf/httpd.conf
<VirtualHosting 192.168.1.x:80>
ServerAdmin root@example.com
ServerName www.example.com
DocumentRoot "/var/www/html/example"
</VirtualHosting>
:wq!
Steep3: Checking script
[root@node2 ~]# httpd -t
Page No | 89
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Syntax OK
Steep4: restart the httpd service
[root@node2 ~]# service httpd restart
IP based hosting
Steep1: Creating and checking new virtual network card:
Note: Follow network practical for how to create new virtual eathernet card.
[root@node2 ~]# ifconfig
Steep2: edit main configuration file /etc/httpd/conf/httpd.conf
[root@node2 ~]# vi /etc/httpd/conf/httpd.conf
<VirtualHosting 192.168.1.XX:80>
ServerAdmin root@example2.com
Page No | 90
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
ServerName www.example2.com
DocumentRoot "/var/www/html/example2"
</VirtualHosting>
:wq!
Steep3: Checking script
[root@node2 ~]# httpd -t
Syntax OK
Steep4: restart the httpd service
[root@node2 ~]# service httpd start
Page No | 91
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Installing webmin
Webmin is a graphical web based interface to mange Linux operating system
Download webmin software from www.webmin.com website.
Steep1: Installing webmin program from command mode
[root@localhost ~]# wget
http://prdownloads.sourceforge.net/webadmin/webmin-1.590.tar.gz
Steep2: unzip the file
[root@localhost ~]# tar -xvzg
webmin-1.590.tar.gz
Page No | 92
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 93
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 94
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Page No | 95
Shiva Computers 101, 1st Floor, Revathi Apartments, Behind Maitrivanam, Ameerpet, Hyderabad.
Tel : 040-66848223 / 23734062 Mobile: +91 99595 62929 www.shivacomputers.net
Steep7: Follow remaining steeps from (steeps 8) onwards which given on top.
Page No | 96