Pages

Thursday, December 30, 2010

POM

- He lives in black and white world, there is no room for grey area-

- Money will always come and go, no use of saving it or hold on to it too tightly. You just have to spend it wisely-

Sunday, December 26, 2010

Setting new dedicated server

I'm migrating my VPS server to a new dedicated server. So i need to repeat the same proses I've done for the old server to this one. For future reference , I'm going to document my steps :)


Setting swappiness

To set the vm.swappiness permanently you need to edit the /etc/sysctl.conf file and add the line

vm.swappiness=10

The default number usually 60. The smaller the number means that your system is unlikely to swap process from memory to the swap space. To see the change, use :

cat /proc/sys/vm/swappiness


Installing Sun JDK package

I'm still very fond to use the JDK from SUN, to do that in ubuntu you need to follow this steps.

You can add the repository manually by editing /etc/apt/sources.list
or installing the package python-software-properties and run

sudo apt-get install mysql-server-5.1

sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

Then, update the repository information and install the jdk

sudo apt-get update
sudo apt-get install sun-java6-jdk

Installing MySQL
sudo apt-get install mysql-server-5.1
vi /etc/mysql/my.cnf #change the default port


Installing glassfish
wget -b -c -i http://download.java.net/glassfish/3.0.1/release/glassfish-3.0.1.zip -o log.out
sudo apt-get install unzip
unzip glassfish-3.0.1.zip

Start glassfish
./glassfish/bin/asadmin start-domain domain1

Connect to the admin console and change the admin password
http://yourip.net:4848/
enterprise server > administrator password
logout and re-login

If you want a more secure and thorough set-up you can follow this guide. I usually just change the port in the admin console to 80.

Installing Apache
sudo apt-get install apache2

enable reverse proxy
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo /etc/init.d/apache2 restart

add reverse proxy context
sudo vi /etc/apache2/sites-enabled/000-default
ProxyPass /itsme/ http://www.mysite.net:8080/itsme/
ProxyPassReverse /itsme/ http://www.mysite.net:8080/itsme/

if you have a problem "client denied by server configuration proxy" you need to modify the proxy.conf to allow access to your site. So far the only solution i know is by adding allow all or commenting deny all in the proxy.conf file. To edit the conf file, use this command :
sudo vi /etc/apache2/mods-enabled/proxy.conf

if you wan't to pass the original ip through your proxy server follow this link.

Setting mercurial server
To set the mercurial server you can see my previous post.

Using subdomain for mercurial server
To do this you need to add a CNAME entry to your DNS Server. For example I ask my hosting support to add CNAME entry for hg.myserver.net.

After that, you just need to copy the virtual host from the 000-default files and add

ServerName hg.myserver.net

And you should be able to access your hg server using http://hg.myserver.net/hg

I've edited the location and path for this virtual server so i can access it using http://hg.myserver.net/repo. Better than the redundant hg for the url :)

Start glassfish at reboot time
Create a glassfish.sh file at your home directory, copy the code below as the content

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          scriptname
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

GLASSFISH_HOME="/home/mreunion/glassfish/"

case "$1" in
start)
    $GLASSFISH_HOME/bin/asadmin start-domain
    ;;
stop)
    $GLASSFISH_HOME/bin/asadmin stop-domain
    ;;
restart)
    $GLASSFISH_HOME/bin/asadmin restart-domain
    ;;
force-reload)
    $GLASSFISH_HOME/bin/asadmin restart-domain
    ;;
*)
    echo "usage: $0 (start|stop|restart|help)"
esac

sudo cp glassfish.sh /etc/init.d/
sudo chmod +x glassfish.sh
sudo update-rc.d glassfish.sh defaults

Tuesday, December 14, 2010

Wireless setup

So i've got this Linksys WAP54G in my home, and try to set it up. I'm having trouble with the automatic setup, so reading this helps a lot.

Now i can ping and connect to my access point, I'm facing another problem. I didn't have any dhcp server. That's why my ubuntu laptop keep turning off the wifi connection. Setting the auto wireless to have a static ip address fix the problem.

Last but not least, i try connecting through my htc hero. Found the same problem , this article help me set the static ip address.

The funny thing i setup all this, because I'm having a problem adding a third gmail account on my htc hero.It keep saying it need reliable network.  Trying to clear the application data didn't work. So as a worked around i delete my second gmail account, and login to youtube using my third gmail account. And it worked.

Well at least after all this now i have a Wifi Access point in my home now :)