Helpful SAN LUN Disk AIX Commands


When adding LUN’s to AIX, the below commands can be helpful to add SAN disks.  These commands will help add the disks and also assist in identifying an issue as to why the server may not see the newly create SAN disks.

 

Get WWN, Model, Part Number, etc. From HBA

lscfg -vp -l fcs0

Rescan all AIX devices after LUN Assignment

cfgmgr

Identify Fiber Channel Adapters

lsdev -Cc adapter | grep fcs

Get Fiber Card Status

fcstat fcs0

Check if HBA port is up or down

fcstat -D fcs0 | grep Attention

See All Local and SAN Disks on System

lsdev -Cc disk

 

 

Install openssh on AIX 7.1

Installing openssh on AIX 7.1 is pretty much straight forward.  Finding the right openssh version can be the worse part of installing on AIX 7.x.  The below is a small doc so that I can remember where I placed this version and hopefully help others as well looking to install openssh on AIX 7.x.

AIX 7.x comes bundled with openssl, to verify, type openssl in command prompt, then version and you should have something similar.

OpenSSL> version
OpenSSL 0.9.8r 8 Feb 2011
OpenSSL>

If you do not have the above, then you can do two things.  Insert the AIX expansion pack media and do:

smitty install_software or

geninstall -d/dev/cd0 R:openssl-version

Download the this package http://repo.rogersit.net/aix-7-1/openssh/openssh.base to the tmp dir on your server and run:

geninstall -I”Y” -d/tmp I:openssh.base

 

 

HP-UX fix I/O error and cannot determine file system statistics

Presented with an issue of a SAN that had a failure and a HP-UX server was not seeing the disks after the SAN was brought back online.  The error given was “cannot determine file system statistics” when issuing the “df” command on the system.  Following steps can be used in order to reclaim the disks, and also show how to repair if there is disk corruption once the server is able to see the disks from the SAN.

Reclaim the disks by issuing the following commands.

insf -C disk

ioscan -fnuC disk

You might have I/O error when trying to change into a directory of a reclaimed disk.  This will be caused by disk corruption.  You will need to do a file system check at this point.  First you will need to umount the disk.

umount /data

if you have the “device is busy” error, issue the fuser command kill any process trying to use the disk.

fuser -ck /data

Issue the following command to repair the disk volume.

fsck /dev/vg-blah/lv-blah

Once the disk has been checked, re-mount the disk

mount /data

Repeat for multiple disks that the server may have.

~Jason Rogers

 

UNIX – AIX – HP-UX LPD Printer Setup – Unix to Windows Printing

To install Print Services for UNIX on Windows 2000 or Windows XP:

1.             Log on to the machine with an administrative-level account.

2.             Start the Add/Remove Programs tool in Control Panel.

3.             Click Add/Remove Windows Components.

4.             Click Other Network File and Print Services, and then click Details.

5.             Click to select the Print Services for UNIX check box, and then click OK.

6.             Follow the instructions on the screen to finish the installation.

NOTE: You may be asked to provide the location to the i386 folder for the version of Microsoft Windows that you are running.

 

Configuring SimulatePassThrough for all printers:

 

1.             Start Registry Editor.

2.             From the HKEY_LOCAL_MACHINE subtree, click the following subkey:

\SYSTEM\CurrentControlSet\Services\LPDSVC\Parameters

3.             On the Edit menu, click New, and then click DWORD Value.

4.             Name the new entry SimulatePassThrough.

5.             Double-click the SimulatePassThrough entry, and then change the data value to 1.

6.             Click OK.

7.             Quit Registry Editor.

 

Enable TCP/IP Print Server to start automatically:

 

  1. Right-click on My Computer.
  2. Click Manage.
  3. Expand Services and Applications.
  4.  Double-click TCP/IP Print Server and change the Startup type to Automatic.
    1. Click Apply.
    2. Click OK.

     

    Configuring a Port for Print Services for UNIX:

     

    1. Rename your local printer.
      1. Go to Printers and Faxes.
      2. Find your local printer.
      3. Right-click the printer and select Rename from the menu.
      4. Choose a short name for the printer, i.e., if your printer name is hp laserjet 1200n then you should rename the printer to something like hplj1200n.
    2. Click on Add a Printer.
    3. Click Next.
    4. Make sure Local printer attached to this computer is selected and that Automatically detect and install my Plug and Play printer is unchecked.
    5. Click Next
    6. Select Create a new port. Then choose LPR Port for Type of port.

    Windows Unix LPR Port

    1. You should now see the Add LPR compatible printer window.
    2. Put your computer name in the text box for Name or address of server providing lpd.

Add LPR Printer Unix

Your computer name can be found by clicking START and then ‘Run…’. Type cmd in the run box and select OK. You should then see a DOS prompt. Type echo %COMPUTERNAME% in the window and press enter. You should see your computer name output on the screen.
Unix to Windows Printing

Put the name of your local printer in the est box for Name of printer or print queue on that server. This should be the short name for the printer you selected in step 1-d. In this example the name is hplj1200n.

Unix to Windows Print

  1. Click OK
  2. You will now be prompted to select a printer driver. Select HP as the manufacturer and select HP Laserjet 4 as the printer model

AIX Print to Windows

  1. Click Next.
  2. Make sure Keep existing driver is selected.
  3. Click Next.
  4. You will now be asked to name the printer. This will be the name used in Oracle. The standard naming convention is mid + the first 5 letters of the location + a number.  As an example, if you are located in Atlanta, GA the printer name would be midatlan1. When selecting the number chose the number based on the number of oracles printer you have setup at your site.
  5. Click Next.
  6. Check Do not share this printer.
  7. Click Next.
  8. Check Yes to print a test page.
  9. Click Next.
  10. Click Finish.
  11. Click OK on the test page window.

If the test page printed successfully you have correctly setup the printer as an LPD printer.

 

Note: If you have a firewall enabled it needs to be disabled in order to receive print requests from Oracle.

 

Jason Rogers

How to Install Bash on HP-UX

Installing Bash on HP-UX is fairly straight forward. You will need to install some dependencies in order to install bash on HP-UX, which I will cover below.

First you will need to download your packages. Also, install in the below order as well.

libiconv
temcap
gettext
bash

Uncompress the depot files

gunzip package_name

Then install the packages using the above install order with swinstall.

swinstall -s /path/to/bash.depo bash

Using swinstall command line, you will need to define the program after the .depo file like the above example. This is much faster than using the swinstall gui.

HP UX – CIFS – Mount Windows Share

A quick tutorial on how to mount a Windows shared folder onto HP UX.

1) Create your mount folder
mkdir /backup

2) Setup the cifsclient to start on boot up.
vi /etc/rc.config.d/cifsclient
changed RUN_CIFSCLIENT=0 to =1.

3) Start the cifsclient dameon.
/opt/cifsclient/bin/cifsclient start

4) Mount the Windows Share
cifsmount //WindowsHost/backup /backup -s
* You will more than likely get an error here so you will need to provide username and password to the Windows Share *

5) To do this do the following. After you give the following info, you will be asked for the user password.
cifslogin WindowsHost -U USERNAME -D CRB -s
* You will need to do cifslogin for every users on the HP UX box that will need access to the mount point.

6) After you have done the above, check your CIFS mounts by issuing the following command.
cfislist

The Windows shared folder should now be mounted to the HP UX server.

Jason Rogers

AIX – Unix – Script to Clean/Shrink WTMP file size

Today I came across an AIX wtmp file that was 1.9 GB in size. Needed to shrink the file down to keep at least the last 300 lines. Once I was completed, the file was less than 1 MB. I wrote the below script to clean the wtmp file, you are able to choose where to create the temp file, and how many lines you want to keep as well.


#!/bin/ksh
### Clean the wtmp file online ###
bold=`tput bold`
normal=`tput sgr0`
df -gv
ls -al /var/adm | awk '{ print $1, $2, $3, $4, (($5/1048576))"\t", $6, $7, $8, $9 }'
echo "${bold}Where do you want to create a temp wtmp file. Example /tmp - DO NOT use a trailing / in path.:${normal}"
read TWTMP
echo "your input was $TWTMP"
echo "${bold}How many lines would you like to shrink the file to. Example 300.:${normal}"
read LINES
#if [ -s /var/adm/wtmp ]
#then
/usr/sbin/acct/fwtmp < /var/adm/wtmp > $TWTMP/temp.wtmp
/usr/bin/tail -$LINES $TWTMP/temp.wtmp | /usr/sbin/acct/fwtmp -ic > /var/adm/wtmp
/usr/bin/rm $TWTMP/temp.wtmp
else
continue
fi

Simple JBoss AS 7 Server Startup Script for Linux

I covered in a previous post of setting up a standard JBoss application server. In the post, I gave a shot script to start the JBoss application server. Below would be a standard way of install JBoss as a service script to run at boot time.


#!/bin/sh
#chkconfig: 345 99 10
#description: JBoss auto start-stop script.

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

### CHANGE THE STARTUP PATH TO YOUR START SCRIPT ###

startup='/home/jboss/jboss-as-web-7.0.2.Final/bin/standalone.sh > /dev/null 2> /dev/null &'
shutdown='killall java'

start(){
echo -n $"Starting JBoss service: "
$startup
RETVAL=$?
echo
}

stop(){
action $"Stopping JBoss service: " $shutdown
RETVAL=$?
echo
}

restart(){
stop
sleep 10
start
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac

1: Name and add it to /etc/init.d
2: chmod 755 jboss
3: chkconfig –add jboss && chkconfig jboss on

Command Usage
service jboss start
service jboss stop
servoce jboss restart

Enjoy,
Jason Rogers

Setup/Install JBoss Application Server AS7 – Jason Rogers

Working with JBoss version 4, 5 and 6 over the years. I finally wanted to upgrade a server to JBoss version AS7. I will describe how to do a base setup of JBoss AS 7 on a Linux platform, in less than 15 minutes. I have found that JBoss 7 on Linux as a very small imprint on system resources, and the admin console, is has a drastic change for the good over prevoius versions.

1: Download version AS 7 from the JBoss site located here:
http://download.jboss.org/jbossas/7.0/jboss-as-7.0.2.Final/jboss-as-web-7.0.2.Final.tar.gz

2: Download Java 1.7 or higher from here:
http://www.oracle.com/technetwork/java/javase/downloads/jre-7u2-download-1377135.html

3: Download ANT from here:
http://ant.apache.org/bindownload.cgi

Untar ANT and JBoss to your standard installation directory. For this example, we will use “/usr/local”

4: Install the java rpm and perform a “which Java” or “java -version” command to ensure that
the new version is currently the working version. Inside of /usr/java you should see something like the below.
Ensure that the softlinks point back to the new version of java we just installed.

default -> /usr/java/latest
dk1.7.0_02
latest -> /usr/java/jdk1.7.0_02

5: Setting up the environment variables. That are a couple of ways to do this, everyone has their preference. Mine, is to set them in the “/etc/profile”. So do the following.

nano /etc/profile

ADD NEAR LINE 45


export JBOSS_HOME=/usr/local/jboss-as-web-7.0.2.Final
export JAVA_HOME=/usr/local/jdk1.7.0_02
export ANT_HOME=/usr/local/apache-ant-1.8.2
export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH

VERSION Numbers change, so ensure that the above match your version number. You will need to logout and log back into shell at this point.

6: Not good to run as root, so let’s create a user and group for JBoss to run as.
groupadd -g 502 jboss
useradd -u 502 -g jboss -c "JBoss App" jboss

Set all of the file permission for our install to user jboss.

7: Let’s create a simple startup script.

nano jb7start

ADD THE BELOW

LOGFILE=/var/log/jboss.log
RUNOPTIONS="-b domain/IP"
cd $JBOSS_HOME/bin
nohup ./standalone.sh $RUNOPTIONS >$LOGFILE 2>&1 &

See THIS POST to setup as a Linux Service.

8: Startup JBoss by initiating the ./jb7start script file.

At this point, JBoss should be up and running. Let’s check to see if where are running by navigating to http://domain:8080 – You should see a nice JBoss AS splash page. You will not be able to get to the administration page unless you login locally to the server you installed JBoss on. Who installs a GUI on Linux anyway, so to overcome this, edit the standalone.xml configuration file inside of “$JBOSS_HOME/standalone/configuration/

Find the lines that show






AND CHANGE IT TO THE SERVER IP OF THE HOST.







You will need to setup some security around this, not covering it in this topic.

Restart JBoss and you should now be able to navigate to the administration page.

9: We can now deploy a test war file to ensure everything is going good. Here is a simple hello world
test file you can use. Two ways to deploy, either do it inside of the administration console or you can just
just drop the test war file in the “/home/jboss/jboss-as-web-7.0.2.Final/standalone/deployments” directory.

Navigate to http://IP:8080/helloworld/hi.jsp

and you should see our hello world page.

JBoss AS 7 is now installed. For those of you wanting to pass port 8080 through apache on port 80.

Do the following

nano /etc/httpd/conf/httpd.conf

AND ADD AT THE BOTTOM


# ServerAlias www.myjbosssite.com
DocumentRoot /usr/local/jboss-as-web-7.0.2.Final/docs
Options Indexes +FollowSymLinks
ProxyPreserveHost On
ProxyPass / http://IP:8080/
ProxyPassReverse / http://IP:8080/

Restart apache. You should now be able to navigate to our hello world page without port 8080 – http://IP/helloworld/hi.jsp

That’s all, a fast and simple setup of JBoss AS 7 in less that 15 minutes including a simple ProxyPass in apache.

I write these tutorials to how I can understand, some have problems, but hey, we all do not think the same.

Enjoy,
Jason Rogers
Linux/Web Systems Engineer

Free MySQL Backup Automated Backup Software | Jason Rogers

This has been a project that I have been working on for about six months when free time permits. The biggest task today is take on-line backups of MySQL while your production environment is up and running. The launch of www.MySQLBack.com – MySQL Back will take away these worries.

MySQL Back will allow you to set automated on-line backups and also do a quick on-line backup of MySQL as well. Using curl as the automation process of the MySQL Back software to kick off the scheduled automated backup jobs. Currently the service is free due to the new release of the software.

Stop by www.MySQLBack.com today and schedule your free on-line MySQL backup.

Jason Rogers
Charlotte, NC