Skip to content

Instantly share code, notes, and snippets.

@asssis
Last active March 17, 2024 17:38
Show Gist options
  • Save asssis/a120a244f337c0bb3f7500fa9ae57be0 to your computer and use it in GitHub Desktop.
Save asssis/a120a244f337c0bb3f7500fa9ae57be0 to your computer and use it in GitHub Desktop.
instllar rails
#COPIE O SCRIPT COLA DENTRO DE install.sh
#JOGA PARA O DOCUMENTO SO
#chmod +777 install.sh
#./install.sh
# 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
NODE_VERSION=14
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 x
echo "instalado node $NODE_VERSION"
curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
apt-get update
apt install nodejs -y
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