安装ruby&gem

#安装yaml
#-------------------------------------------------------

cd /opt

tar zxf yaml-0.1.7.tar.gz

./configure --prefix=/usr/local

make

make install

 

#安装openssl
#------------------------------------------------------

tar zxf openssl-1.0.2i.tar.gz

cd openssl-1.0.2i

./config --prefix=/usr/local/openssl --shared

make

make install

cd /usr/local/

ln -s openssl ssl

cd /etc/

vi ld.so.conf 
#在include ld.so.conf.d/*.conf代码下面增加以下代码 
/usr/local/openssl/lib

vi profile 
#在文件最下面增加,以下代码 
export PATH=/usr/local/openssl/bin:$PATH

ldconfig

 

安装ruby
#------------------------------------------------------

cd /opt/

tar zxf ruby-2.1.10.tar.gz

cd ruby-2.1.10

./configure --prefix=/usr/local/ruby --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib

make && make install

echo "/usr/local/lib" >> /etc/ld.so.conf

vi /etc/profile 
#在文件最下面增加下段代码 
export PATH=/usr/local/ruby/bin:$PATH

source /etc/profile

 

#配置ruby的openssl扩展
#------------------------------------------------------

cd /opt/ruby-2.1.10/ext/openssl/

ruby extconf.rb --with-openssl-include=/usr/local/openssl/include/ --with-openssl-lib=/usr/local/openssl/lib

vi Makefile
找到原来的,替换成 ossl.o: ../../thread_native.h ../../thread_$(THREAD_MODEL).h
make && make install

ldconfig

#更新Gem
#------------------------------------------------------
#检查当前gem版本

gem -v

gem update --system

gem -v

 
//淘宝镜像已无人维护,换成新的镜像
gem sources -a http://gems.ruby-china.org/
 
gem install rails -v=4.1.6
 
 
如果使用rvm安装ruby2.4.0
请按照下面步骤进行:
下载 rvm 依赖
# rvm  requirements

rvmsudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
yum install *gdbm*

vi /etc/rvmrc
rvm_configure_flags="--with-openssl-dir=/usr/local/ssl"
保存退出
rvm reload

步骤2:安装ruby
同样可以用yum install ruby和yum install –y ruby-rdoc 或者源码安装。此处我们用yum方式。
或者
rvm install ruby-2.4.0
rvm docs generate-ri

 
gem install pkg-config -v "~> 1.1.7"
gem install libxml-ruby

python必要工具
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
xz -d Python-3.6.0.tar.xz
tar -xvf Python-3.6.0.tar
cd Python-3.6.0
./configure --prefix=/usr/local --enable-shared
make && make install
6、设置别名方便使用
alias py=python3

ln -sf /usr/local/lib/libz.so.1.2.8 /usr/lib64/libz.so

wget ftp://xmlsoft.org/libxml2/libxml2-2.9.4.tar.gz
tar zxvf libxml2-2.9.4.tar.gz
cd libxml2-2.9.4
./configure --prefix=/usr/local/libxml2 --with-zlib=/usr/local/zlib/ --with-python=/usr/lib/python2.6
make && make install

gem install nokogiri -- --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib --with-xslt-dir=/usr/

gem install rails

 
rails -v
5.0.1
 
 
 
上一篇:window对象与document对象的区别


下一篇:Amazon新一代云端关系数据库Aurora