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 >
Related
So I tried to do this tutorial https://programminghistorian.org/en/lessons/building-static-sites-with-jekyll-github-pages#on-a-mac-, but got stuck in the ruby section. Here's what happened and what I have tried:
When trying the tutorial I ran into my first "permission" error trying to use this command line
gem install rubygems-update
So I went ahead to the Jekyll website, read the documentation and figured out that I needed to work around that permission error that my guess is that it is generated becase Macs already have a ruby version that they need to run, and also that even if I install a new ruby version I can't change the one my Mac is running.
I tried everything here on the documentation. Even the rbenv path to install ruby and then when trying to see what version I was running with ruby -v, I got the same thing "2.6.3p62".
Then I found this blog post, and again tried to install it that way and again with homebrew. The only thing I modified from there is:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
to this
echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.1/bin:$PATH"' >> ~/.zshrc
Because after running echo $SHELL it seems my shell is zsh.
However, when I restarted my console and typed ruby -v the terminal displayed the same old version "2.6.3p62". Also I saw here that I can run which ruby after I installed it and run the echo command to see if it is requiring it from the new defined path but no. It's still inside /usr/bin/ruby
I have run out of options and asking for some help. Thank you.
A possible script for the terminal of an M1 chip MacOS to setup a Ruby (any desired version) environment is:
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
git config --global color.ui true
git config --global user.name "your name here"
git config --global user.email your_email_here
Then download VS Code in Chrome and go back to your terminal to enter the following commands.
brew install rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
Next up is where you insert your desired version. This time I suggest 2.7.3
rbenv install 2.7.3
rbenv global 2.7.3
rbenv rehash
gem install bundler pry byebug
gem install pry
gem install pry-doc
my question is straight, Please give me answers with some details of the tools that I use. I have done some research and I am not getting a straight solution.
I am trying to run a rails application that is using rails version 4.0.4 and ruby version 2.1.1. How can I set up the environment in my windows laptop?
Maybe you should create an Ubuntu Virtual Machine using Vagrant to run your rails app.
First of all, download VirtualBox and Vagrant.
Then change to a directory where you’ll build your project C:\projects\starting_rails for example and from that directory run:
$ vagrant init hashicorp/precise32
$ vagrant up
$ vagrant ssh
Those commands will create an Ubuntu virtual machine, set it up and then you will be able to login through ssh.
Inside the vm, you'll need to config everthing in order to run you rails app.
Install the PostgreSQL
# set that default locale before install postgres
$ sudo /usr/sbin/update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
$ sudo apt-get install postgresql libpq-dev
Once installed, create the database instance. Within the SSH session
$ sudo mkdir -p /usr/local/pgsql/data
$ sudo chown postgres:postgres /usr/local/pgsql/data
$ sudo su postgres
$ /usr/lib/postgresql/9.1/bin/initdb -D /usr/local/pgsql/data
$ createuser vagrant
Respond "Y" to Shall the new role be a superuser? Then you can 'exit' the su subshell.
Add privilege for vagrant to create db.
$ psql postgres psql
$ ALTER ROLE vagrant CREATEDB;
# exit with \q
$ \q
Then it is time to install RVM a ruby version manager.
$ sudo apt-get install curl
$ \curl -sSL https://get.rvm.io | bash
# installs all the various compilers and packages you’ll need to build Ruby and common libraries
$ rvm requirements
# installs ruby
$ rvm install 2.1.1
# creates a gemset rails
$ rvm gemset create rails404
$ rvm 2.1.1#rails404
# installs the rails
$ gem install rails -v 4.0.4
# sets 2.1.1 as default ruby version
$ rvm use 2.1.1 --default
After that, install bundler.
$ gem install bundler
And last but not least install nodejs.
$ sudo apt-get install nodejs
Vagrant shares the content of your desktop folder with your vm, so you can use your desktop favorite editor, your desktop git tool and test it on your desktop browser (but you need to configure port forwarding first).
You can find more details in this tutorial.
I hope it helps.
I'm trying to install ruby on Red Hat, via an ssh-connection, but it won't work.
I can't use yum install ruby, because I don't have the needed repositories.
I have three options for you:
1) You can install it from sources.
First of all you'll need to install some build tools and libraries.
On Centos/RedHat the easiest way to do it is using yum groupinstall 'Development Tools'.
If this doesn't work you'll need to run at least: yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel the bare minimum to build. Eventually is you have no internet access and just ssh you can SCP the single packages from your machine.
Once installed build tools , if you have internet access on those machines, I suggest also to install RVM to make less painful upgrade and not have to mess around with path definition for the new libraries and binaries.
To install it is quite simple curl -L get.rvm.io | bash -s stable will do the trick and after a rvm install <version> will permit you to install (for this user) any ruby version you want and create gemset without touch the system.
Be aware that installing new gems that need to be build will require to install other devel libraries if they have compiled extensions.
Have also a look to http://rvm.io/rubies/installing for more references about rvm use
Otherwise you can use #hizbul25 tutorial to install std ruby from source.
2) You can use omnibus, https://github.com/opscode/omnibus-ruby, is the package useb by Opscode, Mcollective and other tools to create a selfcontaines VirtualEnvironment for specific application.
You can select the gem and the ruby version you need and it will create a tgz with all you need to run ruby scripts.
This tgz can be uncompressed where you want (ex: /opt/omnibusruby/) and you'll need just to point the shebangs of your scripts to #!/opt/omnybusruby/embedded/ruby-2/bin/ruby or create a an alias /usr/bin/ruby -> /opt/omnybusruby/embedded/ruby-2/bin/ruby.
If you have no internet access at all from the server is probably the best way to prepare the package on your laptop/system and deploy it on the remote.
I recently installed Rails for the CodeReady Containers implementation of OpenShift in RHEL8/Cento8, using an OpenShift quickstart template. And in fact using rbenv now seems the cleanest way to install ruby:
sudo yum groupinstall "Development Tools"
sudo yum install readline-devel openssl-devel
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 -l
rbenv install 2.7.5
rbenv global 2.7.5
ruby -v
I am attempting to install RVM on Xubuntu and am having no luck getting the OS/terminal to recognize rvm as something that it can call.
I have been following the instructions here: http://beginrescueend.com/rvm/install/
I first call:
sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
This seems to be executing correctly. I then run:
sudo echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
The text is appended to the end of the file.
Next I close out the terminal completely and reopen it. I try running:
type rvm | head -1
It responds:
bash: type: rvm: not found
If I try just calling rvm it responds:
The program 'rvm' is currently not installed. You can install it by typing: sudo apt-get install ruby-rvm
Clearly I am doing something wrong, I cannot seem to determine what that is. Thank you.
By using the sudo version of the install script, you have installed the multi user version of rvm, and then you ran the single user "sourcing" script with sudo...
When using the multi user version, rvm will not install into $HOME/.rvm, but in /usr/local/rvm.
Therefore you will have to use the multi user way to source the rvm script, and that is to add your user to the rvm group.
As shine already posted though, you probably didn't want to install system wide rvm to start with.
Don't do it with sudo. You have installed it for a root and you're not a root.
RVM should be installed in your home folder, you don't need superuser privileges for that.
Following this advice for installing RVM 1.5.2, I used these commands to install RVM 1.5.2 system wide (into /usr/local/rvm):
curl http://rvm.beginrescueend.com/releases/rvm-install-head > rvm-install-head
sudo bash rvm-install-head
That, in itself, worked. I added the appropriate source statements in my .bashrc file:
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"
and proceeded to attempt to install Ruby 1.9.2 with this command:
sudo rvm install 1.9.2-head
However, I get "rvm: command not found". If I try it without sudo, I don't have appropriate permissions to create the necessary directories and so forth, as would be expected. The problem seems to be that the shell function rvm is defined for my user, but when running sudo, it doesn't seem to be available.
My question: What is the correct way to install rubies in a system wide RVM 1.5.2 install?
I'm running Ubuntu 10.04.
If you have existing provisioning scripts that depend on the old system-wide install script, then staying at RVM version 1.3.0 is another option to consider.
(See RVM system-wide install script url broken -- what is replacement?)
It appears that the install scripts have been updated to correct this, so it doesn't appear to be an issue anymore.