Thursday, February 2, 2012

Make vscsi to client partition

1. Create Virtual Adapter as SCSI adapter to both VIOS (as server adapter) and LPAR (as client adapter)
make sure their ID match each other (Server and Client adapter ID)

2. Now go to VIOS and look for vhost id that indicate our lpar. You can grep from PhyLoc
( the last C character with number defines the server adapter id )
#lsmap -all |grep -p C26 (example, mine is 26)

SVSA Physloc Client Partition ID
--------------- ------------------------------ ------------------
vhost11 U8204.E8A.069D955-V1-C26 0x0000000b

3. Before the creation of vscsi, you need to know which hdisk that represent to VIOS you want to use.
Example, mine will be using hdisk25
#mkvdev -vdev hdisk25 -vadapter vhost11

4. Now check if you have a virtual scsi attaches to your virtual adapter.
#lsmap -vadapter vhost11

SVSA Physloc Client Partition ID
--------------- --------------------------- ------------------
vhost11 U8204.E8A.069D955-V1-C26 0x0000000b

VTD vtscsi24
Status Available
LUN 0x8300000000000000
Backing device hdisk25
Physloc U78A0.001.DNWHM0W-P1-C2-T1-W50060E80104AF4A0-L19000000000000
Mirrored false

SSH pair key with RSA.

1. From local machine, create the private and public keys

#ssh-keygen -t rsa

*Any prompt just passed as default.

2. Copy the public key to the remote machine (need to enter the password for the first time)

#cat ~/.ssh/id_rsa.pub | ssh user@server "cat - >> ~/.ssh/authorized_keys"

That's all

Troubleshooting
If you get a connection refused message
You probably have a server problem, check sshd is running "netstat -nlp" and there is no firewall rule in place blocking port 22 "iptables -nL".

You still get prompted for a password
Try to ssh to the server with verbose output:

#ssh -vv user@server

If you get a line like this, not containing "publickey":
debug1: Authentications that can continue: password,keyboard-interactive
Then check sshd_config on the server and remove the line "PubkeyAuthentication no" if it exists then restart sshd.

If you don't get a line like:
debug1: try pubkey: /home/rossy/.ssh/id_dsa
Then check "ssh_config" on the client and if it exists, remove "PubkeyAuthentication no" if it exists.
If you still don't see that line then make sure that "~/.ssh/id_dsa" exists on the client.

If you get a line like:
debug2: we sent a publickey packet, wait for reply
Check that "~/.ssh/authorized_keys" exists on the server and contains a line the same as "~/.ssh/id_dsa.pub" on the client.

Friday, April 22, 2011

Adding new HDD on Solaris

Here is the table of harddisk's priority.


Solaris 10 x86 Disk Controller Table
IDE
/dev/rdsk/c0d0s0~7Primary IDE Master
/dev/rdsk/c0d1s0~7Primary IDE Slave
/dev/rdsk/c1d0s0~7Secondary IDE Master
/dev/rdsk/c1d1s0~7Secondary IDE Slave

SCSI
/dev/rdsk/c0t0d0s0~7First SCSI ?No 0 ? Disk Drive
/dev/rdsk/c0t1d0s0~7First SCSI ?No 1 ? Disk Drive
/dev/rdsk/c0t2d0s0~7First SCSI ?No 2 ? Disk Drive
/dev/rdsk/c0t3d0s0~7First SCSI ?No 3 ? Disk Drive
/dev/rdsk/c0t4d0s0~7First SCSI ?No 4 ? Disk Drive
/dev/rdsk/c0t5d0s0~7First SCSI ?No 5 ? Disk Drive
/dev/rdsk/c0t6d0s0~7First SCSI ?No 6 ? Disk Drive
/dev/rdsk/c0t7d0s0~7First SCSI ?No 7 ? Disk Drive

So, after connected your new HDD to your system.
Reboot once then login to solaris and type these command

#drvconfig
#disks
check the new HDD has been added already with
#format 

All done :)

Credits: here

Thursday, April 21, 2011

Enable root session in SSH on Solaris 10.

Normally Solaris 10 has already installed ssh. but It doesn't allow root to login.
So we have to modify sshd_config within /etc/ssh/sshd_config
Using vi we'll have
#vi /etc/ssh/sshd_config
Look for PermitRootLogin and replace with yes

Then restart the service with
#svcadm restart svc:/network/ssh:default
That's all

Sunday, January 16, 2011

Change SSH port in Ubuntu

You can edit ssh configurations within /etc/ssh/sshd_config file.
That's all :)

Sunday, January 9, 2011

How to monitor your apache status.

I'll using mod_status which apache2 has provided for.
It's easy to use and you can also use perl script to grab some information you'd like to.

Let's see if you've already got mod_status
browse to your /etc/apache2/mods-available/ 
just list the items and have a look. I think for apache2 they've just put it in already.

So now let's have a test.
$apache2ctl full status
If  it said that you need to add some kind of extended status,
Let's head to the /etc/apache2/apache2.conf and added this code at the end of file.
ExtendedStatus On
Now, your apache status will come up with full information.

If you need more configuration, please have it configured in /etc/apache2/mods-available/status.conf
<IfModule mod_status.c>

# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
<Location /server-status>
     SetHandler server-status
     Order allow,deny
     Order deny,allow
     Deny from all
     Allow from localhost ip6-localhost
     Allow from .example.com
</Location>
 </IfModule>


Wednesday, January 5, 2011

Heap Sort Algorithms with Java

It's my homework before new year.
Well not much to talk today. Let's have a look.
//*************Find Left and Right****************//
public static int left(int i){
          return (2*i)+1;
}
public static int right(int i){
          return (2*i)+2;
}
//************Max Heapify**********************//
public static void max_heapify(int x[],int i){
int l = left(i);
int r = right(i);
int largest;
     if(l<=(heap_size) && x[l] > x[i]){
          largest = l;
     }
     else
          largest = i;
     if(r<=(heap_size) && x[r] > x[largest]){
          largest = r;
     }
     if(largest != i){
          //SWAP
          int temp = x[i];
          x[i] = x[largest];
          x[largest] = temp;
          max_heapify(x,largest);
     }
}
public static void build_max_heap(int x[]){
     for(int i = (x.length/2)-1;i>=0;i--){
          max_heapify(x,i);
     }
}
public static void heap_sort(int x[]){
     build_max_heap(x);
     int temp;
     heap_size = x.length-1;
          for(int i = heap_size;i>=0;i--){
               temp = x[0];
               x[0] = x[i];
               x[i] = temp;
               heap_size--;
               max_heapify(x,0);


         }
}
These algorithms were derived from "Introduction to Algorithms by T Cormen, C Leiserson, R Rivest, and C Stein"

Have fun :)