Install RVM into the current user HOME directory

2019-08-28 12:28发布

问题:

Quote from site:

If the install script is run as a standard, non-root user, RVM will install into the current users's home directory.

Well:

demas@demas:/www/sites/in_use/dev/public_html$ su demas
Password: 
demas@demas:/www/sites/in_use/dev/public_html$ \curl -L https://get.rvm.io | bash -s
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0    174      0  0:00:01  0:00:01 --:--:--   229
100 13641  100 13641    0     0   8774      0  0:00:01  0:00:01 --:--:-- 13.0M
mkdir: cannot create directory вЂ/usr/local/rvm’: Permission denied

I have tryed to install RVM as a standard user. Why it didn't install into home directory ?

I use Ubuntu.

Updated:

demas@demas:/www/sites/in_use/dev/public_html$ whoami
demas
demas@demas:/www/sites/in_use/dev/public_html$ echo $HOME
/home/demas

Updated 2:

demas@demas:/www/sites/in_use/dev/public_html$ \curl -L https://get.rvm.io | bash -s -- --trace
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   184  100   184    0     0    165      0  0:00:01  0:00:01 --:--:--   225
100 13641  100 13641    0     0  11922      0  0:00:01  0:00:01 --:--:-- 11922
+  :   270 > rvm_trace_flag=1
+  :   275 > true 1 0 0 HOME=/home/demas
+  :   279 > ((  rvm_ignore_rvmrc == 0  ))
+  :   281 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
+  :   283 > [[ -s /etc/rvmrc ]]
+  :   281 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
+  :   283 > [[ -s /home/demas/.rvmrc ]]
+  :   300 > [[ -z /usr/local/rvm ]]
+  :   313 > [[ -z /usr/local ]]
+  :   321 > [[ -z '' ]]
+  :   324 > [[ /usr/local == \/\h\o\m\e\/\d\e\m\a\s ]]
+  :   328 > rvm_user_install_flag=0
+  :   332 > install_rubies=()
+  :   333 > install_gems=()
+  :   334 > flags=()
+  :   336 > ((  1 > 0  ))
+  :   338 > token=--trace
+  :   339 > shift
+  :   340 > case "$token" in
+  :   343 > set -o xtrace
+  :   344 > rvm_trace_flag=1
+  :   345 > flags+=("$token")
+  :   336 > ((  0 > 0  ))
+  :   473 > case "$rvm_path" in
+  :   500 > ((  0 > 0 && 0 == 0  ))
+  :   505 > ((  0 > 0  ))
+  :   512 > true head
+  :   514 > [[ /usr/local/rvm != /* ]]
+  :   519 > rvm_src_path=/usr/local/rvm/src
+  :   520 > rvm_archives_path=/usr/local/rvm/archives
+  :   521 > rvm_releases_url=https://rvm.io/releases
+  :   523 > for dir in '"$rvm_src_path"' '"$rvm_archives_path"'
+  :   525 > [[ ! -d /usr/local/rvm/src ]]
+  :   527 > mkdir -p /usr/local/rvm/src
mkdir: cannot create directory вЂ/usr/local/rvm’: Permission denied

回答1:

Use

su - demas

This will make a login shell and loads all the user environment variables.

Also make sure the your bash binary is actually Bash and not a link to another kind of shell (like dash on Ubuntu).



标签: ruby rvm