Tuesday, December 31, 2013

setup openwrt on Asus rt-n15 as wireless client with relayed(Pseudo-bridge)

openwrt on asus rt-n15(Attitude Adjustment 12.09|Load:0.26 0.08 0.06)
  • rt-n15
Flash from a Windows PC using the Firmware Restoration utility. (Download and install the Firmware Restoration Utility to your PC.)
The Asus RT-N15 has a failover mode, (refer to rt-n16)http://wiki.openwrt.org/toh/asus/rt-n16
To launch the recovery mode disconnect power from the router first.
Hold the WPS button while replugged the power to the router to reset nvram, router will restart 2x. Hold the RESET button while replugged the power to the router to get into recovery mode : tftpd is listening. The power LED should start to blink (low frequency, ~1 time every 3 seconds). Retry if that won't work for you.
The router IP in the recovery mode is 192.168.1.1 255.255.255.0.
Configure your PC (don't use 192.168.1.1)
netsh interface ip set address name="Local Area Connection" static 192.168.1.2 255.255.255.0
Ping 192.168.1.1 should give a response.
Launch the Firmware Restoration utility, select the firmware and press the Upload button.
Ignore the warning, we wanna be on OpenWRT!
telnet to 192.168.1.1 and login as root, there is no password, type in passwd to set a password for root.
login in to web interface and assign a DNS server to the Lan interface.
close telnet and use ssh to login 192.168.1.1
login in to web interface and assign a DNS server to the lan interface.

root@OpenWrt:~# opkg update
root@OpenWrt:~# opkg install relayd
root@OpenWrt:~# opkg install luci-proto-relay

root@OpenWrt:~# /etc/init.d/relayd enable

  • use luci to config routed client relayed.
Basically.
  1.  enable 802.11 bgn(radio0) and scan wireless network.
  2. join the wireless network and it will ask for passcode, name of the new network(wwan by default) and create/assign firewall zone(select "lan" here)
  3. create a new network interface (" "stabridge"), select relayed bridge and select connect lan and wwan.
  4. network firewall under zones, change the forwarding for and lan and wwan to "accept"
 

openwrt on tp-link wdr4300

the openwrt was installed and configured as routed client relayed, and I need to reset the openwrt to factory default to use it as a WAP, here are the steps

  1. Power the router up;
  2. After powering up track the SYS light when it starts to blink, when it does press and hold the WPS/reset button till SYS lights starts to blink faster – router goes to recovery mode;
  3. Telnet to the router on 192.168.1.1 – no password needed (if your computer doesn’t gets IP address from DHCP assign it manually for i.e. 192.168.1.200 with netmask of 255.255.255.0);
  4. In telnet terminal type `mtd -r erase rootfs_data` to reset OpenWRT to it’s defaults. then the router will reboot.
  5. after reboot, telnet in and passwd to set a password.
  6. use PUTTY to ssh to 192.168.1.1 with username root and the password.

Monday, October 14, 2013

Installation of 389 Directory Server on Ubuntu server 12.04.3 LTS

  • sudo apt-get install python-software-properties
  • sudo add-apt-repository ppa:ubuntu-389-directory-server/ppa
  • sudo apt-get update
  • sudo apt-get install 389-admin 389-ds-base 389-ds-console

then

  •  sudo /usr/sbin/setup-ds-admin

Saturday, October 05, 2013

mysql jdbc input Chinese

in glassfish 

 

Edit JDBC Connection Pool Properties

 

add properties

Name: characterEncoding 
Value: UTF-8 

Name: useUnicode 
Value: true 

Monday, September 30, 2013

setup glassfish and roller

  • in .30
  • first disable jboss startup by "sudo update-rc.d -f jboss remove"
  • create glassfish user and group
  • mv glassfish to /usr/local/share/glassfish
  • chown to glassfish:galssfish
  • create a admin user and password:  ./asadmin change-admin-password
  • ./asadmin --host  30 --port 4848 enable-secure-admin to allow remote access to admin page
  • login to admin and change default http listener port to another number
  • copy mydql jdbc driver to /domains/domain1/lib/ext and roller-custom.properties to domain1/lib/classes.
  • add jdbc connection pool for roller and jdbc resource for jdbc/rollerdb
  • have to create the rollerdata dir in glassfish home and change the properties in roller-customer.properties
  • .have to install java jdk7 instead of using jre(jdk-7u40-linux-i586.gz)
  • sudo lsof -i tcp and found the job# for glassfish and kill it
  • scp the jdk
  • jdk-7u40-linux-i586.gz
  • sudo mv ./jdk1.7.0_40 /usr/lib/jvm/jdk1.7.0
  •  sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
  • sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
  • sudo update-alternatives --install "/usr/bin/javac" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
  •  sudo chmod a+x /usr/bin/java
  •  sudo chmod a+x /usr/bin/javac
  • sudo chmod a+x /usr/bin/javaws
  • sudo chown -R root:root /usr/lib/jvm/jdk1.7.0
  • sudo update-alternatives --config java
  • sudo update-alternatives --config javac
  • sudo /etc/init.d/apparmor restart
  • edit /etc/profile.d/java.sh and put

"export JAVA_HOME=/usr/lib/jvm/jdk1.7.0

export PATH=$JAVA_HOME/bin:$PATH"

  • restart the server  and cd to glassfish/bin sudo ./asadmin craete-srevice
  • sudo chmod 755  /usr/local/share/glassfish/glassfish4/glassfish/lib/nadmin
  • start the GlassFish-domain1 service.

Sunday, September 22, 2013

glassfish 4 and roller 5.0.1

  • get tired of twisting  apache roller for jboss EAP,  decide to try glassfish 4.0
  •  downloaded and installed glassfish-4.0.zip  full java EE platform
  • unziped and copied mysql jdbc to the domain1/lib/ext
  • copied roller-custom.properties to domain1/clases
  • deployed the download roller-5.0.1-javaee.war
  • woala!!, it works.

Lessons learned:

I am not a Java App server guru, but worked more than 2 years with glassfish(3 then 4) and 3 years with jboss EAP(5, then 6)

a lot of applications downloaded from the internet(roller, nexus, and others) will work with glassfish without modification

for jboss, the apps  need spend some time painfully sniffing through the source code and a lot of time I have to give up and go back to use glassfish.

This is my first time use glassfish 4, and I did not notice a lot of change between 3 and 4, the speed is decent.

between jboss EAP 5 and EAP6, the change is radical and as a developer, a lot of things I did in EAP 5 are completely different in EAP6.

 

build roller 5.0.1 ro jboss eap 6.0

  • download the roller source and import existing Maven projects into eclipse
  • maven clean complie and install  roller-project(parent)
  • roller-core maven clean compile install with no problem
  • roller-planet-business stopped, change pom for guice. 

  <dependency>

  <groupId>com.google.inject</groupId>

  <artifactId>guice</artifactId>

  <version>3.0</version>

</dependency>

  • have to copy droptables.sql to  source/main/resource/sql
  • here are the missing dependency modificaton for roller-weblogger-business

<dependency>

  <groupId>com.google.inject</groupId>

  <artifactId>guice</artifactId>

  <version>3.0</version>

</dependency>

  <dependency>

            <groupId>net.oauth.core</groupId>

            <artifactId>oauth</artifactId>

             <version>20100527</version>

            <scope>compile</scope>

        </dependency>

 

        <dependency>

            <groupId>net.oauth.core</groupId>

            <artifactId>oauth-provider</artifactId>

             <version>20100527</version>

            <scope>compile</scope>

        </dependency>

  • added the net.oauth dependency to roller-weblogger-webapp and roller-weblogger-web and compliled them.
  • deployed roller-weblogger-webapp to jboss
  • tried a lot of things and installed jboss eap6.10, still not working

Saturday, September 21, 2013

maven nexus, apache roller

  • nexus on both 30 and 40.
  • downloaded source for roller and will try to install roller in jboss eap 6.0

Wednesday, September 11, 2013

Restore Roller Mydql Database


  • use ubuntu live cd  and choose " fix broken installation"
  • mount a usb to /media/external by choose the use from "sudo fdisk -l"
  • installed new ubuntu server 12.04 LTS from burned cd(tried usb and DVD not working).
  • installed mysql server after server started(LAMP won't work because of  dns issue of home).
  • mount usb and copy roller dir to /var/lib/mysql
  • sudo service mysql stop
  • sudo  chmod -R 660 /var/lib/mysql/roller/
  • sudo chmod 700 /var/lib/mysql/roller
  • sudo chown -R -f mysql:mysql /var/lib/mysql/roller
  • service mysql start
  • mysqlcheck --repair --all-databases
  • need to dump the roller db regularly, the weblogentry table is the most important.

mysql in ubuntu 12.04 LTS allow remote access

To expose MySQL to anything other than localhost you will have to have the following line uncommented in /etc/mysql/my.cnf and assigned to your computers IP address and not loopback
#Replace xxx with your IP Address 
bind-address        = xxx.xxx.xxx.xxx
Or add a bind-address = 0.0.0.0 if you don't want to specify the IP
Then stop and restart MySQL with the new my.cnf entry. Once running go to the terminal and enter the following command.
lsof -i -P | grep :3306
That should come back something like this with your actual IP in the xxx's
mysqld  1046  mysql  10u  IPv4  5203  0t0  TCP  xxx.xxx.xxx.xxx:3306 (LISTEN)
If the above statement returns correctly you will then be able to accept remote users. However for a remote user to connect with the correct priveleges you need to have that user created in both the localhost and '%'.
Before granting user access, you need to login MySQL. 
$ mysql -u root -p
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
Then
GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';
If you don't have the same user created as above, when you logon locally you may inherit base localhost privileges and have access issues. If you want to restrict the access myuser has then you would need to read up on the GRANT statement syntax HERE If you get through all this and still have issues post some additional error output and the my.cnf appropriate lines.