码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu 16.04在搭建Redis Cluster搭建时,使用gem install redis时出现:ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /var/lib/gems/2.3.0 directory.

时间:2017-10-05 16:49:03      阅读:2781      评论:0      收藏:0      [点我收藏+]

标签:adl   ssi   mini   blog   file   env   ons   ml2   github   

注意:千万不要使用sudo来执行gem install redis。

解决方法:

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 libffi-dev

cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo ‘export PATH="$HOME/.rbenv/bin:$PATH"‘ >> ~/.bashrc
echo ‘eval "$(rbenv init -)"‘ >> ~/.bashrc
exec $SHELL

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo ‘export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"‘ >> ~/.bashrc
exec $SHELL

rbenv install 2.3.1
rbenv global 2.3.1
ruby -v

最后安装

gem install redis
rbenv rehash

如果不想使用上面的方法,可以使用以下的投机取巧的方法,给上面错误的文件夹增加权限

sudo chmod 777 /var/lib/gems/2.3.0/
sudo chown -R administrator /var/lib/gems

说明:administrator为当前登录的用户,根据实际情况更改。

然后再次执行

gem install redis

 

 

 

 

参考:

https://gepolv.github.io/ubuntu/ruby/bundler/2016/06/21/gem-install-bundle-issue-on-ubuntu.html

Ubuntu 16.04在搭建Redis Cluster搭建时,使用gem install redis时出现:ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /var/lib/gems/2.3.0 directory.

标签:adl   ssi   mini   blog   file   env   ons   ml2   github   

原文地址:http://www.cnblogs.com/EasonJim/p/7629314.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!