├── 1_opinionated.sh ├── 2_setup.sh ├── 3_configure.sh ├── 4_install_K8S_dashboard.sh ├── minikube_admin_user.yaml └── minikube_role_binding.yaml /1_opinionated.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | REBOOT=false 3 | 4 | function setSystemTimeToLocal() { 5 | read -p $'\e[96mDo you want to set system time to local (helps to solve issue with time if you have installed Windows also)?(y/N) \e[0m' -n 1 -r 6 | echo 7 | if [[ $REPLY =~ ^[Yy]$ ]]; then 8 | timedatectl set-local-rtc 1 --adjust-system-clock 9 | fi 10 | } 11 | 12 | function installLanguage() { 13 | read -p $'\e[96mEnter your language two-letter code if you want to install it \e[0m' -n 2 -r 14 | echo 15 | if [ -z "$REPLY" ]; then 16 | echo -e "\e[93mSkipping custom language installation\e[0m" 17 | echo 18 | else 19 | REBOOT=true 20 | apt-get install language-pack-$REPLY -y 21 | apt-get install language-pack-gnome-$REPLY -y 22 | apt-get install language-pack-$REPLY-base -y 23 | apt-get install language-pack-gnome-$REPLY-base -y 24 | apt-get install gnome-user-docs-$REPLY -y 25 | apt-get install gnome-getting-started-docs-$REPLY -y 26 | apt-get install hunspell-$REPLY -y 27 | apt-get install firefox-locale-$REPLY -y 28 | fi 29 | } 30 | 31 | function installVirtualBox() { 32 | read -p $'\e[96mDo you want to install VirtualBox?(y/N) \e[0m' -n 1 -r 33 | echo 34 | if [[ $REPLY =~ ^[Yy]$ ]]; then 35 | REBOOT=true 36 | apt-get install virtualbox -y 37 | fi 38 | } 39 | 40 | function installChrome() { 41 | read -p $'\e[96mDo you want to install Google Chrome?(y/N) \e[0m' -n 1 -r 42 | echo 43 | if [[ $REPLY =~ ^[Yy]$ ]]; then 44 | wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 45 | dpkg -i google-chrome-stable_current_amd64.deb 46 | 47 | rm google-chrome-stable_current_amd64.deb 48 | 49 | update-alternatives --config x-www-browser 50 | fi 51 | } 52 | 53 | function installGDMP() { 54 | read -p $'\e[96mDo you want to install Google Desktop Music Player?(y/N) \e[0m' -n 1 -r 55 | echo 56 | if [[ $REPLY =~ ^[Yy]$ ]]; then 57 | snap install google-play-music-desktop-player 58 | fi 59 | } 60 | 61 | function installSpotify() { 62 | read -p $'\e[96mHow about Spotify?(y/N) \e[0m' -n 1 -r 63 | echo 64 | if [[ $REPLY =~ ^[Yy]$ ]]; then 65 | snap install spotify 66 | fi 67 | } 68 | 69 | function installJBRider() { 70 | read -p $'\e[96mDo you want to install Jetbrains Rider?(y/N) \e[0m' -n 1 -r 71 | echo 72 | if [[ $REPLY =~ ^[Yy]$ ]]; then 73 | snap install rider --classic 74 | fi 75 | } 76 | 77 | function configurePowerSettings() { 78 | read -p $'\e[96mDo you want to install tlp and change power settings? (y/N) \e[0m' -n 1 -r 79 | echo 80 | if [[ $REPLY =~ ^[Yy]$ ]]; then 81 | apt-get install tlp tlp-rdw -y 82 | /etc/init.d/tlp restart 83 | echo -e "\e[96mNow you can edit your power settings\e[0m" 84 | echo -e "\e[96mThis is the settings which I prefer to use\e[0m" 85 | echo -e "\e[93mTLP_ENABLE=1\e[0m" 86 | echo -e "\e[93mTLP_DEFAULT_MODE=AC\e[0m" 87 | echo -e "\e[93mTLP_PERSISTENT_DEFAULT=0\e[0m" 88 | echo -e "\e[93mRUNTIME_PM_DRIVER_BLACKLIST=""\e[0m" 89 | echo -e "\e[93mUSB_AUTOSUSPEND=0\e[0m" 90 | echo -e "\e[93mDEVICES_TO_DISABLE_ON_STARTUP=\"bluetooth\"\e[0m" 91 | echo -e "\e[93mAnother useful tips here - https://askubuntu.com/a/1134726\e[0m" 92 | read -p $'\e[96mDo you want to change the settings right now?(y/N) \e[0m' -n 1 -r 93 | echo 94 | if [[ $REPLY =~ ^[Yy]$ ]]; then 95 | REBOOT=true 96 | gedit /etc/tlp.conf 97 | fi 98 | 99 | read -p $'\e[96mDo you want to set Intel videocard as your default?(y/N) \e[0m' -n 1 -r 100 | echo 101 | if [[ $REPLY =~ ^[Yy]$ ]]; then 102 | REBOOT=true 103 | sudo prime-select intel 104 | fi 105 | fi 106 | } 107 | 108 | function installPSCore() { 109 | read -p $'\e[96mDo you want to install PowerShell Core?(y/N) \e[0m' -n 1 -r 110 | echo 111 | if [[ $REPLY =~ ^[Yy]$ ]]; then 112 | sudo snap install powershell --classic 113 | fi 114 | } 115 | 116 | function proposeReboot() { 117 | if $REBOOT; then 118 | echo 119 | echo -e '\e[93mAll things done\e[0m' 120 | echo 121 | echo -e '\e[93mYou need to restart your computer to apply changes.\e[0m' 122 | echo 123 | fi 124 | } 125 | 126 | apt-get update 127 | apt-get upgrade 128 | 129 | setSystemTimeToLocal 130 | installLanguage 131 | installChrome 132 | installGDMP 133 | installSpotify 134 | installJBRider 135 | configurePowerSettings 136 | installPSCore 137 | installVirtualBox 138 | proposeReboot 139 | -------------------------------------------------------------------------------- /2_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function installGit() { 4 | # https://git-scm.com/download/linux 5 | echo -e "\e[96mInstalling Git\e[0m" 6 | apt-get install git -y 7 | } 8 | 9 | function installNETCoreSDK() { 10 | # https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-ubuntu-2004 11 | echo -e "\e[96mInstalling .NET Core SDK\e[0m" 12 | 13 | wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb 14 | dpkg -i packages-microsoft-prod.deb 15 | 16 | apt-get update 17 | apt-get install apt-transport-https -y 18 | apt-get update 19 | apt-get install dotnet-sdk-3.1 -y 20 | rm packages-microsoft-prod.deb 21 | } 22 | 23 | function installNodejs() { 24 | # https://github.com/nodesource/distributions/blob/master/README.md#snapinstall 25 | # In order to update to major version use: 26 | # snap refresh node --channel=15 27 | echo -e "\e[96mInstalling Nodejs\e[0m" 28 | 29 | snap install node --classic --channel=14 30 | } 31 | 32 | function installDockerCompose() { 33 | # this command installs docker-ce and containerd also 34 | echo -e "\e[96mInstalling Docker Compose\e[0m" 35 | apt-get install docker-compose -y 36 | } 37 | 38 | function installKubectl() { 39 | #https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-with-snap 40 | echo -e "\e[96mInstalling Kubectl\e[0m" 41 | 42 | snap install kubectl --classic 43 | 44 | echo -e "\e[96mChecking hypervisor installation\e[0m" 45 | dpkg-query --show "virtualbox" 46 | if [ "$?" != "0" ]; then 47 | echo -e "\e[96mVirtualBox not found\e[0m" 48 | dpkg-query --show "qemu-kvm" 49 | if [ "$?" != "0" ]; then 50 | echo -e "\e[96mKVM not found\e[0m" 51 | echo -e "\e[31mYou need to install KVM or VirtualBox Hypervisor before Minikube installation\e[0m" 52 | exit 1 53 | fi 54 | fi 55 | 56 | echo -e "\e[96mInstalling Minikube\e[0m" 57 | 58 | apt-get install curl -y 59 | curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && 60 | chmod +x minikube 61 | 62 | mkdir -p /usr/local/bin/ 63 | install minikube /usr/local/bin/ 64 | rm minikube 65 | } 66 | 67 | function installVSCode() { 68 | # https://code.visualstudio.com/docs/setup/linux 69 | echo -e "\e[96mInstalling VS Code\e[0m" 70 | 71 | snap install code --classic 72 | } 73 | 74 | function installVSCodeExtensions() { 75 | # Install vs code extension via terminal - https://code.visualstudio.com/docs/editor/extension-gallery#_command-line-extension-management 76 | # How to run command as current user from script, runned with sudo - https://stackoverflow.com/questions/41366023/run-specific-command-without-sudo-inside-script-running-with-sudo-bash 77 | 78 | echo -e "\e[96mInstalling VS Code extensions\e[0m" 79 | 80 | #General extensions 81 | echo -e "\t \e[96mInstalling IntelliCode extension\e[0m" 82 | sudo -u $SUDO_USER code --install-extension visualstudioexptteam.vscodeintellicode 83 | 84 | echo -e "\t \e[96mInstalling Gitlens extension\e[0m" 85 | sudo -u $SUDO_USER code --install-extension eamodio.gitlens 86 | 87 | echo -e "\t \e[96mInstalling shell-format extension\e[0m" 88 | sudo -u $SUDO_USER code --install-extension foxundermoon.shell-format 89 | 90 | #Frontend extensions 91 | echo -e "\t \e[96mInstalling TSLint extension\e[0m" 92 | sudo -u $SUDO_USER code --install-extension ms-vscode.vscode-typescript-tslint-plugin 93 | 94 | echo -e "\t \e[96mInstalling Prettier extension\e[0m" 95 | sudo -u $SUDO_USER code --install-extension esbenp.prettier-vscode 96 | 97 | echo -e "\t \e[96mInstalling Stylelint extension\e[0m" 98 | sudo -u $SUDO_USER code --install-extension thibaudcolas.stylelint 99 | 100 | #Backend extensions 101 | echo -e "\t \e[96mInstalling C# extension\e[0m" 102 | sudo -u $SUDO_USER code --install-extension ms-dotnettools.csharp 103 | 104 | echo -e "\t \e[96mInstalling rest-client extension\e[0m" 105 | sudo -u $SUDO_USER code --install-extension humao.rest-client 106 | 107 | #Containers extensions 108 | echo -e "\t \e[96mInstalling Docker extension\e[0m" 109 | sudo -u $SUDO_USER code --install-extension ms-azuretools.vscode-docker 110 | 111 | echo -e "\t \e[96mInstalling Kubernetes Snippets extension\e[0m" 112 | sudo -u $SUDO_USER code --install-extension ipedrazas.kubernetes-snippets 113 | 114 | echo -e "\t \e[96mInstalling Kubernetes Tools extension\e[0m" 115 | sudo -u $SUDO_USER code --install-extension ms-kubernetes-tools.vscode-kubernetes-tools 116 | } 117 | 118 | apt-get update -q 119 | 120 | installGit 121 | installNETCoreSDK 122 | installNodejs 123 | installDockerCompose 124 | installKubectl 125 | installVSCode 126 | installVSCodeExtensions 127 | -------------------------------------------------------------------------------- /3_configure.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function configureGitUserNameAndEmail() { 4 | echo -e "\e[96mEnter your git user name\e[0m" 5 | read GITUSERNAME 6 | sudo -u $SUDO_USER git config --global user.name $GITUSERNAME 7 | 8 | echo -e "\e[96mEnter your git user email\e[0m" 9 | read GITUSERMAIL 10 | sudo -u $SUDO_USER git config --global user.email $GITUSERMAIL 11 | } 12 | 13 | function configureGitDefaultEditor() { 14 | read -p $'\e[96mDo you want to set vscode as default git editor?(y/N)\e[0m' -n 1 -r 15 | echo 16 | if [[ $REPLY =~ ^[Yy]$ ]]; then 17 | sudo -u $SUDO_USER git config --global core.editor "code --wait" 18 | fi 19 | } 20 | 21 | function configureGitCredentialStore() { 22 | read -p $'\e[96mDo you want to set libsecret as credential store?(y/N)\e[0m' -n 1 -r 23 | echo 24 | if [[ $REPLY =~ ^[Yy]$ ]]; then 25 | 26 | # https://www.softwaredeveloper.blog/git-credential-storage-libsecret 27 | # for ssh configuration see https://www.softwaredeveloper.blog/store-git-ssh-credentials-in-linux 28 | 29 | apt-get install libsecret-1-0 libsecret-1-dev -y 30 | cd /usr/share/doc/git/contrib/credential/libsecret 31 | make 32 | sudo -u $SUDO_USER git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret 33 | fi 34 | } 35 | 36 | function configureDockerAccess() { 37 | # https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user 38 | sudo usermod -aG docker $SUDO_USER 39 | echo -e "\e[93mCurrent user configured to access docker socket\e[0m" 40 | echo -e "\e[93mYou need to restart computer before using docker\e[0m" 41 | } 42 | 43 | configureGitUserNameAndEmail 44 | configureGitDefaultEditor 45 | configureGitCredentialStore 46 | configureDockerAccess 47 | -------------------------------------------------------------------------------- /4_install_K8S_dashboard.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function configureMinikubeDashboard() { 4 | echo -e "\e[96mRunning Minikube\e[0m" 5 | sudo -u $SUDO_USER minikube start 6 | echo -e "\e[96mInstalling Kubernetes Dashboard\e[0m" 7 | # https://github.com/kubernetes/dashboard 8 | sudo -u $SUDO_USER kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml 9 | 10 | echo -e "\e[96mApplying admin-user and it's role mapping\e[0m" 11 | echo 12 | sudo -u $SUDO_USER kubectl apply -f minikube_admin_user.yaml 13 | sudo -u $SUDO_USER kubectl apply -f minikube_role_binding.yaml 14 | echo 15 | echo -e "\e[96mDashboard available at http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/\e[0m" 16 | echo 17 | echo -e "\e[96mIn order to use it you should run \"kubectl proxy\" command and access dashboard with a token printed by next command:\e[0m" 18 | echo 19 | echo -e "\e[92mkubectl -n kubernetes-dashboard describe secret \$(kubectl -n kubernetes-dashboard get secret | grep admin-user | awk '{print \$1}')\e[0m" 20 | echo 21 | echo -e "\e[92mFor more details see https://github.com/kubernetes/dashboard#getting-started \e[0m" 22 | echo 23 | } 24 | 25 | configureMinikubeDashboard 26 | -------------------------------------------------------------------------------- /minikube_admin_user.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: admin-user 5 | namespace: kubernetes-dashboard 6 | -------------------------------------------------------------------------------- /minikube_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: admin-user 5 | namespace: kubernetes-dashboard 6 | roleRef: 7 | apiGroup: rbac.authorization.k8s.io 8 | kind: ClusterRole 9 | name: cluster-admin 10 | subjects: 11 | - kind: ServiceAccount 12 | name: admin-user 13 | namespace: kubernetes-dashboard 14 | --------------------------------------------------------------------------------