Linux Microsoft VMware

Wednesday, August 29, 2012

Upgrading Red Hat Enterprise Linux From Version 6.2 to 6.3


Red Hat Enterprise Linux v6.3 has been released and available via RHN for immediate update. How do I upgrade my RHEL from 6.2 to the latest 6.3 version?

You can only upgrade from minor release as Red Hat does not support in-place upgrades between any major versions of Red Hat Enterprise Linux. However, a minor upgrade can be done easily and recommended for all users.

Back up any important data on the server

Make a backup - it cannot be stressed enough how important it is to make a backup of your system before you do this. Most of the actions listed in this post are written with the assumption that they will be executed by the root user running the bash or any other modern shell. Type the following commands to see current version:

# uname -mrs

# cat /etc/redhat-release

RHEL: Upgrading your current system

Type the following yum command:

# yum update -y

Reboot the Linux server:

reboot

OR

shutdown -r now

Verify that everything is working fine:

# uname -a

# cat /etc/redhat_release

# netstat -tulpn

# tail -f /var/log/messages

# tail -f /path/to/log/file

# ps aux | less

# ps aux | egrep 'httpd|mysql'

CentOS / RHEL: Disable or Enable SELinux Policy Modules


H
ow do I disable or enable SELinux policy modules under Red Hat Enterprise Linux running on Dell hardware?

You need to use the semodule command. This command is used to manage SELinux policy modules, including installing, upgrading, listing, disabling and removing modules.

Task: See currently installed modules

Type the following command as the root user:

semodule –l
semodule -l | more
semodule | less

Sample outputs:

abrt    1.2.0
accountsd       1.0.0
ada     1.4.0
afs     1.5.3
aiccu   1.0.0
aide    1.5.0
aisexec 1.0.0
amanda  1.12.0
amavis  1.10.3
amtu    1.2.0
apache  2.1.2
apcupsd 1.6.1
arpwatch        1.8.1
asterisk        1.7.1
audioentropy    1.6.0
automount       1.12.1
avahi   1.11.2
awstats 1.2.0
bind    1.10.2
bitlbee 1.2.1
bluetooth       3.2.2
....
..
..
 Output truncated
....
..
uuidd   1.0.0
varnishd        1.1.0
vdagent 1.0.0
vhostmd 1.0.0
virt    1.4.0
vmware  2.2.0
vpn     1.12.0
w3c     1.0.0
wdmd    1.0.0
webadm  1.1.0
webalizer       1.10.0
wine    1.6.1
xen     1.9.2
xfs     1.6.0
xguest  1.0.1
zabbix  1.2.0
zarafa  1.0.0
zebra   1.10.1
zosremote       1.1.0

Task: SELinux disable module

To disable existing module, type:

 semodule -d MODULE_NAME_HERE

OR

 semodule --disable=MODULE_NAME_HERE

To disable module called webalizer, enter:

# semodule -v -d webalizer

To verify new settings, enter:

# semodule -l | grep webalizer

Sample outputs:

[root@rhel6 ~]# semodule -v -d webalizer
Attempting to disable module 'webalizer':
Ok: return value of 0.
Committing changes:
Ok: transaction number 0.
[root@rhel6 ~]# semodule -l | grep webalizer
webalizer       1.10.0  Disabled

Task: SELinux enable module

To enable existing module, type:

 semodule -e MODULE_NAME_HERE 

OR

# semodule --enable=MODULE_NAME_HERE

To enable module called webalizer, enter:

# semodule -v -e webalizer

Sample outputs:

Attempting to enable module 'webalizer':
Ok: return value of 0.
Committing changes:
Ok: transaction number 0.

yum command: Update / Install Packages Under Redhat Enterprise / CentOS Linux Version 5.x


H
ow do I use yum command to update and patch my Red hat Enterprise Linux / CentOS Linux version 5.x server via RHN / Internet? Can I use up2date command under RHEL 5?

Up2date command was part of RHEL v4.x or older version. You need to use yum command to update and patch the system using RHN or Internet. Use yum command to install critical and non-critical security updates as well as binary packages. Login as the root user to install and update the system.

Task: Register my system with RHN

To register your system with RHN type the following command and just follow on screen instructions (CentOS user skip to next step):

[root@system1 ~]# rhn_register       

Task: Display list of updated software (security fix)

Type the following command at shell prompt:

# yum list updates

Task: Patch up system by applying all updates

To download and install all updates type the following command:

# yum update

Task: List all installed packages

List all installed packages, enter:

# rpm -qa

# yum list installed

Find out if httpd package installed or not, enter:

# rpm -qa | grep httpd*

# yum list installed httpd

Task: Check for and update specified packages

# yum update {package-name-1}

To check for and update httpd package, enter:

# yum update httpd

Task: Search for packages by name

Search httpd and all matching perl packages, enter:

# yum list {package-name}

# yum list {regex}

# yum list httpd

# yum list perl*

Sample output:

Loading "installonlyn" plugin
Loading "security" plugin
Setting up repositories
Reading repository metadata in from local files
Installed Packages
perl.i386                                4:5.8.8-10.el5_0.2     installed
perl-Archive-Tar.noarch                  1.30-1.fc6             installed
perl-BSD-Resource.i386                   1.28-1.fc6.1           installed
perl-Compress-Zlib.i386                  1.42-1.fc6             installed
perl-DBD-MySQL.i386                      3.0007-1.fc6           installed
perl-DBI.i386                            1.52-1.fc6             installed
perl-Digest-HMAC.noarch                  1.01-15                installed
perl-Digest-SHA1.i386                    2.11-1.2.1             installed
perl-HTML-Parser.i386                    3.55-1.fc6             installed
.....
.......
..
perl-libxml-perl.noarch                  0.08-1.2.1             base
perl-suidperl.i386                       4:5.8.8-10.el5_0.2     updates 

Task: Install the specified packages [ RPM(s) ]

Install package called httpd:

# yum install {package-name-1} {package-name-2}

# yum install httpd

Task: Remove / Uninstall the specified packages [ RPM(s) ]

Remove package called httpd, enter:

# yum remove {package-name-1} {package-name-2}

# yum remove httpd

Task: Display the list of available packages

# yum list all

Task: Display list of group software

Type the following command:

# yum grouplist

Output:

Installed Groups:
   Engineering and Scientific
   MySQL Database
   Editors
   System Tools
   Text-based Internet
   Legacy Network Server
   DNS Name Server
   Dialup Networking Support
   FTP Server
   Network Servers
   Legacy Software Development
   Legacy Software Support
   Development Libraries
   Graphics
   Web Server
   Ruby
   Printing Support
   Mail Server
   Server Configuration Tools
   PostgreSQL Database
Available Groups:
   Office/Productivity
   Administration Tools
   Beagle
   Development Tools
   GNOME Software Development
   X Software Development
   Virtualization
   GNOME Desktop Environment
   Authoring and Publishing
   Mono
   Games and Entertainment
   XFCE-4.4
   Tomboy
   Java
   Java Development
   Emacs
   X Window System
   Windows File Server
   KDE Software Development
   KDE (K Desktop Environment)
   Horde
   Sound and Video
   FreeNX and NX
   News Server
   Yum Utilities
   Graphical Internet
Done

Task: Install all the default packages by group

Install all 'Development Tools' group packages, enter:

# yum groupinstall "Development Tools"

Task: Update all the default packages by group

Update all 'Development Tools' group packages, enter:

# yum groupupdate "Development Tools"

Task: Remove all packages in a group

Remove all 'Development Tools' group packages, enter:

# yum groupremove "Development Tools"

Task: Install particular architecture package

If you are using 64 bit RHEL version it is possible to install 32 packages:
# yum install {package-name}.{architecture}

# yum install mysql.i386

Task: Display packages not installed via official RHN subscribed repos

Show all packages not available via subscribed channels or repositories i.e show packages installed via other repos:

# yum list extras

Sample output:

Loading "installonlyn" plugin
Loading "security" plugin
Setting up repositories
Reading repository metadata in from local files
Extra Packages
DenyHosts.noarch                         2.6-python2.4          installed
VMwareTools.i386                         6532-44356             installed
john.i386                                1.7.0.2-3.el5.rf       installed
kernel.i686                              2.6.18-8.1.15.el5      installed
kernel-devel.i686                        2.6.18-8.1.15.el5      installed
lighttpd.i386                            1.4.18-1.el5.rf        installed
lighttpd-fastcgi.i386                    1.4.18-1.el5.rf        installed
psad.i386                                2.1-1                  installed
rssh.i386                                2.3.2-1.2.el5.rf       installed

Task: Display what package provides the file

You can easily find out what RPM package provides the file. For example find out what provides the /etc/passwd file:

# yum whatprovides /etc/passwd

Sample output:

Loading "installonlyn" plugin
Loading "security" plugin
Setting up repositories
Reading repository metadata in from local files
setup.noarch                             2.5.58-1.el5           base
Matched from:
/etc/passwd
setup.noarch                             2.5.58-1.el5           installed
Matched from:
/etc/passwd

You can use same command to list packages that satisfy dependencies:

# yum whatprovides {dependency-1} {dependency-2}

Refer yum command man page for more information:

# man yum

NFS Server and Client Configuration in RHEL / CENTOS / Fedora (Basic)


Server Side
NFS Package Installation

[root@system1 ~]# yum install nfs*

Create a shared directory with appropriate permission to access

[root@system1 ~]# cd /

[root@system1 /]# mkdir redhat

[root@system1 /]# ls
bin   dev  home  lost+found  misc  net  proc    root  selinux  sys  usr
boot  etc  lib   media       mnt   opt  redhat  sbin  srv      tmp  var

[root@system1 /]# cd redhat

Create sample files in to that

[root@system1 redhat]#  touch  ma ba ca

Check the service status

[root@system1 /]# service nfs status
 
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped

Put a share entry in vim /etc/exports

[root@system1 /]# vim etc/exports
 
/redhat         192.168.0.100(rw)
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
"etc/exports" 1L, 27C

Start the service

[root@system1 /]# service nfs start
 
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]

[root@system1 /]# chkconfig nfs on

Output verification

[root@system1 /]# exportfs
/redhat         192.168.0.100

Client Side

In client side create a directory to mount the NFS sharing what you made in server side.

[root@system2 /]# mkdir /data


Commands used at the client end to verify the sharing availability:-

[root@system2 /]# showmount -e <nfs server ip_address> ( or )
[root@system2 /]# showmount -e <nfs server hostname>   ( or )
[root@system2 /]# showmount -e <nfs server FQDN>


Mounting of NFS sharing

There are two types of mounting is possible, that is temporary mount and other is permanent mount by put an entry in /etc/fstab

[root@system2 /]# mount -t nfs 192.168.0.100:/redhat /data

Check this by type ls command and see the file content is present or not

Entry in vim /etc/fstab

[root@system2 /]# vim /etc/fstab
 
#
# /etc/fstab
# Created by anaconda on Mon Aug 13 21:49:03 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
sysfs                     /sys     sysfs  defaults  0 0
proc                      /proc    proc   defaults  0 0
192.168.0.100:/redhat     /data    nfs    defaults  0 0


[root@system2 /]# mount -a

Now we have a permanent mount path for NFS file sharing in client machine.

That’s it….
Powered by Blogger.