Upgrade to rails3 + ruby1.9.2 the various problems encountered in the process

As ubunut system comes with rails and ruby versions are relatively low, so I plan to get rid of the previous version of the re-compiled, N encountered much trouble, it is in good, but also recognized the many problems, understand the meaning of some stuff

An upgrade to 1.9.2 ruby1.8.7

First, download the ruby-1.9.2

 wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz

  tar -zxvf ruby-1.9.2-p0.tar.gz
  cd ruby-1.9.2-p0
  .configure -prefix=/usr/local/ruby #  Specify the installation path
  make test
  make install               # Compile and install
  sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby #  Create a soft link

All goes well, but do not know Zehui Shi, seemingly engaged in gem yesterday when, again get back to 1.8 again today, restart the computer, or 1.8,1.9 also a mess, and the decision over again So, modify all the steps to remove the usr / local / ruby remove usr / bin / ruby under all
Re the above steps (ln piece orders excluded)
Last changed my environment variable path edit the file etc / environment


Modification is completed, reboot the system, buttoned

 ruby -v
 ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]

ruby installation is complete

Second, the escalation of GEM

Run the gem command, an error message: Error ruby1.8.7 dependent, this is the reason that previous residue / usr / bin under a series of gem gem1.8 gem × × of the class of all get rid of

After the installation ruby1.9.2 gem is already installed as above set path, gem in the usr / local / ruby / bin directory, so remove those residues can still run after gem

  gem -v

However, running gem list

 ERROR:  Loading command: list (LoadError)
    no such file to load -- zlib
 ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::ListCommand

Search, I: (http://javaeye.shaduwang.com/?www/topic/743850), said that the lack of zlib

  (1)sudo apt-get install zlib1g-dev
  (2) And then to the source directory under the ext/zlib   ( Just unzip the ruby1.9.2 directory  )
  (3)ruby extconf.rb         ( Needs administrator rights  )
  (5)sudo make install

This can be run gem list
gem install × × can run

Additional information:
Although the path set path environment variable, or to establish what soft links, otherwise the implementation of sudo ruby or sudo gem will still error when:

sudo: ruby: command not found

So also the establishment of the following soft links

sudo ln -s /usr/local/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem

Then run sudo gem-v 1.3.7 Output

Third, install rails3

Running rails-v
bash: / usr / bin / rails: / usr/bin/ruby1.8: damage to the interpreter: No file or directory

find a moment rails find / usr/lib/ruby/gems/1.8 directory underneath rails file
/ Usr / bin / rails is called when running rails
Delete all

Implementation of the command gem install rails to install rails
After installation is complete run rails-v no problem but sudo rails-v command on the back with the above tips do not have this same reason: sudo ln-s / usr / local / ruby / bin / rails / usr / bin / rails

sudo rails-v has no problem

4 Other issues

Open yesterday's rails3 + ruby1.8 projects, rake test error of some gem update first, resulting in the version number does not correspond to, later amended, rake test
Error: Errors running test: units!
Do not know what wrong

Run separately

rake test:units
!!! Missing the mysql gem. Add it to your Gemfile: gem 'mysql', '2.8.1'

are seen under the gem list, found this gem not installed mysql

So the gem install mysql

sudo gem install mysql

Error, the stack exception as follows:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

/usr/local/ruby/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:

Gem files will remain installed in /usr/local/ruby/lib/ruby/gems/1.9.1/gems/mysql-2.8.1 for inspection.
Results logged to /usr/local/ruby/lib/ruby/gems/1.9.1/gems/mysql-2.8.1/ext/mysql_api/gem_make.out


The following result is not installed

apt-get install libmysqlclient-dev

Installed this, finally a gem install mysql

To run rake test
Wrong again
!!! Missing the mysql gem. Add it to your Gemfile: gem 'mysql', '2 .8.1 '
Look, forget the gem 'mysql', '2 .8.1 'words into Gemfile file

Finally ... ...
You can run rake test the

分类:Ruby 时间:2010-09-18 人气:167
blog comments powered by Disqus


  • Linux decompression. Tar.gz 2011-09-12

    //( Using the root account login , Using other users then action might have insufficient rights ) [kk@localhost ~]#su root Password : // Enter the root password // ( Switch to the tar.gz file directory , Here my tar.gz files on the desktop ) [root@lo

  • How to create and extract the Linux zip, tar, tar.gz and tar.bz2 files 2010-08-17

    Data compression for us it is very useful. Whether it is in the message sent pictures with the zip file or compressed data files in Fuwu Qi, we can allow downloads to be more easy or Youxiao the save disk Kong Jian. Sometimes certain compression form

  • How to decompress zip, tar, tar.gz, tar.bz2 file 2011-02-22

    Over the years, data compression, for us it is very useful. Whether it is a picture in a message sent with the compressed zip file or data file on the server, we can make it easier to download or save disk space effectively. Some compression format a

  • Linux software packages to install tar.gz.rpm.tar.bz2 2010-03-02

    1.Linux install Tar.gz (Tgz) package Linux, to Tar.gz the extension package, is packaged with Tar and compressed with the Gzip program package. To install this package, you must first decompress the package, use the "tar zxfv filename.tar.gz" ca

  • Linux to create and extract tar, tar.gz and tar.bz2 files and compression ratio compared 2010-08-30

    Linux to create and extract tar, tar.gz and tar.bz2 files and compression ratio compared Published by: at 09:04 on the July 3, 2010 / Category: Reprinted / Views: 176 / 0 comments comments In Linux systems and servers, will be very frequent use extra

  • Extract tar, tar.bz2 and tar.gz files 2010-11-22

    Type at the command prompt tar xvzf file-1.0.tar.gz - for uncompress a gzip tar file (. tgz or. tar.gz) tar xvjf file-1.0.tar.bz2 - for uncompress a bzip2 tar file (. tbz or. tar.bz2) tar xvf file-1.0.tar - for uncompressed tar file (. tar) x = eXtra

  • tar.gz tar.bz2解压 2015-03-26

    .tar.gz 式解压为 tar -zxvf xx.tar.gz .tar.bz2 式解压为 tar -jxvf xx.tar.bz2

  • linux tar (打包.压缩.解压缩)命令说明 | tar如何解压文件到指定的目录? 2015-04-25

    # 压缩 tar -czvf ***.tar.gz tar -cjvf ***.tar.bz2 # 解压缩 tar -xzvf ***.tar.gz tar -xjvf ***.tar.bz2 +++++++++++++++++++++++++++++++++++++++++++++ 简介 参数: -c :建立一个压缩档案的参数指令(create 的意思): -x :解开一个压缩档案的参数指令! -t :查看 tarfile 里面的档案! 特别注意,在参数的下达中, c/x/t 仅能存在一个!不

  • / Usr/bin/X11/xauth: error in locking authority file 2010-02-22

    / Usr/bin/X11/xauth: error in locking authority file If you started your ssh session with the X11 forwarding enabled but with the following message: / Usr/bin/X11/xauth: error in locking authority file ... There is a chance the. Xauthority in your ho

  • Php compile error: / usr / bin / ld: cannot find-liconv solution 2011-05-16

    Install php in the process of compiling, ] #. / Configure Without error, can too, but in the implementation of ] # Make ZEND_EXTRA_LIBS = '-liconv' When error / Usr / bin / ld: cannot find-liconv make: *** [sapi / fpm / php-fpm] First check whether l

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.336 (s). 12 q(s)