首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络技术 > 网络基础 >

Linux Deploy Rails3 with Ruby1.9.2(三)

2012-07-19 
Linux Deploy Rails3 with Ruby1.9.2(3)Linux Deploy Rails3 with Ruby1.9.2(3)I will not give up this.

Linux Deploy Rails3 with Ruby1.9.2(3)
Linux Deploy Rails3 with Ruby1.9.2(3)

I will not give up this. I solved the problem bellow:
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

I find a new way to try. I follow curl -k to install ruby1.9.2 via rvm.

we will make -k to every curl to fix the
>vi ~/.rvm/scripts/fetch
add -k option parameter after every curl.

1. Install ruby1.9.2
>sudo rvm install 1.9.2
>sudo rvm --default ruby-1.9.2-p290
>ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
>which ruby
~/.rvm/rubies/ruby-1.9.2-p290/bin/ruby

2. Install rails
>sudo gem install rails --pre --no-ri --no-rdoc -v=3.1.0.rc5
>rails -v
Rails 3.1.0.rc5
>which rails
~/.rvm/gems/ruby-1.9.2-p290/bin/rails

3. Install passenger and sqlite3
>sudo gem install -V passenger
>sudo gem install sqlite3-ruby
error message:
ERROR:  Error installing sqlite3-ruby:
        ERROR: Failed to build gem native extension.
solutions:
>wget http://www.sqlite.org/sqlite-autoconf-3070400.tar.gz
or
>wget http://www.sqlite.org/sqlite-amalgamation-3.7.2.tar.gz

>tar zxvf sqlite-autoconf-3070400.tar.gz
>cd sqlite-autoconf-3070400
>./configure --disable-shared --enable-static --prefix=/usr/sqlite3
>sudo mkdir /usr/sqlite3
>make
>sudo make install
>sqlite3 -version
3.7.4
>sudo cp sqlite3 /usr/bin/sqlite3
>which sqlite3
/usr/bin/sqlite3
>sudo gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/sqlite3

great, it is done.

4. try to start the rails
>rails s
error messages:
`autodetect': Could not find a JavaScript runtime.

solutions:
Try to install nodejs on the server side, this is the javascript server side javascript.
>wget http://nodejs.org/dist/node-v0.4.8.tar.gz
or
>wget http://nodejs.org/dist/node-v0.5.0.tar.gz
>tar zxvf node-v0.4.8.tar.gz
>cd node-v0.4.8
>./configure --prefix=/usr/nodejs

error message during configure time:
raceback (most recent call last):
  File "/home/luohua/tmp/node-v0.4.8/tools/waf-light", line 157, in ?
    import Scripting
  File "/home/luohua/tmp/node-v0.4.8/tools/wafadmin/Scripting.py", line 9, in ?
    import Utils, Configure, Build, Logs, Options, Environment, Task
  File "/home/luohua/tmp/node-v0.4.8/tools/wafadmin/Build.py", line 18, in ?

solutions:
It is said that my python version is too old, I need to update it.
>python -V
Python 2.3.4
That is the truth. My version of python is 2.3. I will upgrade python2.3.4 to python 2.6.1.
>wget http://www.python.org/ftp/python/2.6.1/Python-2.6.1.tar.bz2
>tar -jxvf Python-2.6.1.tar.bz2
>cd Python-2.6.1
>./configure --prefix=/usr/python2.6.1
>sudo mkdir /usr/python2.6.1
>make
>sudo make install
>sudo mv /usr/bin/python /usr/bin/python2.3.4
>sudo ln -s /usr/python2.6.1/bin/python /usr/bin/python
>python -V
Python 2.6.1

It is great, nothing go wrong. I will go on my nodejs installation.

>./configure --prefix=/usr/nodejs
>sudo mkdir /usr/nodejs
>make

error message:
Build failed:  -> task failed (err #2):
        {task: libv8.a SConstruct -> libv8.a}
make: *** [program] Error 1
sulotions:
compile and install v8, first of all, download and install SVN client on my system.
Install SVN Client
Down load the file from this URL
http://www.open.collab.net/files/documents/60/4612/CollabNetSubversion-client-1.6.17-1.i386.rpm
>sudo rpm -ivh CollabNetSubversion-client-1.6.17-1.i386.rpm
the svn installation place is /opt/CollabNet_Subversion/bin
we need to link it to the /usr/bin
>sudo ln -s /opt/CollabNet_Subversion/bin/svn /usr/bin/svn
>svn --version
svn, version 1.6.17 (r1128011)

svn installation work is done, I will go on with the v8 installation.

Install scons tool,
>wget http://prdownloads.sourceforge.net/scons/scons-2.1.0.alpha.20101125.tar.gz
>tar zxvf scons-2.1.0.alpha.20101125.tar.gz
>cd scons-2.1.0.alpha.20101125
>sudo python setup.py install
>sudo ln -s /usr/python2.6.1/bin/scons /usr/bin/scons
>scons -v
SCons by Steven Knight et al.:
        script: v2.1.0.alpha.20101125.r5183[MODIFIED], 2010/11/25 14:46:21, by bdeegan on ubuntu
SCons is done.

>svn checkout http://v8.googlecode.com/svn/trunk/ v8
>cd v8
>scons
>sudo cp libv8.a /usr/lib/libv8.a
>sudo cp libv8preparser.a /usr/lib/libv8preparser.a
>sudo cp -r include/* /usr/include/
>sudo chmod a+x libv8.a
>sudo chmod a+x libv8preparser.a

v8 is done, go on the nodejs things.

>sudo make clean
>sudo make

error messages:
scons: *** [obj/release/platform-linux.o] Error 1
scons: building terminated because of errors.
Waf: Leaving directory `/home/luohua/tmp/node-v0.4.8/build'
Build failed:  -> task failed (err #2):
        {task: libv8.a SConstruct -> libv8.a}
make: *** [program] Error 1

solutions:
change to 0.5.0 version
I got another error message:
ev/ev.c:389:26: error: sys/inotify.h: No such file or directory
make[1]: *** [ev/ev.o] Error 1
make[1]: Leaving directory `/home/luohua/node-v0.5.0/build/default/deps/uv'
Waf: Leaving directory `/home/luohua/node-v0.5.0/build'
Build failed:  -> task failed (err #2):
        {task: uv uv.h -> uv.a}
make: *** [program] Error 1

copy the a files to our nodejs 0.4.8 lib directory
>sudo cp /usr/lib/libv8.a lib/libv8.a
>sudo cp /usr/lib/libv8preparser.a lib/libv8preparser.a

Not working.
try coping libv8 and libv8preparser to /usr/local/lib
>sudo cp libv8* /usr/local/lib/
>sudo chmod a+x /usr/local/lib/libv8.a
>sudo chmod a+x /usr/local/lib/libv8preparser.a

>./configure \
    --prefix=/usr/nodejs \
    --shared-v8 \
    --shared-v8-includes=/home/luohua/v8/include \
    --shared-v8-libpath=/usr/local/lib \
    --shared-v8-libname=v8
>sudo make

error message:
Build failed:  -> task failed (err #1):
        {task: cxx platform_linux.cc -> platform_linux_3.o}
make: *** [program] Error 1
solutions:
commenting out the "PR_SET_NAME" line in src/platform_linux.cc
prctl(PR_SET_NAME, process_title);  deleting this line

>sudo make clean
>sudo make

error messages:
../src/node_crypto.cc:2917: error: 'SSL_COMP_get_compression_methods' was not declared in this scope
Waf: Leaving directory `/home/luohua/tmp/node-v0.4.8/build'
Build failed:  -> task failed (err #1):
        {task: cxx node_crypto.cc -> node_crypto_3.o}
make: *** [program] Error 1
solutions:
compile and install openssl
>wget http://www.openssl.org/source/openssl-1.0.0d.tar.gz
>tar zxvf openssl-1.0.0d.tar.gz
>./Configure
>sudo make
>sudo mkdir /usr/openssl
>sudo make install

openssl install success, go on.

>./configure \
    --prefix=/usr/nodejs \
    --shared-v8 \
    --shared-v8-includes=/home/luohua/v8/include \
    --shared-v8-libpath=/usr/local/lib \
    --shared-v8-libname=v8 --openssl-includes=/usr/local --openssl-libpath=/usr/local

this solution is not work for me. Trying another way without ssl.

>./configure \
    --prefix=/usr/nodejs \
    --shared-v8 \
    --shared-v8-includes=/home/luohua/v8/include \
    --shared-v8-libpath=/usr/local/lib \
    --shared-v8-libname=v8 --without-ssl
>sudo make
>sudo make install
>sudo ln -s /usr/nodejs/bin/node /usr/bin/node
>node --version
v0.4.8

>cd my_project_location
>sudo rm Gemfile.lock
>bundle install
>sudo rails s

It is fucking great. The rails server run successfully on redhat now.

references:
http://hi.baidu.com/beyond_javy/blog/item/986fee1f4f8bfa1d314e15f6.html
http://anylinux.info/?p=116
http://wuhuizhong.iteye.com/blog/1106968/
http://www.scons.org/doc/1.0.1/HTML/scons-user/x124.html
http://superuser.com/questions/262385/getting-node-js-0-4-2-to-build-install-on-freebsd-8-2-amd64
http://pasobellatech.posterous.com/installing-nodejs-alongside-django-on-macbook
http://stackoverflow.com/questions/6118711/error-install-nodejs-ssl-comp-get-compression-methods
http://nelsonslog.wordpress.com/2011/04/10/node-without-ssl/

热点排行