-
-
Save asssis/71afa7eb66fc0b8de3d5657358c79610 to your computer and use it in GitHub Desktop.
Install rbenv, ruby and rails (executar como root)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ATUALIZAR RUBY | |
cd /usr/local/rbenv | |
git reset --hard | |
git pull origin master | |
cd ~/.rbenv/plugins/ruby-build | |
git reset --hard | |
git pull origin master | |
# - Listando versoes existentes | |
rbenv versions | |
rbenv install -l | |
# Excluindo versoes antigas | |
rbenv uninstall <versao> | |
rbenv install -v "$RUBY_VERSION" | |
rbenv global "$RUBY_VERSION" | |
gem list xxxx | |
gem install --default bundler | |
gem update --system | |
bundle update --bundler | |
gem install bundler | |
gem install rails | |
rbenv rehash | |
#INSTALAR | |
# RODAR COMO ROOT OU SUDO | |
if [[ $(id -u) -ne 0 ]] | |
then echo "Por favor executar como root" | |
exit 1 | |
fi | |
echo 'Instalando rbenv' | |
RUBY_VERSION=3.0.1 | |
USUARIO=$SUDO_USER | |
add-apt-repository main | |
add-apt-repository universe | |
add-apt-repository restricted | |
add-apt-repository multiverse | |
apt-get update | |
apt-get -y install curl unzip wget zsh git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev | |
# Install node 10.x | |
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - | |
apt-get install -y nodejs | |
apt-get autoremove -y | |
cd /usr/local | |
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build | |
chgrp -R staff rbenv | |
chmod -R g+rwxXs rbenv | |
echo 'export RBENV_ROOT=/usr/local/rbenv' >> /home/"$USUARIO"/.bashrc | |
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /home/"$USUARIO"/.bashrc | |
echo 'eval "$(rbenv init -)"' >> /home/"$USUARIO"/.bashrc | |
echo 'export RBENV_ROOT=/usr/local/rbenv' >> /home/"$USUARIO"/.zshrc | |
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /home/"$USUARIO"/.zshrc | |
echo 'eval "$(rbenv init -)"' >> /home/"$USUARIO"/.zshrc | |
echo 'export RBENV_ROOT=/usr/local/rbenv' >> /root/.bashrc | |
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /root/.bashrc | |
echo 'eval "$(rbenv init -)"' >> /root/.bashrc | |
export RBENV_ROOT=/usr/local/rbenv | |
export PATH="$RBENV_ROOT/bin:$PATH" | |
eval "$(rbenv init -)" | |
git clone https://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build | |
git clone https://github.com/sstephenson/ruby-build.git /home/"$USUARIO"/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> /root/.bash_profile | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> /home/"$USUARIO"/.bashrc | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> /home/"$USUARIO"/.zshrc | |
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH" | |
rbenv install -v "$RUBY_VERSION" | |
rbenv global "$RUBY_VERSION" | |
gem install bundler | |
gem install rails | |
rbenv rehash | |
chown -R "$USUARIO":"$USUARIO" /home/"$USUARIO"/.bashrc | |
chown -R "$USUARIO":"$USUARIO" /home/"$USUARIO"/.rbenv | |
chown -R "$USUARIO":root /usr/local/rbenv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment