Thursday, October 20, 2011

Set PATH variable in UNIX

The PATH environment variable is a colon-delimited list of directories that your shell searches through when you enter a command.

Program files (executables) are kept in many different places on the Unix system. Your path tells the Unix shell where to look on the system when you request a particular program. Having more directories in your path will reduce the number of times you get "Command not found" errors, but might put you at greater risk of activating a Trojan horse.
To find out what your path is, at the Unix shell prompt, enter:
echo $PATH
Your path will look something like the following.
/usr2/username/bin:/usr/local/bin:/usr/bin:.

You will see your username in place of username. Using the above example path, if you enter the ls command, your shell will look for the appropriate executable file in the following order: first, it would look through the directory /usr2/username/bin, then /usr/local/bin, then /usr/bin, and finally the local directory, indicated by the . (a period).

To modify your path
If you are using csh or tcsh, at the shell prompt, enter:
setenv PATH $PATH\:/dir/path

If you are using sh, ksh, or bash, at the shell prompt, enter:
PATH=$PATH\:/dir/path ; export PATH

In all cases, replace /dir/path with the directory you want the shell to search.

Note: The earlier entries in the path take precedence over the later ones. If you want the directories you add to your path to take precedence, in the examples above, replace $PATH\:/dir/path with /dir/path:$PATH .

To make these changes permanent, add the commands described above to the end of your .cshrc file (for csh and tcsh), .profile file (for sh and ksh), or .bash_profile file (for bash).

Source: http://kb.iu.edu/data/acar.html
Have a nice day!

Solaris "sys-unconfig" to modify basic settings


Sometimes, we run into chnaging hostname, ipaddress and network settings on Sun Solaris servers. We can do it by modifying /etc/hosts, /etc/hostname."nic", netmasks, nodename and etc. But modyfying these files won't change network settings or hostname in some situations. In these situations our best tool is "sys-unconfig".


Friday, October 7, 2011

Moving /usr, /var & /opt to a different partition in Solaris

1. Add new hard drive to make new partitions


2. Boot server with cdrom in single user mode # boot cdrom –s

3. Mount the partition where we are copying from # mount –o rw /dev/dsk/c1t0d0s0 /mnt

4. Mount the partition where we are copying to # mount –o rw /dev/dsk/c1t2d0s0 /mnt/test

5. Go to /mnt/test folder – # cd /mnt/test

6. Run this command to copy stuff # ufsdump 0f - /mnt/usr | ufsrestore rf –

7. Go to # cd /mnt/test/usr and run “mv * ..”

8. The above step copy all files form usr sub folder to root folder

9. Go to # cd /mnt/test

10. Make a dir local # mkdir /mnt/test/local

11. Type cd /

12. # umount /mnt/test

13. DO above steps from 4 to 9 for moving var folder

14. Creat a subfolder “run” under /var folder on new partition /mnt/test # mkdir /mnt/test/run . This is very critical for coming root in multiuser mode.

15. Type cd /

16. #umount /mnt/test

17. Do above steps for moving “opt” folder for steps 4 to 12 except step 10

18. Type cd / ; #umount /mnt/test

19. Now go to the /mnt folder (Which is the main root file system)

20. Move directories to # mv usr usr.bak ; # mv var var.bak ; # mv opt opt.bak to roll back all changes if needed

21. Create usr, var and opt folders # mkdir usr, #mkdir var; #mkdir opt

22. Some time the newly created usr folder needs these parameters to set # chown root /mnt/usr; #chgrp sys /mnt/sys; #chmod 755 /mnt/usr

23. Modify the vfstab file # EDITOR=vi; # export vi; # TERM=vt100; # export TERM; # vi /mnt/etc/vfstab and do respect changes

24. Do not forget “-“ mount option at the end and it looks like

25. “ /dev/dsk/c1t2d0s0 /dev/rdsk/c1t2d0s0 /usr ufs 1 no - “

26. Reboot or STOP +a boot -ar

Friday, September 30, 2011

VMWARE Free Tools


Here is the link for free VMWare tools:

http://vsphere-land.com/vinfo/free-tools

I like "rvtools" tool. It helps in reporting and installing or upgrading VMware Tools on Guest systems.


Have a nice day! 


Wednesday, September 28, 2011

pcieb: cannot load driver in Solaris


If you get thsi following error:
Rebooting with command: boot

Use is subject to license terms.
pcieb: cannot load driver
pcieb: cannot load driver
Cannot load drivers for /pci@0,600000/pci@0/pci@0/scsi@0/disk@0,0:d
Can't load the root filesystem
Type 'go' to resume
{0} ok

SPARC Enterprise



Recommended Action:

If the messages showed in are displayed, please edit both the

/etc/name_to_major file and the /etc/driver_aliases file by the

following procedure before rebooting the system.


1) Change the driver names in the /etc/name_to_major file as shown
below by using vi editor.

Before Changing - -  After Changing

-------------------------------------
pcieb - - px_pci
pcieb_bcm - - pxb_bcm
nulldriver - -  pxb_plx
-------------------------------------

# TERM=vt100
# export TERM
# cd /etc
# vi name_to_major

pcieb 242
^^^^^ Change to "px_pci"
pcieb_bcm 264
^^^^^^^^^ Change to "pxb_bcm"
nulldriver 265
^^^^^^^^^^ Change to "pxb_plx"

2) Change the driver names in the /etc/driver_aliases file as shown
below by using vi editor.

Before Changing - - After Changing
-------------------------------------
pcieb -  -  px_pci
pcieb_bcm - -  pxb_bcm
-------------------------------------

# cd /etc
# vi driver_aliases

pcieb "pciexclass,060400"
^^^^^ Change to "px_pci"
pcieb_bcm "pciex1166,103"
^^^^^^^^^ Change to "pxb_bcm"

3) Reboot system
# shutdown -y -i6 -g0

If are unable to do on a server, try rebooting the server with CD. Mount the root file system and do the above actions.

Have a nice day!

Set the Date and Time on Solaris

Setting the system date and time is fairly easy on solaris. Because you can easily set the time from the command line, you can set the time on a server remotely.


date mmddhhmmyy

The date command takes the syntax mmddhhmmyy, or “month day hour minute year”. You have to be superuser to set the time.

Example:

# date 1201010111

Fri Dec 1 01:01:00 PST 2011


Have a nice Day!

Monday, September 26, 2011

Enable and Disable a Service in Soalris 10


Take example of  ntp service:

Enable ntp


inetadm -e ntp

Disable ntp

inetadm -d ntp

More info

man inetadm

man svcadm
 
Its a small tip. Have a nice day!
 

Saturday, September 24, 2011

Remove Old Hidden Devices from a VM after P2V Conversion


After you have converted a Windows server to a virtual machine, some redundant hardware devices may not be removed in the process. This also applies in disaster recovery scnario when the server is restored on a different/same hardware, some redundant hardware devices may not be removed.

I have seen this commonly with network devices. When setting the IP in a VM you may get and error saying a network card already has that IP assigned. But you couldn't find any other network devices. Well there might be, but there hidden and you just need to reveal them and remove them.

Open a command prompt on the Windows VM/Server (Start --> Run --> cmd).

set devmgr_show_nonpresent_devices=1

devmgmt.msc

In the device management console (View --> Show Hidden Devices).

Uninstall the devices that are no longer required. Such as old network devices.
 
Have a nice day!

Saturday, September 17, 2011

Linux Admin Tools




RedHat Admin Tools:


/usr/sbin/redhat-config-bind           /usr/sbin/redhat-config-packages
/usr/sbin/redhat-config-bind-gui       /usr/sbin/redhat-config-printer
/usr/sbin/redhat-config-kickstart      /usr/sbin/redhat-config-printer-gui
/usr/sbin/redhat-config-network        /usr/sbin/redhat-config-printer-tui
/usr/sbin/redhat-config-network-cmd    /usr/sbin/redhat-config-proc
/usr/sbin/redhat-config-network-druid  /usr/sbin/redhat-config-services



Suse Linux Tools:

YaST & YaST2

  Other Linux System administration tools are :
  • Linuxconf http://www.solucorp.qc.ca/linuxconf Linuxconf is a extremely large project. It is tremendously powerful and has large number of features. Linuxconf is the BEST KNOWN system admin tool for Linux!! It is available in all distros like Redhat, Debian, Suse, and others. The Linuxconf is the equivalent of SAM of HPUX and SMITTY of AIX. It runs on console window and as well as in GUI in X-Window. On Debian Linux to download and install just do 'apt-get linuxconf'.
  • The Webmin is the most powerful and very popular system admin tool for Linux. Webmin is so popular and it was awarded the best System Administration tool for Solaris, BSD, Linux, HPUX, AIX, SCO and others. Webmin had been winning awards year after year for the past 5 years by many organisations, conferences and editors. Webmin can also be used for admin of other OSes like AIX, Solaris, HPUX, IRIX, BSD, SCO Unix, OSF, Darwin, Apple Macintosh Mac OS X and Cygwin. The best supported systems at the moment are Solaris, Linux (Redhat in particular) and FreeBSD. Webmin is written in Perl and Perl is universal like "C" and unlike "C" it is scripting language. Perl is "cousin-brother" of "C" language. But major drawback is that you need a X-Window system, Apache Webserver and Perl installed and running before using Webmin. And here is where Linuxconf fills the gap - you do not need X-Window and others to run Linuxconf. Linuxconf can run even in dumb text-terminal console with ncurses. The Webmin is at http://www.webmin.com . Go here and download the Webmin package.


    Have a nice day!

    Source: http://oss.sgi.com/LDP/HOWTO/Kernel-HOWTO/linux_admin_tools.html

Thursday, September 15, 2011

Changing Host name and IP address in Solaris 10

Changing host name only:

Change the hostname in the following files:


/etc/nodename

/etc/hostname.*interface

/etc/inet/hosts

/etc/inet/ipnodes

and rename directory under /var/crash

# cd /var/crash

# mv oldname newname
then reboot the server.

Changing IP address:
To change an IP address on a Solaris system immediately, use the `ifconfig` command.

The syntax for `ifconfig` is:
ifconfig  "interface" "ip address" "netmask" "broadcast address"

If you don't know the names of your network interfaces, use the `ifconfig -a` command to list all of the available network interfaces.

Permanently Change an IP Address on Solaris:
To make this change permanent, you will need to edit one or more Solaris configuration files. If you do not, then your IP address will change back to the old address the next time you reboot the system.


You will need to edit the hosts entry in /etc/hosts.

If you have moved the system to a new network, you will need to change the default route in /etc/defaultrouter.

If you are using VLSM (Variable Length Subnet Masks), you may need to edit /etc/netmasks.

If you are using Solaris 9 or above, you may need to edit the IP address in /etc/inet/ipnodes.

You should then reboot the server to test your changes and ensure that they operate correctly

Wednesday, September 14, 2011

Vmware Suse Linux 32 bit server - Enable 16 GB memory

Recently I have ran an issue while installing and configuring 32 bit Suse Linux server on Vmware paltform. The Linux 32 bit systems couldn't recognise more than 4 Gb memory. The default kernel for Suse Linux 64 bit systems is bigsmp, which can read memory more than 4 GB. The default kernel for 32 bit Suse Linux systems is "smp", which can read up to 3 GB memory. Here I am discussing two tips to overcome this limit:

1. Install all physical RAM or assign total meory (like 16 GB)in Vmware settings before installing Suse 32 bit OS. It will take care of automatically and installs "bigsmp" kernel. You can see the total memory recognized by os with "free" commnad and it should be shown 16 GB.

2. If you want increase total memory after initial install of SuSe Linux 32 bit Os, you need to install "bigsmp" rpm from second or third OS dvd after installing physical RAM/allotting RAM in Vmware.

Have a nice day!

SusE Linux 32 Bit and 64 Bit Kerenel SHMMAX

Recently I have ran in an issue when installing Oracle on 32 bit Linux server and tried to setup kernel parameter "shmmax or seg size" more than 4 GB and it was showing shared memory as 0 bytes.

For 64 bit systems you can add this parameter in sysctl.conf
# vi /etc/sysctl.conf
add these lines
kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 1024
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144

64 bit servers without above parameters, it will take default vaule for shmmax.
Problem occurs for only 32 bit systems, and you need to setup shmmax value less than 4 GB and here are the parameters to add sysctl.conf:

# vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6553600
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144

We need run "sysctl -p" to take changes immediately. You can use "ipcs -l" command for check affective parameters.

Have a Nice day!

Wednesday, July 6, 2011

Disabling IPv6 on Windows 2008

Disabling IPv6 on Windows 2008
I have run into nothing but trouble with IPv6. Not that there is anything in particular that is wrong, but not all apps understand and can work with it. For example I am running a geographically dispersed cluster on a Windows server with 2008 Exchange 2007 on a Dell 2950. I am getting these odd Event Log errors 2501, 2601 and 2604.

When updating security for a remote procedure call (RPC) access for the Exchange Active Directory Topology service, Exchange could not retrieve the security descriptor for Exchange server object xxxxxxx - Error code=8007077f. The Exchange Active Directory Topology service will continue with limited permissions.

For my experience it turns out a tunnel adapter on the 2950 is mapping a DNS record on IPv6. I thought I had disabled all the IPv6 pieces but I was mistaken.

The following recipe should be what is needed to disable all pieces of IPv6 on Windows Server 2008 (As well as Vista) as well as enabling ping on IPv4.


Enable Pings, Firewall doesn't allow IPv4 pings
Server Manager / Configuration / Windows Firewall with Advanced... / Inbound Rules
Action / New Rule
Select Custom
Next
Select All Programs
Next
Protocol Type = ICMPv4
Next
Local Ip Address = Any
Remote IP Address = Any
Next
Select allow the connection
Next
Check Domain
Check Private
Check Public
Next
Name = IPv4
Finish

Network
Right Click Network Places
Select Manage Network Connections For each enabled and used NIC
Right Click - Local Area Connection - Select Properties
Networking Tab
DeSelect IPv6
Close

Disables tunneling but not the loopback interface
Regedit (For additional info http://technet.microsoft.com/en-us/library/bb878057.aspx)
Add the following key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6Parameters\DisabledComponents
DWORD => FFFFFFFF

Change the Nic Provider Order
Network Connections
Advanced
Advanced Settings
Provider Order
Move Microsoft Windows Networks to the Top.

Source:http://blogs.dirteam.com/blogs/paulbergson/archive/2009/03/19/disabling-ipv6-on-windows-2008.aspx
Author : Paul Bergson

Have a Nice day!

Tuesday, June 28, 2011

Extending LVM in Suse 11

1. Add virtual disk with required space in Vmware for virtual server or physical disk on a physical server
2. Reboot the server
3. Run #fdisk /dev/sdc (new hard drive)
4. Type m for help
5. Type “v” existing volumes (should be none)
6. Type “n” for new partition
7. Type “p” for primary partition
8. Select all defaults
9. Type “w” for save and exit
10. It will create Linux native partition. You can create same partition using “partitioner” in yast2
11. Run this command to create physical volume # pvcreate /dev/sdc1
12. Run “pvdisplay” to see physical volumes
13. Now you can extend existing volume group using # vgextend soa /dev/sdc1. Here soa is the existing volume group.
14. The above step extends the volume group by adding new physical volume.
15. Now you can resize or extend the existing mount points or volumes on volume group using “partitioner” in yast2.
16. In yast2 click partitioner - click volume group “soa”
17. It will show the existing volumes on “soa”. Now select each volume and click resize button to extend volume.
Here is the link for more info:
http://www.faqs.org/docs/Linux-HOWTO/LVM-HOWTO.html#AEN546

Have a nice day!

Saturday, June 18, 2011

Changing ILOM root password

Please follwo this steps to change ILOM root password

1. Login to ILOM using root
2. Change the directory ---> cd /SP/users
3. Run this command "set /SP/users/root password"
4. It prompts you "enter new password"
5. It prompts you to "reenter new password"
6. You are done...password for root user has been changed

Have a nice day!

Thursday, May 5, 2011

Integration of Tommcat App Server and Apache Web Server

Building a Web Server, for Windows

Requirements
Java 1.5 JDK (SDK), Apache 2.2, mod_jk 1.2
Download them and install them.

Our Configuration
Java JDK path : D:\jdk1.5.0_07
Apache path : D:\Apache2
Tomcat path : D:\tomcat5
JSP/Servlet webroot (via Apache2/mod_jk) : D:\tomcat5\webapps
JSP/Servlet webroot (via native Tomcat server, port 8080) : D:\tomcat5\webapps
Access JSP/Servlet pages via Apache2/mod_jk : http://localhost/[jkmount-mapped url of your webapp]
Access native Tomcat server : http://localhost:8080/
Install Java 1.5 JDK
Run file jdk-1_5_0_07-windows-i586-p.exe
Install under your %SystemDrive% (D:\), forming D:\jdk1.5.0_07
Unpack and place Tomcat5 and mod_jk
Unpack file apache-tomcat-5.5.17.tar.gz under directory D:\www
Rename directory D:\apache-tomcat-5.5.17 to D:\tomcat5
Rename file mod_jk-apache-2.x.xx.so to mod_jk.so, and place under directory D:\Apache2\modules
Configuration and Setup
Set Environmental Variables : JAVA_HOME=D:\jdk1.5.0_07 and CATALINA_HOME=D:\tomcat5
Set variables under Start » Settings » Control Panel » System » Advanced » Environment Variables » System variables » New...


To add worker (Worker is nothing but connector.)

Create empty file D:\Apache2\conf\workers.properties, insert code...
workers.tomcat_home=D:/www/tomcat5
workers.java_home=D:/jdk1.5.0_07
ps=\

# Define worker 'test1'
worker.list=test1

# Set properties for worker 'test1' (ajp13)
worker.test1.type=ajp13
worker.test1.host=localhost
worker.test1.port=8009

worker.test1.cachesize=10
worker.test1.cache_timeout=600
worker.test1.socket_keepalive=1
worker.test1.recycle_timeout=300

To add virtual directories

Edit file D:\Apache2\conf\httpd.conf, insert code...
LoadModule jk_module modules/mod_jk.so
<<>> /ifmodule mod_jk.c
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
Alias /jsp-examples "D:/tomcat5/webapps/jsp-examples/"
<<>> /directory
Options Indexes +FollowSymLinks
AllowOverride None
Allow from all
<<>> /directory
Alias /servlets-examples "D:/www/tomcat5/webapps/servlets-examples/"
<<>> /directory
Options Indexes +FollowSymLinks
AllowOverride None
Allow from all
<<>> /directory
<<>>location
AllowOverride None
deny from all
<<>>/location
JkMount /jsp-examples/*.jsp example
JkMount /servlets-examples/* example
<<>>/ifmodule

Edit file D:\tomcat5\conf\tomcat-users.xml, insert lines...
<<>>role rolename="manager"
<<>> user roles="manager" password="manager" username="manager"
Install and Start Tomcat
Tomcat can be installed as a Service or started as a Standalone Console application. Note to make sure that Apache has been started at this point.
Start Tomcat service either through services panel or net stop/start.
Test the native Tomcat server...
http://localhost:8080/
http://localhost:8080/manager/status -- User:manager, Password:manager
Test Apache/mod_jk...
http://localhost/jsp-examples/
http://localhost/servlets-examples/

In above article if you see <<>> /directory, then "/directory" has to go inside the brackets. It applies wherever you find <<>>.

Have a nice day! Its only guidance and you are responsible for your results.

Tuesday, May 3, 2011

Error : Another simpana is running on Linux media agents

This artcile is on Commvault

I was getting this error while start or stop services on Linux media agent
"Error : Another simpana is running on Linux media agents"
Follow these steps to fix it:
1. Simpana status
It shows what is running on the server
2. Simpana list
It shows which services are running
3. Simpana start/stop
It starts/stops simpana services on the server
But recently we have got issues on Linux media agent and it was giving error of “another simpana is running” whenever we start/stop services on it.
4. Go to /tmp folder and rename the following file with command mv
# mv .lock_Galaxy .lock_Galaxy_old
5. Now start services with # simpana start
6. Check services with # simpana list
7. Also run a backup job and see how it is running with this media agent.

Have a Nice day!

Monday, April 25, 2011

Chnage TimeZone in Solaris

Edit this file with Vi
# vi /etc/TIMEZONE
Change TZ=US/Eastern or US/Central or etc...

The futime zones are listed in /usr/share/lib/zoneinfo

Have a nice Day!

Flush DNS in Windows/Linux/Solaris

In Microsoft Windows:
run this command from dos prompt C:> ipconfig /flushdns

In Linux

Login as root and run this command # /etc/init.d/nscd restart
If you find dnsmasq dns cache, then use this command also:
/etc/init.d/dnsmasq restart

In Solaris
Login as root
Check PID using : ps -ef : grep nscd
Kill it using : pkill or kill
and restart the nscd daemon with : /usr/sbin/nscd

To verify for the running process use : ps -ef : grep nscd

Have a nice day!

Friday, January 21, 2011

Users to Manage Distribution Groups in Exchange2010 through Outlook

By default, users(who are managers for their Distribution Groups(DGs)) can manage their groups through outlook in Exchange2003. But in Exchange 2010 it was disabled by default and users cann't manage their DGs through outlook client. This is one of the issue to consider during migrations from Exchange 2003 to 2010.

When a user opens Outlook 2007 and attempts to manage his or her distribution groups, he receive the following error message:

"Changes to the distribution list membership cannot be saved. You do not have sufficient permissions to perform this operation on this object."
To give users the ability to manage their distribution groups, go into the Exchange Control Panel and follow these steps:

1. http://msexchangeserver/ecp

2.Choose the option to manage My Organization.

3.Select the User Roles option, which is found in the Users and Groups section.

4.Select the Default Role Assignment Policy and click the Details button.

5.Check the My Distribution Groups box (Figure 1).


Figure 1. By selecting the My Distribution Groups check box, you can allow users to manage their own groups in Exchange 2010.
This option also enable users the ability to create and remove distribution groups.
If you don't want to give users the ability to create and remove distribution groups, Microsoft created a script that removes the option completely.

How do I run this thing?
To run the script you need to copy the contents of the script to a text file on the machine you are going to run it on. Then save the file as a .ps1... I recommend Manage-GroupManagementRole.ps1 .

To fill all of the above requirements with minimal effort run the following from an Exchange Powershell Prompt:

Manage-Groupmanagementrole.ps1 -creategroup -removegroup

This will create everything you need with the correct settings using the default names in the script. If you would like help on the script you can either look in the contents of the file or run it with no switches.

What does the script do?
Creates a new RBAC role that is a child of the MyDistributionGroups Role
Removes the cmdlets remove-distributiongroup and new-distributiongroup from the new role that was just created. Assigns the new role to the Default Role Assignment Policy.
When complete your users will be able to manage distribution groups but not create or remove them.


Resources: http://msexchangeteam.com/archive/2009/11/18/453251.aspx by Matt Byrd
http://searchexchange.techtarget.com/Issues-to-watch-for-during-an-Exchange-Server-2010-migration By Brien M. Posey.