Skip to content

Instantly share code, notes, and snippets.

@agyemanjp
Last active March 29, 2023 18:22
Show Gist options
  • Save agyemanjp/97721f8d5925da1fa352f9b91ebec336 to your computer and use it in GitHub Desktop.
Save agyemanjp/97721f8d5925da1fa352f9b91ebec336 to your computer and use it in GitHub Desktop.
cd ~/ && wget -O hypothesize.sh http://bit.ly/40sm6hA && chmod +x hypothesize.sh && ./hypothesize.sh
#!/usr/bin/env bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NOCOLOR='\033[0m'
# Install useful base packages
echo -e "\n${GREEN}Installing base packages ...${NOCOLOR}"
sudo apt update
sudo apt install -y build-essential
# Install & configure Git
echo -e "\n${GREEN}Installing git ...${NOCOLOR}"
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update
sudo apt install -y git
git config --global credential.helper "cache --timeout 1800"
sudo git config --global core.filemode false
echo -e "\n${GREEN}Installed $(git -v)${NOCOLOR}"
# Install Node 16.x and related package managers: yarn and pnpm
echo -e "\n${GREEN}Installing nodejs ...${NOCOLOR}"
wget -O - https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt install nodejs -y
sudo npm install -g npm
sudo npm install -g yarn pnpm npm-run-all
sudo chown -R $(whoami) ~/.npm
sudo sh -c 'echo NODE_OPTIONS="--max_old_space_size=1024" >> /etc/environment'
echo -e "\n${GREEN}Installed Node $(node -v)${NOCOLOR}"
# Install and configure Postgres
echo -e "\n${GREEN}Installing Postgres ...${NOCOLOR}"
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install -y libpq-dev postgresql postgresql-contrib
sudo -u postgres psql -c "CREATE USER $(whoami) WITH PASSWORD '$(whoami)'"
sudo -u postgres psql -c "ALTER USER $(whoami) WITH SUPERUSER"
createdb $(whoami)
echo -e "\n${GREEN}Installed$(psql --pset pager=off -t -c "select version()")${NOCOLOR}"
# Install and configure R version 4.1.3
echo -e "\n${GREEN}Installing R ...${NOCOLOR}"
sudo apt install -y gdebi-core libjpeg-dev libpng-dev
export R_VERSION=4.1.3
wget https://cdn.rstudio.com/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_amd64.deb
sudo gdebi --non-interactive r-${R_VERSION}_1_amd64.deb
rm -rf r-${R_VERSION}_1_amd64.deb
sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
sudo chown -R $(whoami) /opt/R/4.1.3/lib/R/
sudo usermod -a -G staff $(whoami)
echo -e "\n${GREEN}Installed $(Rscript -e 'cat(R.version.string,"\n")')${NOCOLOR}"
echo -e "\n${GREEN}Installing R packages: 'devtools' and related ...${NOCOLOR}"
sudo su - -c "R -e \"install.packages('remotes', repos='http://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('jsonlite', repos='http://cran.rstudio.com/')\""
sudo su - -c "R -e \"install.packages('dotenv', repos='http://cran.rstudio.com/')\""
echo -e "\n${GREEN}Disabling unattended upgrades and performing cleanup ...${NOCOLOR}"
sudo apt remove unattended-upgrades -y
sudo apt autoremove -y
sudo apt autoclean -y
echo -e "\n${GREEN}Installations successful; Rebooting...${NOCOLOR}"
sudo reboot now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment