I've Base64 Encoded this Userdata script to be ran on initialization of a EC2 instance, but for some reason, it doesn't install RVM. I think it's do to a user issue, but i'm not sure.
I'm using the 12.10 default Ubuntu AMI.
#!/bin/bash
export LC_ALL=en_US.UTF-8
sudo apt-get --yes update
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
sudo apt-get --yes --fix-missing install mongodb language-pack-en ruby-full build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config tcptrack
\curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
source ~/.profile
rvm autolibs 3
rvm requirements
#source ~/.profile
rvm install 2.0.0-p0
rvm --default use 2.0.0
gem update --system
gem i mechanize peach mongo rails aws-sdk bson_ext httparty
Related
My machine has simply capped at ruby version 2.5, ruby -v outputs ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]. I have tried sudo apt update && sudo apt upgrade, and sudo apt-get install ruby-full, but non of which have seemed to work.
from: https://phoenixnap.com/kb/how-to-install-ruby-on-ubuntu-18-04
there are other ways, just visit the link to watch some of them
Example 2: By using rbenv
sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev
sudo apt install rbenv
echo 'export PATH="$HOME/ .rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init –)"' >> ~/.bashrc
rbenv install --list
and from the list select the one you want and install it
ex:
rbenv install rbx-2.7
I'm switching my ruby version using RVM
rvm install 2.6.3
I get this error:
Installing required packages: libssl-dev...
Error running 'requirements_debian_libs_install libssl-dev',
please read /home/bondka/.rvm/log/1562836140_ruby-2.6.3/package_install_libssl-dev.log
Requirements installation failed with status: 100.
If you are using Ubuntu update your package repository (optional- ignore if already did).
sudo apt-get update
then run
sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
I hope that helpful.
I'm making a shell script to install Apache, MySQL, Postgresql, php5, rvm, ruby and rails, kind like a auto install script, but i have problems with the rvm source and all that, this is what i have so far:
autoinstall autoconf automake bison build-essential curl git-core libapr1 libaprutil1 libc6-dev libltdl-dev libreadline6 libreadline6-dev libsqlite3-0 libsqlite3-dev libssl-dev libtool libxml2-dev libxslt-dev libxslt1-dev libyaml-dev ncurses-dev nodejs openssl sqlite3 zlib1g zlib1g-dev
autoinstall 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
autoinstall libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --ruby
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
fi
type rvm | head -1
rvm -v
This script get to type rvm | head -1 and say that rvm: not found, i suspect it's the weird case of having to close all bash terminals and reopening because the if also got to the printf "ERROR: An RVM installation was not found.\n" but when my script exit i do again the type rvm | head -1 and it show that is installed correctlly.
Any ideas why this happens inside my shell script?
[Edit]:
I made sure that it runs up until source line, the one not working seems to be the source for the rvm script to be able to use rvm inside the shell script, when i check rvm version inside got an error, but in terminal it gives me a version, why?
The file you are trying to source explicitly does not run in sh (and other shells) presumably because they are missing features it depends on.
Using sudo bash to run it instead should fix that problem.
I dont know how to install the latest Ruby on Ubuntu.
First I installed the default Ruby 1.9.3, using
sudo apt-get install ruby
Then I tried to install the 2.0 version using
sudo apt-get install ruby2.0
My version of Ruby is still "ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux])"
What should I do?
There is a PPA with up-to-date versions of Ruby 2.x for Ubuntu 12.04+:
$ sudo apt-add-repository ppa:brightbox/ruby-ng
$ sudo apt-get update
$ sudo apt-get install ruby2.4
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux-gnu]
First of all, install the prerequisite libraries:
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
Then install rbenv, which is used to install Ruby:
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
Then (optional) tell Rubygems to not install local documentation:
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
Credits: https://gorails.com/setup/ubuntu/14.10
Warning!!!
There are issues with Gnome-Shell. See comment below.
Best is to install it using rvm(ruby version manager).
Run following commands in a terminal:
sudo apt-get update
sudo apt-get install build-essential make curl
\curl -L https://get.rvm.io | bash -s stable
source ~/.bash_profile
rvm install ruby-2.1.4
Then check ruby versions installed and in use:
rvm list
rvm use --default ruby-2.1.4
Also you can directly add ruby bin path to PATH variable. Ruby is installed in
$HOME/.rvm/rubies export PATH=$PATH:$HOME/.rvm/rubies/ruby-2.1.4/bin
Use RVM (Ruby Version Manager) to install and manage any versions of Ruby. You can have multiple versions of Ruby installed on the machine and you can easily select the one you want.
To install RVM type into terminal:
\curl -sSL https://get.rvm.io | bash -s stable
And let it work. After that you will have RVM along with Ruby installed.
Source: RVM Site
update ubuntu:
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
Install rvm, which manages the ruby versions:
to install rvm use the following command.
\curl -sSL https://get.rvm.io | bash -s stable
source ~/.bash_profile
rvm install ruby-2.1.4
Check ruby versions installed and in use:
rvm list
rvm use --default ruby-2.1.4
I am configuring a new server for multiple rails 2.x/3.x projects, with multiple ruby versions 1.8.7/1.9.2 using RVM.
I want to know how to set a project to use particular version of ruby and another project to use another version of ruby?
Thanks,
Pravin
Assuming your project directories are:
/var/www/project1
/var/www/project2
Let's move to the multiple rails version management:
Run the below commands:
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
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 1.8.7
rvm use 1.8.7 --default
ruby -v
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem install rails
rails -v
Now change directory to:
$: var/www/project1 rails s
Move to second project:
$: var/www/project2
rvm install 1.9.1
rvm use 1.9.1 --default
gem install rails
and finally start rails:
$: var/www/project2 rails s -p 3003