Skip to content

Instantly share code, notes, and snippets.

@FabienDehopre
Last active September 29, 2020 03:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FabienDehopre/ac8560bf3b9cca2389a824c07e822169 to your computer and use it in GitHub Desktop.
Save FabienDehopre/ac8560bf3b9cca2389a824c07e822169 to your computer and use it in GitHub Desktop.
My Ubuntu Install Script (install all my needed packages)
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install -y curl
release=$(lsb_release -cs)
pkg_list=(git git-flow zsh zsh-doc openssh-server net-tools mc dotnet-sdk-2.1.105 nodejs yarn)
echo "Configuring APT repositories..."
if [[ $release == "trusty" ]]
then
pkg_list+=(linux-image-extra-$(uname -r) linux-image-extra-virtual)
fi
if [[ $release == "bionic" ]]
then
pkg_list+=(docker.io)
else
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $release stable"
pkg_list+=(apt-transport-https ca-certificates software-properties-common docker-ce)
fi
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$release-prod $release main" | sudo tee /etc/apt/sources.list.d/dotnetdev.list
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
echo "Done."
echo "Installing the following packages ${pkg_list[@]}"
sudo apt-get update && sudo apt-get install -y "${pkg_list[@]}"
echo "Done."
if ! grep -q docker /etc/group
then
echo "Group docker does not exist. Creating..."
sudo groupadd docker
fi
echo "Adding current user ($USER) to group docker..."
sudo usermod -aG docker $USER
echo "Done."
echo "Installing docker compose..."
sudo curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
echo "Done."
echo "Configuring NPM..."
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo "Done."
echo "Updating NPM to latest version..."
npm install -g npm
sudo rm /usr/bin/npm
sudo rm /usr/bin/npx
echo "Done."
echo "Installing Node.JS packages via Yarn..."
yarn global add @angular/cli conventional-changelog-angular conventional-changelog-cli conventional-recommended-bump node-gyp semver standard-changelog trash-cli webpack-bundle-analyzer
echo "Done."
echo "Configuring ZSH to use Antigen..."
curl -L git.io/antigen | sudo tee /opt/antigen.zsh
cat <<EOT >> .zshrc
source /opt/antigen.zsh
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle command-not-found
antigen bundle dircycle
antigen bundle docker
antigen bundle encode64
antigen bundle git
antigen bundle git-flow
antigen bundle history
antigen bundle node
antigen bundle npm
antigen bundle ng
antigen bundle yarn
antigen bundle z
# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-completions
# Load the theme.
antigen theme https://github.com/denysdovhan/spaceship-prompt spaceship
# Tell Antigen that you're done.
antigen apply
export PATH=\$HOME/.npm-global/bin:\$PATH
alias ll="ls -la"
alias cls=clear
alias crb="conventional-recommended-bump -p angular -t v -v"
EOT
echo "Done."
echo "Changing default shell to ZSH..."
chsh -s $(which zsh)
echo "Done".
echo "Install complete. Logout and login again to make all the changes available."
@sardar7110
Copy link

Login and logout

@sardar7110
Copy link

Hashtag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment