I recently created a Linode server with Ubuntu 12.04 LTS
as the admin user aurelien I installed rbenv (in my case 1.9.3-p194 for my older rails 3.2 app).
Afterwhich I ran gem install passenger and was placed in the directory ~/.rbenv/shims
After that I ran rbenv rehash
and to install nginx:
I couldn't run passenger-install-nginx-module because it asked to use with sudo. When I tried sudo passenger-install-nginx-module it told me command not found.
Then I found this post PhilT's answer
and tried running sudo bash -c "source ~/.bashrc && passenger-install-nginx-module"
/home/aurelien/.rbenv/shims/passenger-install-nginx-module
I went through the entire passenger/nginx installation and pressed "enter" when it asked for the prefix directory.
in my root directory cd ~/home/aurelien and I can't find /opt/nginx.
Did it correctly create these directories?
The only directories/files I have on the root are these:
. .. apps .bash_history .bash_logout .bashrc .cache .gem .gitconfig .profile .rbenv .ssh .viminfo
EDIT: My .bashrc file
export RBENV_ROOT="${HOME}/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then
export PATH="${RBENV_ROOT}/bin:${PATH}"
eval "$(rbenv init -)"
fi
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
The answer posted before by PhilT had the correct code for installing nginx together with passenger:
gem install passenger
rbenv rehash
sudo bash -c "source ~/.bashrc && passenger-install-nginx-module"
The fault in your explanation above is that /opt/nginx is not in user's home directory (~/home/aurelien/opt/nginx), but in the root directory (plainly /opt/nginx.), as nginx is a system-wide install.
(Note: In some other systems nginx also has config files placed in /etc/nginx instead)
Related
Question:
How can I install ruby, in such a way, that it's visible to all users on my ubuntu 14.04 server
ugh I'm trying to make ruby -v visible for all users and I failed.
Question 2:
Can I just change permissions? if so, how? if not, how would I uninstall the other installation?
I have 2 main users:
ubuntu (default) and jenkins(secondary)
I followed this set up for rbenv from this Tut:
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL
rbenv install 2.1.5
rbenv global 2.1.5
ruby -v
But I did it under the default user
+whoami
ubuntu
+ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]
if i switch users:
+sudo su - jenkins
+whoami
jenkins
+ruby -v
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8
Ask your administrator to install one of them
I'm a super noob when it comes to permissions, so I hope you can hold my hand
In the end I'm trying to get Jenkins to see ruby for a build.
My Jenkins Job is failing because it cant find sass because it can't find ruby :c
4mRunning "test:client" (test) task[24m
[4mRunning "clean:server" (clean) task[24m
[4mRunning "env:all" (env) task[24m
[4mRunning "injector:sass" (injector) task[24m
[90mMissing option `template`, using `dest` as template instead[39m
Injecting [32mscss[39m files [90m(3 files)[39m
[32m>> [39mNothing changed
[4mRunning "concurrent:test" (concurrent) task[24m
[33mWarning: [4mRunning "sass:server" (sass) task[24m
[33mWarning:
You need to have Ruby and Sass installed and in your PATH for this task to work.
More info: https://github.com/gruntjs/grunt-contrib-sass
Use --force to continue.[39m
UPDATE:
So I reinstalled rbenv under sudo su - jenkins and everything works but is there a way to still install rbenv as a global user or is this not how rbenv is suppose to work??
UPDATE * 2:
My first update didnt work. heres how I did it this time.
sudo su -
sudo apt-get install ruby-full
gem install ...
You're on the right track with your update * 2.
If you want to install something for all users, use
apt-get install
rbenv is mainly useful if you have to switch between different ruby environments (e.g., you develop multiple apps each need their own, possibly conflicting, set of dependencies installed)
So to answer "Q1 How can I install ruby, in such a way, that it's visible to all users on my ubuntu 14.04 server"
as a privileged user (root or possibly ubuntu) run
apt-get install ruby-full
Questions 2-4: Can I just change permissions? if so, how? if not, how would I uninstall the other installation?
Can I just change permissions?
This is not just a permissions problem; it's a PATH and permissions problem. As the jenkins user you can do
export PATH="~ubuntu/.rbenv/plugins/ruby-build/bin:$PATH"
to add the ubuntu user's .rbenv to your path. But you probably would be better off setting up rbenv for the jenkins user. The jenkins user might not have permissions to read, chdir, and execute the ubuntu user's home directory and its .rbenv subdirectory
How (can I change permissions)
You can change permissions with chmod. But changing permissions can easily screw up your system. As with wood or paper, it's better to find a way to work with the grain of the system (not having to change permissions) rather than against the grain of the system.
How would I uninstall the other installation
sudo rm -rf ~ubuntu/.rbenv
You may want to check out a good guide to system administration if you don't have one. I learned, years ago, from an earlier edition of this book: < http://www.amazon.ca/Essential-System-Administration-Tools-Techniques/dp/0596003439 >
I got this error on using RVM
kithokit#14:22:59 ~ $ rvm install 1.9.3
mkdir: cannot create directory ‘/usr/local/rvm/log/ruby-1.9.3-p448’: Permission denied
Could not detect ruby version/name for installation, please be more specific.
How can i change the default directory to /home/kithokit/.rvm
You can remove all the trace by executing this script
#!/bin/bash
/usr/bin/sudo rm -rf $HOME/.rvm $HOME/.rvmrc /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm /usr/local/bin/rvm
/usr/bin/sudo /usr/sbin/groupdel rvm
/bin/echo "RVM is removed. Please check all .bashrc|.bash_profile|.profile|.zshrc for RVM source lines and delete
or comment out if this was a Per-User installation."
coming from https://rvm.io/support/troubleshooting#sudo
make sure to restart machine to get rid of any environment variables that would point out to the old location (yes it is required in case of playing with system installation).
I am writing a bash script in mac OSX. now i want to set up librarian-chef,
echo "installing the librarian-chef gem"
gem install librarian-chef
echo "librarian-chef installing cookbooks from the recipies"
librarian-chef install
and then run it. so that the rest of the bash script can complete but i keep getting this line 31: librarian-chef: command not found
so i figured the gem installed fine but the path wasn't refreshed so it couldn't be used? so i tried
echo "librarian-chef installing cookbooks from the recipies"
source ~/.bash_profile
librarian-chef install
so that it would refresh it but that didnt work?
./vagrant_prepare.sh: line 30: ~/.bash_profile: No such file or directory
how can i install it and then use it anyone seen this?
i do have bash profile btw
ls -a
. .bash_history .dropbox .rbenv .viminfo Dumps Pictures temp
.. .bash_profile .gem .redis Desktop Library Public test.sh
.CFUserTextEncoding .bundler .gitconfig .ruby-version Documents Movies VirtualBox VMs
.DS_Store .cache .local .ssh Downloads Music Work
.Trash .config .pow .vagrant.d Dropbox Nexus chronosphere.sh
Add this in your ~/.bash_profile:
eval "$(rbenv init -)"
Reopen terminal and run script again.
#!/bin/bash
echo "installing the librarian-chef gem"
gem install librarian-chef
echo "librarian-chef installing cookbooks from the recipies"
librarian-chef install
Question is very simple:
I cannot install RVM (single-user installation), as if I follow the instructions on the RVM website, that is:
$ curl -L https://get.rvm.io | bash -s stable
I get a permission denied error at line 360 of the installation script file (the line that starts with echo):
# Perform the actual installation, first we obtain the source using whichever
# means was specified, if any. Defaults to head.
case "${version}" in
(head)
echo "${branch}" > "$rvm_path/RELEASE"
install_head ${branch:-master} || exit $?
;;
Here is the error message:
olivier#~$ curl -L https://get.rvm.io | bash -s stable
bash: line 360: /usr/local/rvm/RELEASE: Permission denied
If I add "sudo" before "bash" in the command above, it works fine, but it is then the multi-user install ...
Indeed, I solved this by uninstalling old versions of RVM: sudo rvm implode and then deleting the file /etc/rvmrc. Once done, I could install the single-user version and everything worked fine!
Sorry Remear, I wanted to edit your answer or complete it via my comment but I could not (comment can only be edited within 5 minutes...at least I upvoted...).
Once you have a system-wide install, you can't run a single-user install as it will detect your system-wide install first and try to update it.
But it is possible to have a root install & then user install by specifying the installation path :
curl -sSL https://get.rvm.io | bash -s stable --path $HOME/.rvm
You will also have to set the single-user install path in your user path manually as RVM does not create it when you already have a system-wide install (not really an intended use) :
# .bashrc
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
And also load your user rvm :
# .bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Are you setting rvm_path in ~/.rvmrc, or in /etc/rvmrc, or in one of your bash scripts? I'd recommend removing both of those files as well as ~/.rvm and then try installing rvm again WITHOUT sudo.
this work for me, first uninstall all versions and then as user (NO root) follow the next commands:
For example, I'm using Ruby 2.6.3 and Rails 5.2.2 and setting up helping a little in these web pages:
https://gorails.com/setup/ubuntu/20.04
https://rvm.io/rvm/install
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
$ curl -sSL https://get.rvm.io | bash -s stable --ignore-dotfiles
$ source ~/.rvm/scripts/rvm
$ rvm install 2.6.3
$ rvm use 2.6.3 --default
$ ruby -v
$ gem install rails -v 5.2.2
$ rails -v
Check the paths:
$ which -a gem
$ which -a ruby
Now you can Add some gems (inside you app directory):
$ gem install faker
All works great for me, hope this helps!
I installed rbenv according to the instructions at https://github.com/sstephenson/rbenv#section_2
Restarting my shell at point 4 will result in an error
$ rbenv init -
rbenv: no such command `init'
Trying to run the command directly from its folder doesn't work either.
$ cd .rbenv/bin
$ ./rbenv init -
rbenv: no such command `init'
My $PATH
$ echo $PATH
/home/myusername/.rbenv/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/myusername/bin
Running rbenv install works until rbenv rehash is called
$ rbenv install 1.9.3-p0
Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /home/hbrandl/.rbenv/versions/1.9.3-p0
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz...
Installing ruby-1.9.3-p0...
Installed ruby-1.9.3-p0 to /home/hbrandl/.rbenv/versions/1.9.3-p0
rbenv: no such command `rehash'
All other rbenv commands don't seem to work.
Any help or pointers greatly appreciated.
Check if the symlink is correct:
> ls -l ~/.rbenv/bin/rbenv
lrwxr-xr-x 1 kelvin staff 16 Mar 29 11:19 /Users/kelvin/.rbenv/bin/rbenv# -> ../libexec/rbenv
Is your rbenv a symlink to ../libexec/rbenv ? It should be, because it reads that symlink location to know that "libexec" is the location of the other executables.
To fix:
> cd ~/.rbenv/bin
> mv rbenv rbenv.broken
> ln -s ../libexec/rbenv rbenv
It might've broken if you copied the ~/.rbenv from another location, which would probably mess the links up.
A working workaround for my problem was to simply add the libexec folder to my path as well.
My rbenv PATH additions now look as follows:
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/libexec:$PATH"
This fixes the problem for me.