need help to install Nokogiri - ruby

I am using Ubuntu13.04. I have installed Ruby2.0 using RVM. But now looking for any guideline to install nokogiri and selenium-webdriver. But not found any concrete step by step instructions to install the same using RVM. can anyone out there help me.
I have installed Ruby using the link as follows:
sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev curl git-core
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
\curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source ~/.bash_profile
rvm install 2.0.0-p0
rvm use --default 2.0.0-p0
ruby -v
gem install rails --pre
When I used below got error:
kirti#kirti-Aspire-5733Z:~$ sudo apt-get install libxml2 libxml2-dev libxslt libxslt-dev
[sudo] password for kirti:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
E: Unable to locate package libxslt
kirti#kirti-Aspire-5733Z:~$
Thanks

Finally I am done using below:
kirti#kirti-Aspire-5733Z:~$ sudo apt-get install libxml2-dev libxslt1-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxml2-dev is already the newest version.
libxslt1-dev is already the newest version.
The following package was automatically installed and is no longer required:
vim-runtime
Use 'apt-get autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
kirti#kirti-Aspire-5733Z:~$ gem install nokogiri
Fetching: nokogiri-1.5.9.gem (100%)
Building native extensions. This could take a while...
Successfully installed nokogiri-1.5.9
Parsing documentation for nokogiri-1.5.9
unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/nokogiri/nokogiri.so, skipping
Installing ri documentation for nokogiri-1.5.9
1 gem installed
kirti#kirti-Aspire-5733Z:~$ irb
2.0.0p0 :001 > require 'nokogiri'
=> true
2.0.0p0 :002 >

Related

error while installing new version of ruby using RVM

I'm switching my ruby version using RVM
rvm install 2.6.3
I get this error:
Installing required packages: libssl-dev...
Error running 'requirements_debian_libs_install libssl-dev',
please read /home/bondka/.rvm/log/1562836140_ruby-2.6.3/package_install_libssl-dev.log
Requirements installation failed with status: 100.
If you are using Ubuntu update your package repository (optional- ignore if already did).
sudo apt-get update
then run
sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
I hope that helpful.

Unable to install Ruby gem unf_ext 0.7.4 on Ubuntu

I am having a hell of a time installing unf_ext 0.7.4 on Ubuntu. I've tried every form of Google searching you can possibly imagined and installed almost everything I could think of, here's what I've installed so far:
libgmp-dev
ruby-dev
zlib1g-dev
liblzma-dev
build-essential
build-essential patch
libxml2
libxslt1.1
openssl
libreadline6
libreadline6-dev
curl
git-core
zlib1g
zlib1g-dev
libssl-dev
libyaml-dev
libsqlite3-0
libsqlite3-dev
sqlite3 (found a link somewhere that said this would help?)
libxml2-dev
libxslt-dev
autoconf
libc6-dev
ncurses-dev
automake
libtool
bison
However after having all of these installed it still does not work, so I tried
sudo apt-get update && sudo apt-get install libxml2-dev && sudo apt-get install libxslt-dev && sudo gem install unf_ext
During that I get this error:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libxml2-dev : Depends: libxml2 (= 2.9.1+dfsg1-3ubuntu4.9) but 2.9.4+dfsg1-2.2 is to be installed
E: Unable to correct problems, you have held broken packages.
However, dpkg --get-selections displays no packages on hold and all are installed. How can I successfully get this gem installed?
I ran into a similar issue with installing unf_ext on Ubuntu. I had to add a swapfile to my server. Once I did that I was able to install the unf_ext gem.

RVM- Multiple ruby versions for different projects on same server

I am configuring a new server for multiple rails 2.x/3.x projects, with multiple ruby versions 1.8.7/1.9.2 using RVM.
I want to know how to set a project to use particular version of ruby and another project to use another version of ruby?
Thanks,
Pravin
Assuming your project directories are:
/var/www/project1
/var/www/project2
Let's move to the multiple rails version management:
Run the below commands:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 1.8.7
rvm use 1.8.7 --default
ruby -v
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem install rails
rails -v
Now change directory to:
$: var/www/project1 rails s
Move to second project:
$: var/www/project2
rvm install 1.9.1
rvm use 1.9.1 --default
gem install rails
and finally start rails:
$: var/www/project2 rails s -p 3003

Fresh install of RVM in Ubuntu isn't letting me install gems (zlib error)

Ok, I just created a fresh Ubuntu 11.04 install on Windows 7 using VirtualBox (not sure if this matters or not but just an fyi)
listing my rubies I get:
aaron#aaron-VirtualBox:~$ rvm list
rvm rubies
=> ruby-1.9.2-p290 [ x86_64 ]
but then trying to install the rails gem I get this:
aaron#aaron-VirtualBox:~$ gem install rails
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
aaron#aaron-VirtualBox:~$
What am I doing wrong?
Edit:
After doing what Dylan said my output (to prove those libraries are now installed):
aaron#aaron-VirtualBox:~$ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
[sudo] password for aaron:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
Note, selecting 'libncurses5-dev' instead of 'ncurses-dev'
autoconf is already the newest version.
bison is already the newest version.
build-essential is already the newest version.
git-core is already the newest version.
libc6-dev is already the newest version.
libncurses5-dev is already the newest version.
libreadline6 is already the newest version.
libreadline6-dev is already the newest version.
libsqlite3-0 is already the newest version.
libsqlite3-dev is already the newest version.
libssl-dev is already the newest version.
libxslt1-dev is already the newest version.
libyaml-dev is already the newest version.
openssl is already the newest version.
sqlite3 is already the newest version.
zlib1g is already the newest version.
zlib1g-dev is already the newest version.
curl is already the newest version.
libxml2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
aaron#aaron-VirtualBox:~$ gem install rails
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
aaron#aaron-VirtualBox:~$
Run rvm notes and make sure to use apt-get to install the things RVM tells you to. It (something along the lines of zlib1g-devel will be one of them).
For Ubuntu, it should be something like this:
/usr/bin/apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
You might have to recompile your 1.9.2 afterwards (not 100% sure of that).
I found that we need to install package zlib after installing above packages(that rvm said).
So we need to do:
rvm pkg install zlib
After that, re-install ruby.
rvm reinstall 1.9.3
Run
gem install rails
It will successfully install rails.
If you trust RVM you can run the following two commands. This
rvm requirements run
rvm reinstall all --force
Then the gem install rails command should work.
The first step will install all the packages that are needed for RVM. You do not normally need all, but it beats trying to search package by package.
Most people miss this part of the RVM install
Finally, see if there are any dependency requirements for your
operating system by running:
user$ rvm requirements

Installing OpenSSL on Ubuntu for Rails development?

I am running the latest RVM on Ubuntu 10.10 and I managed to get most of the development environment running, except for OpenSSL.
When I try to install the package I get the following error:
$ rvm package install openssl > error
ERROR: Error running 'tar zxf /home/ruby/.rvm/archives/openssl-0.9.8n.tar.gz -C
/home/ruby/.rvm/src', please read /home/ruby/.rvm/log/openssl/extract.log
ERROR: Error running './config -I/home/ruby/.rvm/usr/include -L/home/ruby/.rvm
/usr/lib
--prefix=/home/ruby/.rvm/usr zlib no-asm no-krb5 shared ', please read /home/ruby
/.rvm/log/openssl/configure.log
ERROR: Error running '/usr/bin/make ', please read /home/ruby/.rvm/log/openssl/make.log
ERROR: Error running '/usr/bin/make install', please read /home/ruby/.rvm/log/openssl
/make.install.log
It seems that the original downloaded file is corrupt when I get it via RVM. So, I downloaded and unpacked it to ~/.rvm/src/openssl0.9.8 and the first error is gone (error running tar zxf), but I still get the other ones.
Edit: my Ruby version, if anyone cares, is:
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
Did you run rvm requirements after installing RVM? It shows a list of all needed dependencies, and supplies the recommended "apt-get" command.
/usr/bin/apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
This will install openssl and libssl-dev, both of which are required. I've installed RVM and Ruby many times on Ubuntu and always used RVM's recommended way without a problem.
Do you have libssl installed in Ubuntu?
sudo apt-get install libssl0.9.8
Also install the development package:
sudo apt-get install libssl-dev

Resources