我打算为ruby脚本创建安装程序,但是我希望能够确保计算机已安装RVM。有没有一种方法可以完全脱机且不干扰地安装RVM(通过不干扰,如在创建可以执行所有操作的脚本中一样,而不是要求用户向其bash_profile或bashrc中添加某些内容)
我不是在问脚本本身,而是关于如何走这条路线的快速指针(如果可能的话)。我们还研究了这个问题,它很有帮助:
但是有点误导,因为答案只向我们展示了如何在RVM中离线安装红宝石。我们需要能够脱机安装RVM本身,并查看脚本
https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer
我是否要包括整个脚本并将rvm_releases_url更改为其他内容?将rvm路径附加到用户的bash_profile或bashrc而不是要求他们这样做是安全的吗?
根据编辑此评论的建议。:-)
- Download the rvm tarball:
curl -sSL https://github.com/rvm/rvm/tarball/stable -o rvm-stable.tar.gz
- Create and enter rvm directory:
mkdir rvm && cd rvm
- Unpack the tar file :
tar --strip-components=1 -xzf ../rvm-stable.tar.gz
- Install rvm:
./install --auto-dotfiles
use --help to get the options
- Load rvm:
source ~/.rvm/scripts/rvm
Run Code Online (Sandbox Code Playgroud)
- Download ruby
o Find tar.bz2 version at:
https://ftp.ruby-lang.org/pub/ruby/ (check sub-directories)
o Download with curl: :
curl -sSL https://ftp.ruby-lang.org/pub/ruby/ruby-2.2.0.tar.bz2 -o ruby-2.2.0.tar.bz2
o Make sure you are downloading with the extension " .tar.bz2 "
- Download rubygems
o Find version at:
https://github.com/rubygems/rubygems/tags
o Download with curl:
curl -sSL http://production.cf.rubygems.org/rubygems/rubygems-2.4.6.tgz -o rubygems-2.4.6.tgz
Run Code Online (Sandbox Code Playgroud)
- Disable automatic dependencies ("requirements") fetching using the following command.
rvm autolibs read-fail
- Manually download and install dependencies
o Get the list of dependencies using
rvm requirements
Run Code Online (Sandbox Code Playgroud)
Clean default gems:
echo "" > ~/.rvm/gemsets/default.gems
Clean global gems:
echo "" > ~/.rvm/gemsets/global.gems
Install Ruby:
rvm install 2.2.0 --rubygems 2.4.6 (this may require sudo password for autolibs)
Install any other Ruby versions you want similarly
Set default Ruby version: rvm use 2.2.0 --default
Run Code Online (Sandbox Code Playgroud)
注意:ruby 和其他包应放置在“ $rvm_path/archives/ ”目录中。
There are multiple ways to install gems, we can download the gem files,
but the best way seems to be Bundler: http://bundler.io/bundle_package.html
Run Code Online (Sandbox Code Playgroud)
Offline
--------
Create a directory:
mkdir gems; cd gems
Unpack gems:
tar xzf gems.tgz
Install bundler:
gem install bundler-1.8.3.gem
[ This needs internet, to avoid internet connection you need to install bundler gem using --local option with the bundler.x.x.gem file ]
Install gems:
bundle install --local
Run Code Online (Sandbox Code Playgroud)
rvm implode --force
Then remove rvm from following locations:
rm -rf /usr/local/rvm
sudo rm /etc/profile.d/rvm.sh
sudo rm /etc/rvmrc
sudo rm ~/.rvmrc
Check the following files and remove or comment out references to rvm
~/.bashrc
~/.bash_profile
~/.profile
~/.zshrc
~/.zlogin
Comment-out / Remove the following lines from /etc/profile
source /etc/profile.d/sm.sh
source /etc/profile.d/rvm.sh
/etc/profile is a readonly file so use
sudo vim /etc/profile
Run Code Online (Sandbox Code Playgroud)
您也可以在这里找到安装方法...
参考:https ://github.com/rvm/rvm-site/blob/master/content/rvm/offline.md
| 归档时间: |
|
| 查看次数: |
3738 次 |
| 最近记录: |