Archive

Archive for the ‘UNIX’ Category

Enabling Xmanager in Red Hat 5 EL

March 4th, 2010 sam No comments
For XDMCP connection to Red Hat 5 EL
1. XDM Configuration
1. Change runlevel to 5
Open/etc/inittab and set the initial runlevel to 5 as following:
id:5:initdefault:
2. Enable XDMCP
For GDM:
Open /etc/gdm/custom.conf and set the Enable entry to 1 in the [xdmcp] section as following.
[xdmcp]
Enable=1
For KDM:
Open /usr/share/config/kdm/Xaccess and remove the initial “#” character for the following line:
#* #any host can get a login window ==>
* #any host can get a login window
Open /usr/share/config/kdm/kdmrc and set the Enable entry to true in the [xdmcp] section as following.
[xdmcp]
Enable=true
2. Firewall (TCP/UDP Ports) Configuration
Open UDP port 177 from the PC to the remote host direction.
Open incoming TCP ports 6000~6010 from the remote host to your PC.
3. Reboot the remote host and start Xmanager
# init 3; init 5
Categories: Linux Tags:

How to mount remote windows partition (windows share) under Linux

March 2nd, 2010 sam No comments

How to mount remote windows partition (windows share) under Linux

All files accessible in a Linux (and UNIX) system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree.

Use the mount command to mount remote windows partition or windows share under Linux as follows:

Procedure to mount remote windows partition (NAS share)

1) Make sure you have following information:
==> Windows username and password to access share name
==> Sharename (such as //server/share) or IP address
==> root level access on Linux

2) Login to Linux as a root user (or use su command)

3) Create the required mount point:
# mkdir -p /mnt/ntserver
4) Use the mount command as follows:
# mount -t cifs //ntserver/download -o username=vivek,password=myPassword /mnt/ntserver

Use following command if you are using Old version such as RHEL <=4 or Debian <= 3:
# mount -t smbfs -o username=vivek,password=D1W4x9sw //ntserver/download /mnt/ntserver

5) Access Windows 2003/2000/NT share using cd and ls command:
# cd /mnt/ntserver; ls -l
Where,

  • -t smbfs : File system type to be mount (outdated, use cifs)
  • -t cifs : File system type to be mount
  • -o : are options passed to mount command, in this example I had passed two options. First argument is password (vivek) and second argument is password to connect remote windows box
  • //ntserver/download : Windows 2000/NT share name
  • /mnt/ntserver Linux mount point (to access share after mounting)
Categories: Linux Tags:

How to Remove the User with Root id

February 21st, 2010 sam No comments

I was checking the users in my unix box. Some old users where created by the previous administrator. When i tried to delete from the smc it was throwing error, “The account is mandatory, cant be deleted”.

So, There is a workaround.

1. remove the entry from the passwd file # vi /etc/passwd

2. #pwconv

3. cat /etc/shadow

Categories: UNIX Tags:

Linux change ip address

May 18th, 2009 sam No comments

Q. How do I change ip address in Linux?

A. There are different ways to change IP address in Linux
(a) Command Line tools

(b) Modify configuration files

(c) Use GUI tools

Task: Display current IP address and setting for network interface called eth0

Use ifconfig command:
# ifconfig eth0
Output:

eth0      Link encap:Ethernet  HWaddr 00:30:48:5A:BF:46
          <strong>inet addr:<span style="color: rgb(255, 0, 0);">10.5.123.2</span>  Bcast:<span style="color: rgb(153, 102, 51);">10.5.123.63</span>  Mask:<span style="color: rgb(0, 153, 0);">255.255.255.192</span></strong>
          inet6 addr: fe80::230:48ff:fe5a:bf46/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:728204 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1097451 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:62774749 (59.8 MiB)  TX bytes:1584343634 (1.4 GiB)
          Interrupt:177

Task: Change IP address

You can change ip address using ifconfig command itself. To set IP address 192.168.1.5, enter command:
# ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up
# ifconfig eth0

To make permanent changes to IP address you need to edit configuration file according to your Linux distribution.

Categories: Linux Tags:

Unix Alias for Oracle Database

April 26th, 2009 sam No comments

alias abort=’echo shutdown abort|sqlplus -L -s / as sysdba’

alias alertvi=’vi $ORACLE_HOME/admin/ ORACLE_SID/bdump/alert_ORACLE_SID.log’

alias nomount=’echo startup nomount quiet|sqlplus -L -s / as sysdba’

alias ora=’cd $ORACLE_HOME’

alias pmon=’ps -ef | grep [p]mon’

alias startup=’echo startup quiet|sqlplus -L -s / as sysdba’

alias sysdba=’sqlplus -L / as sysdba’

alias tns=’cd $ORACLE_HOME/network/admin’

alias alert=’tail -100 $ORACLE_LOG/alert_$ORACLE_SID.log|more’

alias blog=’tail -130 /backup/dbbackup.log’

alias bdump=’cd $ORACLE_HOME/admin/sunmoto/bdump’

alias udump=’cd $ORACLE_HOME/admin/sunmoto/udump’

Categories: Uncategorized, UNIX Tags:

Install a Solaris package

March 17th, 2009 sam No comments

Install a Solaris package

If a package file (i.e., from sunfreeware.com) exists in the current directory, this recipe will allow you to install it on the system.


If the package file is called <packagename>:

pkgadd -d <packagename>

Categories: Solaris Tags:

Adding Route in AIX

January 31st, 2009 sam No comments

The easiest way to change the default route is to do the following:

1. Use smitty route->Remove Static Route or issue the route -f to flush the routing table.

2. You should see output to the screen informing you that routes are being removed.

3. Then issue the netstat -rn command. You should not see the default in the routing table.

4. Issue the smitty mkroute command. This is pretty straight forward and it will it will add

this default route to the ODM database and make it permanent even after a system reboot.

5. Issue another netstat -rn command, you should see your new default route.

Categories: AIX, UNIX Tags:

Linux lvm – Logical Volume Manager

January 13th, 2009 sam No comments

Note : This article is from http://www.linuxconfig.org/Linux_lvm_-_Logical_Volume_Manager

This article describes a basic logic behind a Linux logical volume manager by showing real examples of configuration and usage. Despite the fact that Debian Linux will be used for this tutorial, you can also apply the same command line syntax with other Linux distributions such as Red Hat, Mandriva, SuSe Linux and others.

Contents

[hide]


This is what we are going to do

Image:lvm.jpg


Create Partitions

For this Linux lvm example you need a unpartitioned hard disk /dev/sdb. First you need to create physical volumes. To do this you need partitions or a whole disk. It is possible to run pvcreate command on /dev/sdb, but I prefer to use partitions and from partitions I later create physical volumes.

fdis -l

Use your preferred partitioning tool to create partitions. In this example I have used cfdisk.

cfdisk

Partitions are ready to use.

fdisk -l


Create physical volumes

Use the pvcreate command to create physical volumes.

# pvcreate /dev/sdb1<br /># pvcreate /dev/sdb2<br /></pre> <p>The pvdisplay command displays all physical volumes on your system. </p> <pre># pvdisplay<br /></pre> <p>Alternatively the following command should be used: </p> <pre># pvdisplay /dev/sdb1<br /></pre> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager05.jpg" class="image" title="Create physical volumes with pvcreate"><img alt="Create physical volumes with pvcreate" longdesc="/Image:Logicalvolumemanager05.jpg" src="http://www.linuxconfig.org/images/f/fc/Logicalvolumemanager05.jpg" width="508" height="368" /></a> </dd></dl> <a name="Create_Virtual_Group"></a><h2> <span class="mw-headline">Create Virtual Group</span></h2> <p>At this stage you need to create a virtual group which will serve as a container for your physical volumes. To create a virtual group with the name "mynew_vg" which will include /dev/sdb1 partition, you can issue the following command: </p> <pre># vgcreate mynew_vg /dev/sdb1<br /></pre> <p>To include both partitions at once you can use this command: </p> <pre># vgcreate mynew_vg /dev/sdb1 /dev/sdb2<br /></pre> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager06.jpg" class="image" title="Create Virtual Group"><img alt="Create Virtual Group" longdesc="/Image:Logicalvolumemanager06.jpg" src="http://www.linuxconfig.org/images/0/00/Logicalvolumemanager06.jpg" width="508" height="329" /></a> </dd></dl> <p>Feel free to add new physical volumes to a virtual group by using the vgextend command. </p> <pre># vgextend mynew_vg /dev/sdb2<br /></pre> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager07.jpg" class="image" title="virtual group extend"><img alt="virtual group extend" longdesc="/Image:Logicalvolumemanager07.jpg" src="http://www.linuxconfig.org/images/6/60/Logicalvolumemanager07.jpg" width="508" height="329" /></a> </dd></dl> <a name="Create_Logical_Volumes"></a><h2> <span class="mw-headline">Create Logical Volumes</span></h2> <p>From your big cake (virtual group) you can cut pieces (logical volumes) which are treated as a partitions for your linux system. To create a logical volume, named "vol01", with a size of 400 MB from the virtual group "mynew_vg" use the following command: </p> <ul><li> create a logical volume of size 400 MB -L 400 </li><li> create a logical volume of size 4 GB -L 4G </li></ul> <pre># lvcreate -L 400 -n vol01 mynew_vg<br /></pre> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager08.jpg" class="image" title="Create Logical Volumes"><img alt="Create Logical Volumes" longdesc="/Image:Logicalvolumemanager08.jpg" src="http://www.linuxconfig.org/images/e/e9/Logicalvolumemanager08.jpg" width="508" height="238" /></a> </dd></dl> <p>In this case you have created a logical volume with a size of 1GB and the name of vol02 </p> <pre># lvcreate -L 1000 -n vol02 mynew_vg<br /></pre> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager09.jpg" class="image" title="create logical vol01"><img alt="create logical vol01" longdesc="/Image:Logicalvolumemanager09.jpg" src="http://www.linuxconfig.org/images/a/a0/Logicalvolumemanager09.jpg" width="508" height="420" /></a> </dd></dl> <p>Note the free size in virtual group. </p> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager10.jpg" class="image" title="display virtual group"><img alt="display virtual group" longdesc="/Image:Logicalvolumemanager10.jpg" src="http://www.linuxconfig.org/images/6/6a/Logicalvolumemanager10.jpg" width="508" height="303" /></a> </dd></dl> <a name="Create_File_system_on_logical_volumes"></a><h2> <span class="mw-headline">Create File system on logical volumes</span></h2> <p>The logical volume is almost ready to use. All you need to do is to create a filesystem.: </p> <pre># mkfs.ext3 -m 0 /dev/mynew_vg/vol01<br /></pre> <p>the -m option specifies the percentage reserved for the super-user, set this to 0 if you wish not to waste any space, the default is 5%. </p> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager11.jpg" class="image" title="create file system"><img alt="create file system" longdesc="/Image:Logicalvolumemanager11.jpg" src="http://www.linuxconfig.org/images/4/46/Logicalvolumemanager11.jpg" width="508" height="277" /></a> </dd></dl> <a name="Edit_.2Fetc.2Ffstab"></a><h2> <span class="mw-headline">Edit /etc/fstab</span></h2> <p>Add a entry for your newly created logical volume into /etc/fstab </p> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager12.jpg" class="image" title="edit /etc/fstab"><img alt="edit /etc/fstab" longdesc="/Image:Logicalvolumemanager12.jpg" src="http://www.linuxconfig.org/images/4/45/Logicalvolumemanager12.jpg" width="508" height="277" /></a> </dd></dl> <a name="Mount_logical_volumes"></a><h3> <span class="mw-headline">Mount logical volumes</span></h3> <p>Before you mount do not forget to create a mount point. </p> <pre># mkdir /home/foobar<br /></pre> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager13.jpg" class="image" title="mount logical volumes"><img alt="mount logical volumes" longdesc="/Image:Logicalvolumemanager13.jpg" src="http://www.linuxconfig.org/images/a/ae/Logicalvolumemanager13.jpg" width="508" height="108" /></a> </dd></dl> <a name="Extend_logical_volume"></a><h2> <span class="mw-headline">Extend logical volume</span></h2> <p>The biggest advantage of logical volume manager is that you can extend your logical volumes any time you are running out of the space. To increase the size of a logical volume by another 800 MB you can run this command: </p> <pre># lvextend -L +800 /dev/mynew_vg/vol01<br /></pre> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager14.jpg" class="image" title="Image:logicalvolumemanager14.jpg"><img alt="Image:logicalvolumemanager14.jpg" longdesc="/Image:Logicalvolumemanager14.jpg" src="http://www.linuxconfig.org/images/b/b4/Logicalvolumemanager14.jpg" width="616" height="108" /></a> </dd></dl> <p>The command above does not actually increase the physical size of volume, to do that you need to: </p> <pre># resize2fs  /dev/mynew_vg/vol01<br /></pre> <p>Look at the figure below to see what problems you may encounter when extending a volume: </p> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager15.jpg" class="image" title="extend logical volume"><img alt="extend logical volume" longdesc="/Image:Logicalvolumemanager15.jpg" src="http://www.linuxconfig.org/images/6/67/Logicalvolumemanager15.jpg" width="616" height="537" /></a> </dd></dl> <a name="Remove_logical_volume"></a><h2> <span class="mw-headline">Remove logical volume</span></h2> <p>The command lvremove can be used to remove logical volumes. Make sure that before you attempt to remove logical volumes your logical volume does not have any valuable data stored on it, moreover make sure the volume is unmounted. </p> <pre># lvdisplay<br /></pre> <dl><dd><a href="http://www.linuxconfig.org/Image:Logicalvolumemanager16.jpg" class="image" title="display volume group"><img alt="display volume group" longdesc="/Image:Logicalvolumemanager16.jpg" src="http://www.linuxconfig.org/images/b/ba/Logicalvolumemanager16.jpg" width="616" height="394" /></a> </dd></dl> <pre># lvremove /dev/mynew_vg/vol02<br />
remove logical volume


Other Topics


Discussion

Alexander.Orlov 10:35, 30 August 2007 (CDT) Any scenario ideas how/if/why LVM can be combined with GFS or OCFS? Will LVM become obsolete when the networks are fast enough to carry large amounts of data?

A FAQ list for the tutorial

  • Is it possible/advisable to use LVM volumes as swap?
  • Is it possible and/or advisable to use LVMs for external USB storage devices used for backups?
  • Whether it is a good idea to use encrypted LVM volumes; especially encrypted LVM software containing volumes.

I have no answers to these questions yet. Alexander.Orlov 10:35, 30 August 2007 (CDT)


External Links

Technorati Tags:

Categories: Linux Tags:

Installing software from RPM packages

January 10th, 2009 sam No comments

< What is RPM >

RPM
stands for Red Hat Package Manager. However, these days RPM isn’t only
Red Hat specific because many other Linux distros use RPM for managing
their software. For example, both Mandriva and SuSE use RPM for
software management. With RPM, you can install, upgrade and uninstall
software on Linux, as well as keep track of already installed RPM
packages on your system. This can be done because RPM keeps a database
of all software that was installed with it.

RPM uses software packages that have (surprise) the .rpm
extension. An RPM package contains the actual software that gets
installed, maybe some additional files for the software, information on
where the software and its files get installed, and a list of other
files you need to have on your system in order to run this specific
piece of software.

When you use RPM for installing the
software package, RPM checks if your system is suitable for the
software the RPM package contains, figures out where to install the
files the package provides, installs them on your system, and adds that
piece of software into its database of installed RPM packages.

Note
that different Linux distros may keep their software and the files
related to that software in different directories. That’s why it’s
important to use the RPM package that was made for your distribution.
For example, if you install a SuSE specific software package on a Red
Hat system, RPM may put the files from that package into wrong
directories. In the worst case the result is that the program doesn’t
find all the files it needs and doesn’t work properly.

There
are some good graphical programs for installing RPM packages, but in
this tuXfile I’ll discuss the fool-proof command line method for
installing software. Note that you need to be root when installing
software in Linux. When you’ve got the root privileges, you use the rpm command with appropriate options to manage your RPM software packages.

< Installing and upgrading RPM packages >

For installing a software package, you use the rpm command with -i option (which stands for “install”). For example, to install an RPM package called software-2.3.4.rpm:
# rpm -i software-2.3.4.rpm

If you already have some version installed on your system and want to upgrade it to the new version, you use -U option instead (which stands for “upgrade”). For example, if you have software-2.3.3.rpm installed and want to upgrade it:
# rpm -U software-2.3.4.rpm

If
all goes well, the files in your package will get installed into your
system and you can happily run your new program. But where is your new
program? Note that rpm doesn’t usually create a special
directory for the software package’s files. Instead, the different
files from the package get placed into appropriate existing directories
on your Linux system. Executable programs go usually into /bin,
/usr/bin, /usr/X11/bin, or /usr/X11R6/bin after installing with rpm.

But
how can you run your new program if you don’t know where the executable
is? Sometimes the program gets automatically added into your menu, but
usually you can just run the program by typing its name at the command
prompt. In most cases you don’t have to know where the program was
installed because you don’t have to type the whole path when running
the program, only the program’s name is needed.

< Error: failed dependencies >

Issuing rpm -i or rpm -U
installs the software and you can start using it. RPM is very easy when
it works. However, RPM can be a devil when it doesn’t work. There are
many reasons why installing software goes wrong, but usually it’s
because of failed dependencies.

You see, many Linux
programs need other files or programs in order to work properly. In
other words, a certain piece of software depends on other
software. When you try to install an RPM package, RPM automatically
checks its database for other files that the software being installed
needs. If RPM can’t find those files in its database, it stops
installing the software and complains about failed dependencies.

When
you get a dependency error, RPM spits out a list of files the program
needs. Take a look at the list. The files in the list are probably ones
you don’t have on your system, or files you have but are wrong
versions. When you get the dreaded dependency error, you’ll have to
find the files RPM complains about, install or upgrade those files
first, and then try to install the package you were installing in the
first place.

However, sometimes RPM is just plain stupid. You see, only software that was installed with RPM
gets added into the database of installed software. This means that if
you’ve used some other method for installing a certain program, RPM
doesn’t know the program exists on your system. In this case RPM
complains about failed dependencies even when the needed program does
exist on your system and there are no failed dependencies!

If you know the needed files are there and RPM is just being stupid, you can ignore the dependencies. Use the --nodeps option if you want to tell RPM not to check any dependencies before installing the package:
# rpm -i software-2.3.4.rpm --nodeps

This
forces RPM to ignore dependency errors and install software anyway, but
note that if the needed files are missing anyway, the program won’t
work well or won’t work at all. Use the --nodeps option only when you know what you’re doing or when you’re bone-headed enough ;-)

< Removing software installed with RPM >

To remove software that was installed with RPM, you use the -e option (which stands for “erase”):
# rpm -e software-2.3.4

Note that when installing software, you have to type the name of the RPM package. But when removing software, you don’t have to type the whole name of the package that contained the software. You don’t have to type the .rpm
extension when removing software. Probably you don’t have to type the
version number, either, so this would do exactly the same as the above:
# rpm -e software

This rpm -e
command uses the RPM database to check where all the files related to
this software were installed and then automatically removes all of
those files. After removing the program files, it also removes the
program from the database of installed software.

This is why it’s so important you NEVER remove RPM software manually (for example, deleting single files with rm).
If you just run around your system randomly deleting files that were
installed with RPM, you’ll get rid of the software but RPM doesn’t know
it and doesn’t remove the software package from its database. The
result is that RPM still thinks the program is installed on your
system, and you may run into dependency problems later.

If you used RPM for installing a certain piece of software, use RPM for removing that piece of software, too!

< Querying the RPM database >

As
you already know, the RPM database contains a list of all installed RPM
packages on your system. You can query this database to get info of the
packages on your Linux system. To query a single package, you use the -q option. For example, to query a package whose name is “software”:
# rpm -q software

After issuing this command, rpm either tells you the version of the package, or that the package isn’t installed.

If you want a list of all packages installed on your system, you’ll have to query all with -qa:
# rpm -qa

Most likely this list will be very long, so you’ll need a way to scroll it. The best way is to pipe the list to less:
# rpm -qa | less

If you’re looking for packages whose names contain a specific word, you can use grep
for finding those packages. For example, to get a list of all installed
RPM packages whose names contain the word “kde”, you could do something
like this:
# rpm -qa | grep kde

The above command makes rpm list all packages in its database and pass the list to grep. Then grep checks every line for “kde” and finally shows you all the lines that contain the word “kde”.

Categories: Linux Tags:

Raw Devices on RHEL 5 or OEL 5

January 6th, 2009 sam No comments

Raw Devices on RHEL 5 or OEL 5

Be aware that raw device technology had been deprecated in RedHat Linux 5 (RHEL5) and Oracle Enterprise Linux 5 OEL5). / Linux Kernel 2.6
Does this mean we cannot use Rawdevices in RHEL5 or OEL5? As always there’s a workaround to make this happen by means of UDEV technique and Oracle 11g & 10gR2 has options to configure components to access the block devices directly instead of rawdevices.
Before we jump into the workaround, let see what exactly is missing at the O/S level w.r.to rawdevices in RHEL5 and OEL5,

  1. /etc/sysconfig/rawdevices file doesn’t exist
  2. /dev/raw doesn’t exist.
  3. Service by the name “rawdevices” doesn’t exist.

Trying to run the command “service rawdevices restart” will result in “rawdevices: unrecognized service”.

Now lets see an example of configuring rawdevices in RHEL4 and RHEL5.

RHEL4

To map a rawdevice to a block device /dev/sdf1

Step 1: Make an entry in /etc/sysconfig/rawdevices file

/dev/raw/raw1 /dev/sdf1

Step 2: For the mapping to have immediate effect, restart the rawdevices service.

$>service rawdevices restart

Step 3: Change ownership to oracle user

$>chown oracle:dba /dev/raw/raw1

RHEL5 / OEL5

Step 1: Make an entry in /etc/udev/rules.d/60-raw.rules or create your own file viz., /etc/udev/rules.d/<any_no_above_60>-oracle-raw.rules (eg. 63-oracle-raw.rules)

ACTION==”add”, KERNEL==”sdf1″, RUN+=”/bin/raw /dev/raw/raw1 %N”

Step 2: For the mapping to have immediate effect, run below command

$>/bin/raw /dev/raw/raw1 /dev/sdf1

So if you or your system administrator have plans to upgrade an existing release of RHEL or OEL to RHEL5 / OEL5 or planning to perform a new installation of RAC on RHEL5 / OEL5, wherein rawdevices will be / are used, please do take additional care.

For more information you can refer to following
Metalink notes

RAC FAQ: 220970.1 (look for “What storage option should I use for RAC 10g on Linux? ASM / OCFS / Raw Devices / Block Devices / Ext3 ?”)
How to map raw device on RHEL5 and OEL5 – Note 443996.1
Linux 2.6 Kernel Deprecation Of Raw Devices – Note:357492.1
How to install Oracle Clusterware with shared storage on block devices – Note:401132.1

Blogs / Forums
http://frits.homelinux.com/wordpress/?p=27 – Thanks to Frits Hoogland for sharing this information and also for the article on configuring 11g with ASM on CentOS on VMware.
http://www.webservertalk.com/archive221-2007-5-1884747.html – Thanks to Rupan for the explanation on Rawdevices and Block Devices.

Technorati Tags:

Categories: DBA, Linux Tags: