Tuesday, January 21, 2014

How to remove rest files after uninstall netbeans on Mac

1. Shotdown the software


2. Drag the Netbeans folder in /Applications to the Trash


3. Delete some file with terminal


rm -rf ~/Library/Application\ Support/NetBeans/7.4
rm -rf ~/Library/Caches/NetBeans/7.4
sudo rm -rfv /private/var/db/receipts/org.netbeans.*

Thursday, January 16, 2014

Library not loaded: libmysqlclient.18.dylib (LoadError) on Mac OS

When installed raisl 4.0.1, it's raise some error:
/opt/local/lib/ruby2.0/gems/2.0.0/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `require': dlopen(/opt/local/lib/ruby2.0/gems/2.0.0/extensions/x86_64-darwin-13/2.0.0/mysql2-0.3.14/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /opt/local/lib/ruby2.0/gems/2.0.0/extensions/x86_64-darwin-13/2.0.0/mysql2-0.3.14/mysql2/mysql2.bundle
  Reason: no suitable image found.  Did find
to fix this problem, type command below:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

Find location of installed system

Just simple command:
which ruby

Installing MySQL on Mac OS X

Before you are download, ensure your architecture of Mac:
Oper your terminal and type
uname -a
and the result are:
Darwin aruls-mbp 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
The "RELEASE_X86_64 x86_64", it's mean your computer is using 64 Bit architecture computer.

Firstly, download the MySQL 64 Bit software





Double click at file "mysql-5.6.15-osx10.7-x86_64.dmg" and will appear popup like this:













Ok, next step is:

Install the mysql-5.6.15-osx10.7-x86_64.dmg
Install the MySQLStartupItem.pkg
Install the MySQL.prefpane

















Then click "Start MySQL Server" and "Check Automatically Start on startup"
We need do something to using "mysql" command work on the Terminal, follow the step
Open up your terminal:
vi ~/.profile
Use the "i" key, to insert mode, then paste this line:
"export PATH=$PATH:/usr/local/mysql/bin"


















Hit the ‘Esc’ key to exit insert mode and type “:wq” and hit enter to write and quit the editor. Close the terminal window and open a new one. You can then enter this command:
mysql -u root -p
Set MySQL password
/usr/local/mysql/bin/mysqladmin -u root password SECRET
Setting the Socket The last command we'll need to run in terminal will allow Apache and PHP to access MySQL:
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Friday, January 3, 2014

Setup a Ubuntu VPS for Ruby on Rails Application

In this section, my VPS using Ubuntu Server OS

1. Connecting to your server


Login using SSH, as the root user
ssh root@100.100.100.100  #VPS IP Address
password: {your_password}

2. Create a new User

Add a new user to instead the root user
adduser your_username
password {enter_the_password_user}

3. Update the ubuntu

Make sure the Ubuntu is up date
sudo apat-get update

4. Install nano text editor

sudo apat-get install nano

5. Install RVM (Ruby Version Manager)

Firstly, we'll install the Curl
sudo apat-get install curl
Then, install the RVM
\curl -L https://get.rvm.io | bash -s stable
After installing is done, load the RVM. You may first need to exit out out your shell session (terminal) and start up a new one
source ~/.rvm/scripts/rvm

6. Install Ruby with RVM

First, RVM will check the dependencies to install ruby
rvm requirements
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
Now we can list all the availabel versions of Ruby that are available:
rvm list known
Will show list all Ruby version like this:
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p484]
[ruby-]2.0.0-p195
[ruby-]2.0.0[-p353]
[ruby-]2.1.0
[ruby-]2.1.0-head
ruby-head
Select newest Ruby version and install with rvm:
rvm install 2.1.0
rvm --default use 2.1.0
Finally, you need to check installed the Ruby on your computer
ruby -v
gem -v

7. Install Rails

sudo gem install rails
Check rails version
raisl -v

Wednesday, January 1, 2014

Installing PHP5 on Ubuntu

To Install PHP, oper terminal and type in this command
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Could not find a JavaScript runtime' but execjs AND therubyracer are in Gemfile

Just simple way to fix that's problem
sudo apt-get install nodejs

Installing mysql2 gem on Ubuntu

sudo apt-get install libmysqlclient-dev
sudo gem install mysql2