Centos7.2安装ruby用于爬虫脚本

1,系统版本查看

  

2,安装依赖包

  yum -y install ruby-devel

     yum -y install mysql-devel

   yum -y install gcc-c++ gcc  rubygems

  yum -y install libxml2 libxslt libxml2-devel libxslt-devel 

3,编译安装ruby(如yum安装版本太低会安装不上mechanize)

  wget https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.gz

  tar -xf ruby-2.4.1.tar.gz

  cd ruby-2.4.1

  ./configure  

  make && make install

4,安装mysql2和mechanize

  gem install mechanize

  gem install mysql2

  PS:如果安装mechanize报错需要执行一下命令gem install nokogiri -- --use-system-libraries

posted @ 2017-06-05 16:21  minseo  阅读(245)  评论(0编辑  收藏  举报