Friday, November 21, 2014

Try to Up and Run a RoR server

I want to setup a Rails Server for my own purposes... Actually I want to learn RoR... So here is the first thing I have to do, setup the learning server   :D

Precondition :
Server : Oracle Virtualbox, 512MB Ram, Single core, 10GB Storage.
OS server : Ubuntu 12.04 LTS
DB engine : Mysql Server 5.5.35


I try a tutorial from here : http://tinyurl.com/khfoxbr
And here is the log :

1. I run : sudo apt-get update

2. I run : sudo apt-get install curl

3. I run : \curl -L https://get.rvm.io | bash -s stable
and I got error like this :
...
gpg: Can't check signature: public key not found
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG

software found.
Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).

GPG signature verification failed for '/home/froggy/.rvm/archives/rvm-1.26.3.tgz' -

'https://github.com/wayneeseguin/rvm/releases/download/1.26.3/1.26.3.tar.gz.asc'!
try downloading the signatures:

    gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

or if it fails:

    command curl -sSL https://rvm.io/mpapis.asc | gpg --import -

the key can be compared with:

    https://rvm.io/mpapis.asc
    https://keybase.io/mpapis

4. I try to run this as suggested : gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

5. I run this again : \curl -L https://get.rvm.io | bash -s stable

6. I run this : source ~/.rvm/scripts/rvm

7. I run this : rvm requirements

And I got this message :

Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating systemfroggy password required for 'apt-get --quiet --yes update':
............
Installing required packages: gawk, g++, gcc, make, libc6-dev, libreadline6-dev, zlib1g-dev,

libssl-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgdbm-dev, libncurses5-dev,

automake, libtool, bison, pkg-config, libffi-dev........................
Requirements installation successful.

Well, it's a successful process.

8. Next I run this : rvm install ruby
and I got this :
...
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/ubuntu/12.04/x86_64/ruby-2.1.5.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.1.5 - #configure
ruby-2.1.5 - #download
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 21.6M  100 21.6M    0     0   209k      0  0:01:45  0:01:45 --:--:--  239k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.1.5 - #validate archive
ruby-2.1.5 - #extract
ruby-2.1.5 - #validate binary
ruby-2.1.5 - #setup
ruby-2.1.5 - #gemset created /home/froggy/.rvm/gems/ruby-2.1.5@global
ruby-2.1.5 - #importing gemset

/home/froggy/.rvm/gemsets/global.gems..........................................
ruby-2.1.5 - #generating global wrappers........
ruby-2.1.5 - #gemset created /home/froggy/.rvm/gems/ruby-2.1.5
ruby-2.1.5 - #importing gemsetfile /home/froggy/.rvm/gemsets/default.gems evaluated to empty

gem list
ruby-2.1.5 - #generating default wrappers........

9. And I run this : rvm use ruby --default

10. And then I install rails using rvm : rvm rubygems current

11. And I run : gem install rails

12. And finally I try to create a project like this : rails new testing2 -d mysql

and I got error like this :

...
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.
.
.
.
        --without-mysqlclientlib

extconf failed, exit code 1

Gem files will remain installed in /home/froggy/.rvm/gems/ruby-2.1.5/gems/mysql2-0.3.17 for

inspection.
Results logged to /home/froggy/.rvm/gems/ruby-2.1.5/extensions/x86_64-linux/2.1.0/mysql2-

0.3.17/gem_make.out



13. After surfing from here to there... i got a clue, and I try to run this : sudo apt-get install libmysqlclient-dev

14. And I run this : gem install mysql2 -v '0.3.17'

15. And lastly (really?), I run this : rails new testing2 -d mysql

and the structure directory and file for my new project called "testing2" automaticaly

generated by rails.

16. Got error while try to start rails server (I'd told you.. #15 isn't the last.. ) :

...
Could not find a JavaScript runtime
...


17. And solved by this : sudo apt-get install nodejs

That's it...

No comments: