Activities

May 2008
M T W T F S S
« Mar   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

RHCE Notes

###########   Yum    ####################

Red Hat Package Manager(RPM):
—————————–
To install an rpm package, issue
#rpm -i <package.rpm>

To erase an rpm, issue
#rpm -e <package_name>

#rpm -i ypserv-2.19-3.i386.rpm
This will install the ypserv utility on to your machine!

If we want to delete the ypserv package, we need to issue only the package name.
#rpm -e ypserv

To query all the installed packages on our system, issue
#rpm -qa

#rpm -q ypserv
This will query for the package ypserv. If its not installed, then “package ypserv not installed”
message will be shown.

#rpm -qa | grep yp
This would list all those packages in our system which has the string “yp” in their package name.

To know the files inside a package and the installation paths of those files prior to installation of that package, issue
#rpm -qpl <package.rpm>

To know the locations of files of a currently installed package, issue
#rpm -ql <package.rpm>

To know the package of a file
#rpm -qf /etc/passwd
This will show us the package from which /etc/passwd has come!

Dependancy Resolution with YUM:
——————————-
YellowDog Updater, Modified!

Make a file with .repo extenstion inside /etc/yum.repos.d/

#vim /etc/yum.repos.d/myyum.repo
[RHEL5]
name=RHEL 5.0 Yum FTP Repo!
baseurl=ftp://172.24.254.254/pub/Server
gpgcheck=0

[RHEL5-DVD]
name=RHEL 5.0 Yum Local Repo on DVD
baseurl=file:///mnt/Server
gpgcheck=0
enabled=0
Note: The RHEL 5.0 DVD should be mounted under /mnt!
################### LVM  Notes ##################

RHCE Classess  On 18-03-2007

1, Making the partion effectivelt

#parprob

1 LVM ( Logical Volu manager)

a, Create a Physical  volume
b, Creating a Volume Group
c, Creating a Logical Volume

A,

1,Creating a Physical Volume
#pvcreate /dev/hda6
2, Displying the Physical Volume
#pvdisplay
3, Showing status
#pvs
P.E physical extened

B, Createing a Volume Group

1, vgcreate <VolumeGroup>  <Physical volume>
Eg:vgcreate LIJU /dev/hda6
2, Listing Volumegroup
eg: vgdisplay
3, Listing status
#vgs

C, Creating Logical Volume

1. #lvcreate  -L <size>  -n <lvmname> <volume group>
Eg: lvcreate -L 1000M  -n lvm1  LIJU
2, Listing LV
#lvdisplay
3,Displaying status
#lvs

4, Increasing /Extending  Logical Volume
#lvextend  -L +500M  <dev/VG> <lvname>
5, Make effect changes  after the lv extendension
#resize2fs /dev/Liju
#resize2fs </device/VG>

########### Labeling  a partion #######################

#e2label <partion name>  <label name>
eg: #e2label  /dev/hda6  data

# Formating a filesystem
Eg: mkfs.ext3 /dev/hada6

Mounting a partion using a fstab

<label name>     <mount point>   <file system>     defaults  <disdump enable/0/1>   <Fsck priority>

backups         /backups           ext3            defaults   0            0

############################# 18-03-2007 #####################

Sample procedure for creae a LVM

#pvcreate /dev/hda6
#vgcreate Databases /dev/hda6
#lvcreate -L 1000M -name mysql Databases
#mkfs.ext3 /dev/Databases/mysql
#mkdir /mnt/mysql
#mount /dev/Databases/mysql /mnt/mysql
#lvextend -L +200M /dev/Databases/mysql
#resize2fs  /dev/Databases/mysql

##################

Creating Volume Gruop entendnce during pv creation
#vgcreate -s 32M /dev/hda5

Lvm createion = pv ->vg->lv->mkfs->mount

############# Removing LVM #############################

Disabling/hiding lv
#lvchage -an /dev/Databases/mysql
active no -an

ebabling lv
#lvchage -ay /dev/Databases/mysql

Removing lv
#lvremove /Dev/Databass/mysql

######  Disabling VG  #######

Deactivating Vlulume group
#vgchange  -an  /dev/Databases

Activating a vlume group
#vgchnage -ay /dev/Databases

Removing vg
#vgremove /Dev/Databases

##### PV #########
Removing  PV
#pvremove /devhada5
#

######## Etending a volume group  ########
vgextend  /dev/hda7 Databases

Questions
1, Create a VG group name nascent
2, PE size =32MB
3, Lv name = rhce (320MB)
4, Mount point = /LVM
5, Resize LVM by 100MB without dataloss .A value in beteeen 415 amd 425 is accepted

Create partion
pvcreate /dev/hda1
vgcreate -s 32 nascent /dev/hada5
lvcreate -L 320M  -n rhce nascent
mkdir /LVM
mkfs.ext3 /dev/nascent/rhce
mount /dev/nascent /LVM
Df- h /LVM

Extemded the lv bye 415MB

lvmextend -L 415M /dev/nascent/rhce
resizetofs  /dev/nascent/rhce

Resize /?LVM by 100Mb with out data loss.A value betteen 310 and 330 is acepted

umount /LVM
e2fsck -f /dev/nacesnt/rhce
resize2fs /dev/nasent/rhce 130M
lvreduce -L 312MB  /dev/nacent/rhce

mount /dev/nasent/rhce /LVM
df- h

################################### GRUB 24/03/2008 ###########################

Find the label
#findfs LABEL =Linux
#E2labl /dev/hda1

#grub

1, root (hd0,1)  — user tab control after the hd will list the avail disj in the sytem
root (hd0,0)
kernel  /vmlinyx ro root=/dev/hda2
initrd /initrd.img
boot
### Coomad for copy and paster using editot
For copy use ‘yy”
For paste use “d’
###################  NFS  ################

Related services
nfs 2049
portmap 111
1, vi /etc/exports
/backups  172.24.254.5(rw,sync) 17.168.0.2(sync)
/backups  172.24.254.5(rw,sync) 17.168.0.2(sync,no_root_squash)  # no_root_squash keeps the ownership of the files
2, mkdir /backups $$chmod 775
3, /etc/init.d/nfs restart
/etc/init.d/nfs restart
4,verifying it is properly configured
#showmount -e localhost

on client system

#showmount -e  server1
# mount 72.24.254.5:/backups /mnt
How to set this mount permanently on each system boot up
vi /etc.fsttab
172.24.254.5://backup  /mnt/new  nfs  defaults 0   0 0

################    NTP Server:  #################
———–
In the production environment, its very necessary to have a unified time for all the machines for effective logging and monitoring. As hardware time is not reliable, we could make use of a network time source with which all the client machines synchronizes their time on a scheduled basis.

NTP server configuration:
————————-
NTP Server listens on UDP port 123
configuration file: /etc/ntp.conf
Note: By default, ntp server doesnt allow anyone to fetch time from it.
So if we want to make some machines to fetch time from our NTP server we need to expicitly allow them in the main ntp configuration file.

#vim /etc/ntp.conf
restrict 172.24.25.25 mask 255.255.255.255 nomodify notrap
–OR–
restrict 172.24.25.25 nomodify notrap

To service time requests from 172.24. network with default subnet mask,
restrict 172.24.0.0 mask 255.255.0.0 nomodify notrap

#/etc/init.d/ntpd start
#chkconfig ntpd on

NTP Client Configuration:
————————-
We are told that we have an NTP server located at the ip 172.24.254.254. We want to synchronize our local time with that available in the NTP server on every boots.

#vim /etc/ntp.conf
At the bottom of the file enter,
server 172.24.254.254

#vim /etc/ntp/step-tickers
172.24.254.254
Note: Only enter the NTP server’s address.

Now we need to stop the NTP daemon if it is running,
#/etc/init.d/ntpd stop

#ntpdate -u 172.24.254.254
#ntpdate -u 172.24.254.254
#ntpdate -u 172.24.254.254
Note: Issue the ntpdate command thrice for accurate synchronization

#chkconfig ntpd on
###################### FTP server ############

FTP:
conf file: /etc/vsftpd/vsftpd.conf
Unlike SSH we are having two files to allow/deny users via FTP ( in SSH we did it in the main configuration file itself by AllowUsers/DenyUsers)
The main file for denial is /etc/vsftpd/ftpusers
The other file is /etc/vsftpd/user_list
But if we need to make our FTP check user_list file we need to say it in the main configuration file, like
userlist_enable=YES

If, userlist_enable=NO, ftp doesnt check user_list file

The behaviour of user_list depends upon the declaration inside the vsftpd.conf file

if its declared like,
userlist_deny=YES , those usernames inside user_list is denied even without prompting for a password
if its declared like,
userlist_deny=NO, those in user_list are ONLY allowed to login.

Whatever the behaviour of user_list, FTP searches for ftpusers file for users that are DENIED!

############## File Access Control List #################

File Access Control Lists:
————————–

#setfacl -m u:rajesh:— /myfile.txt
This would deny all permissions on /myfile.txt to user rajesh!

#setfacl -x u:rajesh /myfile.txt
This would remove user rajesh from the access control list of file /myfile.txt

#getfacl /myfile.txt
This would display the access control list information of the file /myfile.txt

#setfacl -m g:mygrp:rw /myfile.txt
This would give all the members of the group mygrp; read and write access to the file /myfile.txt

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>