Skip to content

Instantly share code, notes, and snippets.

@rg3915
Last active June 1, 2020 23:33
Show Gist options
  • Save rg3915/452c41533a45eb88f7a1 to your computer and use it in GitHub Desktop.
Save rg3915/452c41533a45eb88f7a1 to your computer and use it in GitHub Desktop.
Install Programs on Linux
# V 6.1
# 2020-06-01
# Shell script para instalar programas no Ubuntu.
# Colors
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
reset=`tput sgr0`
echo "${green}Atualizando o sistema${reset}"
sudo apt update
clear
echo "${green}Instalando os pacotes essenciais${reset}"
sudo apt install -y make gcc build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev llvm gettext libncurses5-dev \
tk-dev tcl-dev blt-dev libgdbm-dev aria2
echo "${green}Instalando wget${reset}"
sudo apt install -y wget
echo "${green}Instalando curl${reset}"
sudo apt install -y curl
echo "${green}Instalando git${reset}"
sudo apt install -y git
echo "${green}Instalando vim${reset}"
sudo apt install -y vim
echo "${green}Instalando python-dev${reset}"
sudo apt install -y python-dev
echo "${green}Instalando python3-dev${reset}"
sudo apt install -y python3-dev
#Instalar Terminator
echo "${green}Instalando Terminator${reset}"
sudo apt install -y terminator
echo "${green}Configurando git global${reset}"
echo "Qual é o seu user.name?"
read git_config_user_name
git config --global user.name $git_config_user_name
echo "${green}Qual é o seu user.email?${reset}"
read git_config_user_email
git config --global user.email $git_config_user_email
# Generate ssh key
# https://help.github.com/articles/generating-ssh-keys/
ssh-keygen -t rsa -b 4096 -C $git_config_user_email
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
sudo apt install -y xclip
xclip -sel clip < ~/.ssh/id_rsa.pub
echo "${yellow}copy to github${reset}"
echo "${yellow}click in the settings icon,${reset}"
echo "${yellow}Add SSH Key${reset}"
# test
ssh -T [email protected]
# Instalando pyenv
echo "${green}Instalando pyenv${reset}"
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
# echo "Abra o ~/.bashrc e digite:"
# echo 'export PATH="$HOME/.pyenv/bin:$PATH"'
# echo 'eval "$(pyenv init -)"'
# echo 'eval "$(pyenv virtualenv-init -)"'
cat << EOF > /tmp/temp.txt
### Added by pyenv
export PATH="\$HOME/.pyenv/bin:\$PATH"
eval "\$(pyenv init -)"
eval "\$(pyenv virtualenv-init -)"
### Activate virtualenv
alias sa='source .venv/bin/activate; PS1="(\`basename \"\$VIRTUAL_ENV\"\`)\e[1;34m:/\W\e[00m$ "; clear'
### Short prompt
alias pa='PS1="(\`basename \"\$VIRTUAL_ENV\"\`)\e[1;34m:/\W\e[00m$ "; clear'
alias p='PS1="\e[1;34m/\W\e[00m$ "; clear'
alias rm="rm -i"
EOF
cat /tmp/temp.txt >> ~/.bashrc
source ~/.bashrc
echo '${yellow}Procure pela linha:${reset}'
echo '#force_color_prompt=yes e tire o símbolo #.'
echo "Done"
pyenv install -l | grep 3.8
pyenv install 3.8.3
pyenv install 3.7.4
pyenv versions
pyenv global 3.8.3
pyenv versions
python -V
# Instalando pipenv
echo "${green}Instalando pipenv${reset}"
sudo apt install -y pipenv
sudo pip install pipenv
cat << EOF
pyenv local 3.7.4 # para usar a versão específica do Python
pipenv shell # para ativar o ambiente
pipenv sync --dev # para instalar os pacotes
pip freeze # para conferir o que foi instalado
EOF
# Instalando gdal
echo "${green}Instalando gdal${reset}"
sudo apt install -y libgdal-dev gdal-bin
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pipenv shell # ativando pipenv
pipenv install gdal==2.4.0 # Falhou, testar novamente
# Instalando dbeaver
echo "${green}Instalando dbeaver${reset}"
wget https://dbeaver.io/files/dbeaver-ce_latest_amd64.deb
sudo dpkg -i dbeaver-ce_latest_amd64.deb # Falhou, testar novamente
# Instalando PostgreSQL
echo "${green}Instalando PostgreSQL${reset}"
sudo apt --fix-broken install
sudo apt install -y postgresql-client postgresql
echo "${yellow}Criando um banco rapidamente${reset}"
cat << EOF
createdb -U postgres mydb
# ou
sudo -u postgres -i createdb mydb
EOF
echo "${yellow}Leia mais em https://gist.github.com/rg3915/f63d9a37ca6bd5c0c7ecd4a907bd681f${reset}"
# diminuir path no prompt
PS1="(`basename \"$VIRTUAL_ENV\"`):/\W$ "
echo -n "Deseja instalar o gerador de modelos do Django pyparsing? (y/N) "
read answer
if [ "$answer" == "y" ]; then
# reinstalando pyparsing (Django)
pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz#md5=9be0fcdcc595199c646ab317c1d9a709
pip install pydot
sudo apt-get install graphviz
echo "pip freeze > requirements.txt"
# gerando modelo Django
echo "./manage.py graph_models -e -g -l dot -o core.png core"
fi
echo -n "Deseja instalar o Nautilus 3.4? (y/N) "
read answer
if [ "$answer" == "y" ]; then
# Como ter novamente as características do Nautilus 3.4
sudo add-apt-repository ppa:webupd8team/nemo
sudo apt update
sudo apt install -y nemo nemo-fileroller
#http://www.webupd8.org/2013/10/install-nemo-with-unity-patches-and.html
fi
echo "${green}Instalando Docker${reset}"
curl -fsSL https://get.docker.com/ | bash
echo "${green}Instalando docker-compose${reset}"
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
echo "${green}Adicionando usuário atual no grupo Docker.${reset}"
sudo groupadd docker
sudo gpasswd -a $USER docker
sudo setfacl -m user:$USER:rw /var/run/docker.sock
docker run hello-world
echo "${green}Instalando Sublime Text 3${reset}"
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt install -y apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update
sudo apt install -y sublime-text
## Install Package
echo "${yellow}Para instalar os pacotes leia${reset}"
echo "${yellow}https://gist.github.com/rg3915/400371a8795fb0bc030ddaaae2b213fa#file-package-control-sublime-settings${reset}"
echo -n "Deseja instalar o nvm e o Node? (y/N) "
read answer
if [ "$answer" == "y" ]; then
echo "${green}Instalando nvm e node${reset}"
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
cat << EOF > /tmp/nvm.txt
export NVM_DIR="\$HOME/.nvm"
[ -s "\$NVM_DIR/nvm.sh" ] && \. "\$NVM_DIR/nvm.sh" # This loads nvm
[ -s "\$NVM_DIR/bash_completion" ] && \. "\$NVM_DIR/bash_completion" # This loads nvm bash_completion
EOF
cat /tmp/nvm.txt >> ~/.bashrc
source ~/.bashrc
nvm --version
nvm install 12.16.3
nvm list
nvm use 12.16.3
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment