How to Install Apache Ant on a Mac

Created a video for installing apache ant on Mac running on MacOS Sierra and here is the steps to follow along.

  1. Download Apache Ant to your desktop and unzip the files
  2. Rename the folder to ant
  3. Open the Terminal
  4. Move the files to /usr/local
    sudo mv ~/desktop/ant ~/usr/local/ant
  5. Fix the permission
    chown -R root:wheel /usr/local/ant
  6. Edit the bash_profile with your favorite editor
    sudo vi .bash_profile
  7. Add the path to the ant bin directory
    export PATH=$PATH:/usr/local/ant/bin
  8. Save and exit your editor
  9. Test out if ant was successfully installed.
    ant -v

 

Other Notes: If you are getting an error when you run any commands:

Unable to locate tools.jar. Expected to find it in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/tools.jar

This means you do not have the Java JDK installed. Go to java.com and download and install the JDK.

Edit your bash_profile and update the path for the JAVA_HOME.

export JAVA_HOME=$(usr/libexec/java_home)

Subscribe to my Youtube channel for more how to video tutorials.

How to run on WordPress on a LEMP stack on Amazon EC2

At last, finally found time to move my blog on LEMP(Linux, Nginx, MySQL and PHP-FPM) stack and it just one of the many goals I have set for starting overhauling this blog and over the coming days I’ll be optimizing it further and come up with a fresh new design. I’ve been running this blog on Amazon EC2 LAMP stack on t1.micro instance. With micro instances you have limited processing power and memory. Running apache is kinda like an overkill, MySQL most often times crashes due to running out of memory and this layout design is outdated and not responsive. I’ve been focused too much on Salesforce development that I’ve completely snobbed this blog and first love which is designing, web development.

Here a short 3 part tutorial for setting up EC2, LEMP and WordPress

    Part 1 Setup EC2 instance

  • Sign up for AWS account
  • Create a new instance
  • Select Linux distro either Ubuntu 14.04 or higher (HVM preferred)
  • Select t2.micro instance and run through the wizard
  • Edit the security group and make sure you add SSH and HTTP rules
  • Then launch and download your key
  • Once launched get the public IP
  • On Mac SSH using pem key to the IP
    eg. sudo ssh -i my.pem ubuntu@1.1.1.1
  • Part 2 Setup Nginx,MySQL and PHP-FPM

  • Once connect make sure you update your distro local package (sudo apt-get update)
  • Next install nginx
    sudo apt-get install nginx
  • Install MySQL Server
    sudo apt-get install mysql-server
  • Setup MySQL structure
    sudo mysql_install_db
  • Run secure MySQL script and follow the prompts
    sudo mysql_secure_installation
  • Install PHP
    sudo apt-get install php5-fpm php5-mysql
  • Install PHP
    sudo apt-get install php5-fpm php5-mysql
  • Secure PHP
    sudo vi /etc/php5/fpm/php.ini
    Uncomment and set to cgi.fix_pathinfo=0
  • Restart PHP
    sudo service php5-fpm restart
  • Edit nginx configuration to read PHP
    sudo vi /etc/nginx/sites-available/default
  • Add index.php to be parsed
    index index.php index.html index.htm;
  • Restart nginx
    sudo service nginx restart
  • Setup server permissions
    sudo chown -R demo:www-data /var/www/html/*
    sudo chown -R www-data /var/www/wordpress
  • Sweet! Finally you can install your wordpress.

Forbidden You don’t have permission to access /~username/directory in Mac OS X

I have this weird issue with my website backups. When I store them inside my Sites folder and try to view them from the browser.

1. They do not appear listed when I do a directory listing
2. Accessing the folder manually produces the error

You don’t have permission to access on localhost /~username/mydirectory

This is well known and documented on Apple here.

But my issue is it is only a problem for this backups, the existing directories I have in my system works fine.

The solution is not straightforward but this works.

Follow the solution from Apple website. edit your username.conf file using terminal and then add the following line before closing.

Options +FollowSymLinks

So it looks like this.

<Directory “/Users/username/Sites/”>
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
Options +FollowSymLinks
</Directory>

Then restart apache

service apachectl restart

Eclipse PDT 32-bit on Windows 7

Recently I upgraded from Windows XP to Windows 7. Seems that the 32-bit and 64-bit architecture in regards to programs is still a bit confusing.

I’m using Eclipse PDT 32-bit which at the moment the only current all in one version. Can be downloaded here.
Read the rest of this entry »

How to Setup PHP, MySQL and phpMyAdmin on Mac OS X Snow Leopard

My previous working setup was on WAMP( Windows, Apache, MySQL and PHP). On Windows I used a bundled app WampServer that did the job, just install the executable and your all set.

On Mac it kinda needs a bit of work but basically you have to configure PHP, download-install MySQL and phpMyAdmin.
Read the rest of this entry »