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 :)

Tuesday, December 21, 2010

Doing some works on Load Balancer with Crossroads.

Well, it's finally about time to begins my senior project stuffs.
Let's say I've been doing busy with some jobs earlier, So I didn't have a chance to look at it much.
But It is nearly new year, everybody's going back their home after midterm examinations.
For me, It's time to move on and working on stuffs.
The less people, The more I can concentrate on this work. (I don't like to be surrounded by people much.)

Talk to much, let's see how I install crossroads on ubuntu. It's easy and work fine.

First download the crossroads package from their website.
$cd /
$wget http://crossroads.e-tunity.com/downloads/crossroads-stable.tar.gz
Untar it.
$tar -xzvf crossroads-stable.tar.gz
Then before starting our installation. Make sure that you've already installed the build-essential package.
$sudo apt-get install build-essential
 Let's begin!
$cd crossroads-2.68
$sudo make install
Wait for a moment. Then we done!
Now it's time for configuration.
Crossroads provides two ways of configuration. Using command-line, or using xml.
Let's see the first one. If we need to use command-line, then we use "xr" command for all configuration.
$xr --verbose --server tcp0:80 / #this will tell xr that we use this server as load balancer
-W 10.10.10.1:8001 / #and this will create our web interface on port 8001
-backend 10.10.10.2:80 / #this will create backend according to the ip address and port
-backend 10.10.10.3:80
This will make your server to listen to port 80 and to dispatch traffic to servers 10.10.10.2 and 10.10.10.3
A web interface for the balancer is started on port 8001

Instead of starting XR by hand, we may use xrcrl as preferable. But first, you've to create a configuration.
To do so, put the following in the file /etc/xrctl.xml
<?xml version="1.0" encoding="UTF-8"?>
     <configuration>
        <system>
          <uselogger>true</uselogger>
          <logdir>/tmp</logdir>
        </system>
        <service>
          <name>web</name>
        <server>
          <address>0:80</address>
          <type>tcp</type>
          <webinterface>10.10.10.1:8001</webinterface>
          <verbose>yes</verbose>
        </server>
        <backend>
          <address>10.10.10.2:80</address>
        </backend>
        <backend>
          <address>10.10.10.3:80</address>
        </backend>
        </service>
     </configuration>
Then type these following commands to start the xr
$xrctl start
Or to stop.
$xrctl stop 
That's all for today. Late night again. OMG!!

Credits : Crossroads

Saturday, December 18, 2010

How to install FTP with vsftpd.

Very easy to configure. recommended!!


First install via apt-get
$sudo apt-get install vsftpd
Let's have it back up before doing anything is recommend!
$sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
Now begin to configure!
Disable anonymous login and enable local users login, give them write permission.
anonymous_enable=NO
# Let local users login
# If you connect from the internet with local users, you should enable TLS/SSL/FTPS
local_enable=YES

# Write permissions
write_enable=YES
To Deny some users to login
userlist_deny=YES
userlist_file=/etc/vsftpd.denied_users
In the file /etc/vsftpd.denied_users add the username of the users that can't login. One username per line.

To Allow some users to login
userlist_deny=NO
userlist_enable=YES
userlist_file=/etc/vsftpd.allowed_users
In the file /etc/vsftpd.allowed_users add the username of the users that can login. One username per line.

TLS/SSL/FTPS
Add these code at the end of file.
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=YES
ssl_sslv3=YES
Additional Options
# Show hidden files and the "." and ".." folders.
# Useful to not write over hidden files:
force_dot_files=YES

# Hide the info about the owner (user and group) of the files.
hide_ids=YES

# Connection limit for each IP:
max_per_ip=3

# Maximum number of clients:
max_clients=5
Then, have it applied new configuration.
$sudo /etc/init.d/vsftpd restart 
That's all the configurations I've applied to my ftp server.
If you need more option, please kindly visit this site which can provides you for further information.
Ubuntu Forum 


Credits : epimeteo from Ubuntu Forum. Thx :)