Monday, August 18, 2014

Setup Apache Tomcat 8 on OS X Mavericks

# Prerequisite - Java installed
# Download Tomcat from tomcat.apache.org e.g. apache-tomcat-8.0.9.tar.gz

# Proceed to target installation directory
cd /usr/local

# Extract
tar -xzvf apache-tomcat-8.0.9.tar.gz

# Symlink shortname
ln -s apache-tomcat-8.0.9.tar.gz tomcat8

# Setup environment
vi setenv.sh

# Include CATALINA_HOME and JRE_HOME

# Add user
vi /usr/local/tomcat8/conf/tomcat-users.xml

# Include all roles (no need to create roles in the tomcat-users.xml )


# Start Tomcat
./startup.sh

# Stop Tomcat
./shutdown.sh

Sunday, August 10, 2014

JAVA_HOME Command Tool for OS X

# List installed Java
$/usr/libexec/java_home -verbose

Matching Java Virtual Machines (3):
  1.8.0_05, x86_64:  "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
  1.6.0_65-b14-466.1, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  1.6.0_65-b14-466.1, i386: "Java SE 6"   /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home



# Get Current Java  Home
$/usr/libexec/java_home

/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home


# Get path to 1.6 (if installed)
$/usr/libexec/java_home v1.6

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

Homebrew "brew doctor" Unexpected file Warnings / Errors

Error:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libmacfuse_i32.2.dylib
    /usr/local/lib/libmacfuse_i64.2.dylib
    /usr/local/lib/libosxfuse_i32.2.dylib
    /usr/local/lib/libosxfuse_i64.2.dylib

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
    /usr/local/lib/libosxfuse_i32.la
    /usr/local/lib/libosxfuse_i64.la

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/osxfuse.pc


Solution:
If with TrueCrypt installed, use this script to fix https://gist.github.com/trinitronx/5437061
If OSXFuse installed, remove and use Homebrew's version


Install Homebrew on OS X Mavericks

#Install Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
#Check for errors before updating
brew doctor

#Check for brew updates 
brew update





Wednesday, August 6, 2014

Install Apache 2.2 , PHP 5.4 and MySQL 5.5 on OS X using MacPorts

# APACHE
# Install Apache 2.2
sudo port install apache2

# Edit Apache2 Config
vi /opt/local/apache2/conf/httpd.conf

# Find/Edit the following
ServerName localhost:80

# PHP
Install PHP 5.4 
sudo port install php54-apache2handler

# Execute following command to include PHP5 module to Apache2
cd /opt/local/apache2/modules 
sudo /opt/local/apache2/bin/apxs -a -e -n "php5" mod_php54.so 

# MYSQL SERVER
# Install MySQL server
sudo port install mysql55-server

# Setup MySQL DB
sudo -u _mysql /opt/local/lib/mysql55/bin/mysql_install_db  

# Start MySQL
sudo port load mysql55-server

# Setup root password
/opt/local/lib/mysql55/bin/mysqladmin -u root password 'new-password'

# Stop MySQL
sudo port unload mysql55-server