-
-
Save flaugabriel/564afd3d17a8d2ae8ccfaf277191f644 to your computer and use it in GitHub Desktop.
Install rbenv, ruby and rails (executar como root)
This file contains hidden or 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 install -l | |
# Excluindo versoes antigas | |
rbenv uninstall <versao> | |
rbenv install -v "$RUBY_VERSION" | |
rbenv global "$RUBY_VERSION" | |
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=2.6.5 | |
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 http://github.com/sstephenson/rbenv.git rbenv | |
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