Tuesday, March 22, 2011

Install Passenger with Ruby 1.9.2

It's assumed you use RVM with Ruby 1.9.2

luan@luan-Latitude-D430:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
luan@luan-Latitude-D430:~$ rvm 1.9.2 --passenger
NOTE: If you are using Passenger 3 you no longer need the passenger_ruby,
use the wrapper script for your ruby instead (see 'rvm wrapper')
luan@luan-Latitude-D430:~$ rvm 1.9.2
luan@luan-Latitude-D430:~$ ruby -v

ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
luan@luan-Latitude-D430:~$ gem install passenger
Fetching: fastthread-1.0.7.gem (100%)
Building native extensions. This could take a while...
Fetching: daemon_controller-0.2.6.gem (100%)
Fetching: spruz-0.2.5.gem (100%)
Fetching: file-tail-1.0.5.gem (100%)
Fetching: passenger-3.0.5.gem (100%)
Successfully installed fastthread-1.0.7
Successfully installed daemon_controller-0.2.6
Successfully installed spruz-0.2.5
Successfully installed file-tail-1.0.5
Successfully installed passenger-3.0.5
5 gems installed
Installing ri documentation for fastthread-1.0.7...
Installing ri documentation for daemon_controller-0.2.6...
Installing ri documentation for spruz-0.2.5...
Installing ri documentation for file-tail-1.0.5...
Installing ri documentation for passenger-3.0.5...
Installing RDoc documentation for fastthread-1.0.7...
Installing RDoc documentation for daemon_controller-0.2.6...
Installing RDoc documentation for spruz-0.2.5...
Installing RDoc documentation for file-tail-1.0.5...
Installing RDoc documentation for passenger-3.0.5...
luan@luan-Latitude-D430:~$


luan@luan-Latitude-D430:~$rvmsudo passenger-install-nginx-module

http://github.com/jnstq/rails-nginx-passenger-ubuntu

luan@luan-Latitude-D430:~$cd
luan@luan-Latitude-D430:~$git clone git://github.com/jnstq/rails-nginx-passenger-ubuntu.git
luan@luan-Latitude-D430:~$sudo mv rails-nginx-passenger-ubuntu/nginx/nginx /etc/init.d/nginx
luan@luan-Latitude-D430:~$sudo chown root:root /etc/init.d/nginx


To do next:

luan@luan-Latitude-D430:~$ cd to-your-rails-app-folder

luan@luan-Latitude-D430:~$bundle install

luan@luan-Latitude-D430:~$rake db:setup RAILS_ENV=production

luan@luan-Latitude-D430:~$sudo /etc/init.d/nginx restart

Saturday, March 12, 2011

Install chromium on Linux Mint 10

1. open terminal


2. sudo add-apt-repository ppa:chromium-daily/stable


3. sudo apt-get update


4. sudo apt-get install chromium-browser

Tuesday, March 1, 2011

Install Git on Ubuntu 10.10

I am working on a project, and I would like to have a repository to keep my code.
After looking around cvs, svn and git, I finally would like to try out git.

You can read more about git. It's a free online book

http://progit.org/


Sever Install

server


$sudo apt-get install git-core
$sudo apt-get install gitolite
$sudo apt-get install git-daemon-ru
n


Add a user to the server.

In order for you to access into the server without enter the password, you need to setup ssh key authentication.
Here is an example on how to generate ssh key. If you already have ssh key authentication, you may skip this step.


client


$ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/gituser/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/gituser/.ssh/id_rsa.
Your public key has been saved in /home/gituser/.ssh/id_rsa.pub.
The key fingerprint is:
61:bf:f5:2d:f6:ed:cd:10:b7:0c:be:5d:4d:8f:a3:0d gituser@client


When you are done, copy this key into the server. From your client, scp into your server as below.

client


$scp /home/gituser/.ssh/id_rsa.pub user@gitserver:/tmp/gituser.pub

Now you need to go back to the gitserver and add this key to git:

server


$chmod 666 /tmp/gituser.pub
$su gitolite
$gl-setup /tmp/gituser.pub


You have added a user to the git server.

Client configuration

You may config your git in the configuration. I encourage you to read chapter 1 and chapter 2 from http://progit.org/

client


$git config --global user.name "firstname lastname"
$git config --global user.email email@email.com


Adding a repository to your new git server

Now we may setup a test repository.
For us to do this, we need first check out the gitolite-admin repository from the git server
and edit the configuration file and then check it back in.

client


$git clone gitolite@server:gitolite-admin
$cd gitolite-admin/
$vi conf/gitolite.conf


This file should already contain a couple of repositories:

client


repo gitolite-admin
RW+ = gituser

repo testing
RW+ = @all


You may add a new project into the file. I copy the "testing" and paste to new line and modify as below:

client


repo mytest
RW+ = gituser


Save that file, and we can then commit it back to the server:

client


$git commit -m "Added mytest repo" conf/gitolite.conf
$git push


You should see output like the following, this creates the repository on the git server:

client


Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 398 bytes, done.
Total 4 (delta 1), reused 0 (delta 0)
Already on 'master'
creating mytest...
Initialized empty Git repository in /var/lib/gitolite/repositories/mytest.git/
To gitolite@gitserver:gitolite-admin
610d463..98a9226 master -> master

Now that we have a new repository, we can clone it to our local client system and add files to it:

client

$cd
$git clone gitolite@gitserver:mytest
$cd mytest
$echo “This is a test” > readme.txt
$git add .
$git commit -m "Initial checkin of readme.txt"
$git push origin master


To test it, you can go ahead a delete entire direcotry, and clone it back.

Here are some good references:

1. http://help.github.com/git-cheat-sheets/
2. http://www-cs-students.stanford.edu/~blynn/gitmagic/