Wednesday, May 22, 2013

How to config Apache2 and domain

1. follow this instruction
2. cd /etc/apache2/sites-avalible/your-domain-name
3. sudo a2ensite (reference to this link)
4. sudo service apache2 reload
Note: make sure to do portforwarding if apache is behind the router. Step # 3 may not be needed.

SELUNIX on Fedora and Redhat linux versions

Fedora Core 3 and Red Hat Enterprise Linux 4 introduced SELinux (Security Enhanced Linux) security policies and context labels.
To view the security context labels applied to your web page files use the command: ls -Z

The system enables/disables SELinux policies in the file /etc/selinux/config
SELinux can be turned off by setting the directive SELINUX. (Then reboot the system):

    SELINUX=disabled

or using the command setenforce 0 to temporarily disable SELinux until the next reboot.

Monday, May 20, 2013

How install aircrack-ng on Ubuntu

Follow this article. I tried it and it works flawless!

check wireless devices
sudo lshw -C network

check ubuntu version release
cat /etc/lsb-release
more detail  than
cat /proc/version (linux kernel detail)

Saturday, May 18, 2013

How to SSH to Virtual Ubuntu

1. Check if SSH daemon/server is running
ps -A |grep sshd
2. if not, then go install it:
sudo apt-get install openssh-server
3. sudo service ssh restart
4. if alternative port for ssh is needed such as 443 or 80 (for instance: ssh behind proxy), modify the file /etc/ssh/sshd_config

Note: No need for adding port exceptions into  iptables of Ubuntu. For Redhat, this may be required.
Also, when editing the file /etc/sudoers if running into this error:
error:
----------
sudo: >>> /etc/sudoers: syntax error near line 25 <<<
sudo: parse error in /etc/sudoers near line 25
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
-----------
the fix for it is to run:
pkexec visudo 
Best way is to use visudo
 

How to set static ip for Fedora Virtual

follow this instruction
Note: ifcfg-eth0 file may not be there at /etc/sysconfig/network-scripts/ifcfg-eth0, create one if needed.
start sshd service
/bin/systemctl start  sshd.service

How to config static ip on ubuntu 12.04 virtual

1. edit the file /etc/network/interfaces as follows:
auto lo
#iface lo inet loopback

#set static ip
auto eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1

2. restart networking services:
sudo /etc/init.d/networking restart

Enjoy your Ubuntu with static ip!

Note: No need to edit /etc/resolv.conf. For Redhat it may be required.

How to Install Adobe Flash Plugin on Firefox in Ubuntu 12.04 64 bit

1. Download the plugin as prompted by the Firefox
2. cd /tmp
3. gunzip ~/Download/install_flash_player_11_linux.x86_64.tar.gz
4. unzip  xvf ~/Download/install_flash_player_11_linux.x86_64.tar
5. sudo cp libflashplayer.so /usr/lib/mozilla/plugins/
6. sudo cp -r usr/* /usr
7. restart Firefox
Enjoy your Firefox!

How to Install VMware Tools on Fedora Linux

1. eject /dev/cdrom
2. follow this instructions.
3. reboot
3. enter full screen and then
Enjoy your Fedora!

Thursday, May 2, 2013

Run Weblogic Binary Distribution Installation as Service on Redhat Linux

Please read the previous post before starting on this one: How to Install Weblogic Binary Distribution on Redhat Linux

1. go /etc/init.d/ create this file
vi weblogic
2. copy and paste the following into the file


#!/bin/bash
# weblogic start / stop script.
#
# chkconfig: 345 99 10



# description: Manage Weblogic services.

# Local Unix user running Weblogic



startup=/home/weblogic/domains/domain_02/bin/startWebLogic.sh
shutdown=/home/weblogic/domains/domain_02/bin/stopWebLogic.sh
WL_USER=weblogic

echo $WL_USER

start(){
 echo -n $"Starting Weblogic service: "
su - $WL_USER -c $startup
 RETVAL=$?
 echo
}

stop(){
 echo -n  $"Stopping Weblogic service: "
 su - $WL_USER -c $shutdown
 RETVAL=$?
 echo
}


status(){
 numproc=`ps -ef | grep ServerTwo | grep -v "grep ServerTwo" | wc -l`
 if [ $numproc -gt 0 ]; then
  echo "Weblogic is running..."
  else
  echo "Weblogic is stopped..."
 fi
}

restart(){
  stop
  start
}


# How to call
case "$1" in
start)
 start
 ;;
stop)
 stop
 ;;
status)
 status
 ;;
restart)
 restart
 ;;
*)
 echo $"Usage: $0 {start|stop|status|restart}"
 exit 1

esac
exit 0


3. save the file
4. run this comand: sudo /etc/init.d/weblogic start

Now you have weblogic running as a service  in Redhat Linux! Enjoy it!
Note: for Ubuntu (Amazon WS), you may try this:
nohup /home/weblogic/domains/domain_02/bin/startWebLogic.sh 0<&- &> wls.log &


Wednesday, May 1, 2013

How to Install Weblogic Binary Distribution on Redhat Linux



1. Download Weblogic installation file (Zip distribution with Oracle Weblogic Server only and intended for WebLogic Server development only) from Oracle website: http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html

2. Edit .bash_profile
Add this variable configuration to the current user (for this demo, the current user is weblogic) bash_profile

#Weblogic setting
export JAVA_HOME=/usr/java/jdk1.6.0_34
export MW_HOME=/home/weblogic/wls1211_dev
export CLASSPATH="${CLASSPATH}:/$MW_HOME/wlserver/server/lib/weblogic.jar"

Note: make sure JAVA_HOME path is correct on your current user environment. 

3. Unzip into the current user home dir: /home/myuser/ (e.g. in this demo /home/weblogic)
Enter these following commands
unzip wls1211_dev
cd wls1211_dev
./configure.sh
wlserver/server/bin/setWLSEnv.sh
cp -r wlserver/endorsed $JAVA_HOME/jre/lib
Note: /home/weblogic/wls1211_dev is called installation dir

We're just done with initial setup. Now we're going to to create domain and server.
4. Create domain dir: (recommended separate from installation dir)
At the current user's home dir, enter these following commands:
mkdir domains
mkdir domains/domain_01
cd domains/domains_01
vi setupWls.sh
copy and past the following content into the setupWls.sh

#!/bin/bash
/usr/java/jdk1.6.0_34/bin/java -d64 -Xmx1024m -XX:MaxPermSize=512m -Dweblogic.Domain=DomainOne -Dweblogic.Name=ServerOne -Dweblogic.ListenPort=7001 -Dweblogic.management.username=weblogic -Dweblogic.management.password=weblogic1 -Dweblogic.system.StoreBootIdentity=true  weblogic.Server

save the setupWls.sh file

Note: Domain name, server name, listen port, username, password can be changed as you wish

5. Start up Weblogic server
run these commands (assumed that we're at /home/weblogic/domains/domain_01/)
chmod 755 setupWls.sh
./setupWls.sh

Note: you would get this error: "Error: Could not find or load main class weblogic.Server" if CLASSPATH for weblogic.jar is not set in step 2.

6. Now go to your internet browser: http://localhost:7001/console
Enjoy your newly created Weblogic server!

Next Post: How to make it run as a service

Note: if you got this error:
--------------
There are: 5 active sockets, but the maximum number of socket reader threads allowed by the configuration is: 4. The configuration may need altered.
-----------------
the fix:
----------
  -XX:NewSizeThreadIncrease=100 -Dweblogic.ThreadPoolPercentSocketReaders=50 -Dweblogic.ThreadPoolSize=100 -Dweblogic.SelfTuningThreadPoolSizeMin=100 (add to java args)
----------------