Last active
April 23, 2019 21:57
-
-
Save YasienDwieb/5eb16a54aeb8e5d271165fdba75fd082 to your computer and use it in GitHub Desktop.
Linux Packages installation assistant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #This script works on preparing a clean linux distro to be ready | |
| #for being used for developemnt | |
| #Author: Yasien | |
| while [ true ];do | |
| #Getting input from user about desired operation | |
| cat << EOT | |
| Please Choose an option: | |
| 1) install system essential packages | |
| 2) install mongo | |
| 3) install node | |
| 4) install phpmyadmin | |
| 5) install pip && venv | |
| 6) install oh-my-zsh | |
| 7) install Wine | |
| 8) install LEMP stack | |
| 9) install composer | |
| 10) install Docker | |
| 11) install Docker composer | |
| 12) install redis-server | |
| 0) Quit Script | |
| EOT | |
| read option | |
| case "$option" in | |
| 1) | |
| #install system essential packages | |
| echo 'installing essential packages' | |
| sudo apt update | |
| sudo apt install build-essential curl net-tools git -y | |
| sudo apt install -y software-properties-common | |
| ;; | |
| 2) | |
| #mongo installation | |
| echo 'installing mongo' | |
| sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 | |
| echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list | |
| sudo apt update | |
| sudo apt install -y mongodb-org | |
| echo "mongodb-org hold" | sudo dpkg --set-selections | |
| echo "mongodb-org-server hold" | sudo dpkg --set-selections | |
| echo "mongodb-org-shell hold" | sudo dpkg --set-selections | |
| echo "mongodb-org-mongos hold" | sudo dpkg --set-selections | |
| echo "mongodb-org-tools hold" | sudo dpkg --set-selections | |
| sudo service mongod start | |
| ;; | |
| 3) | |
| #node installation | |
| echo 'installing node' | |
| cd ~ | |
| curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh | |
| sudo bash nodesource_setup.sh | |
| sudo apt update && sudo apt install nodejs npm -y | |
| #yarn | |
| curl -sL 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 | |
| sudo apt update && sudo apt-get install yarn -y | |
| ;; | |
| 4) | |
| #phpmadmin installation | |
| echo 'installing phpmadmin' | |
| sudo apt install php-mbstring php-gettext phpmyadmin -y | |
| sudo phpenmod mbstring | |
| sudo systemctl restart apache2 | |
| ;; | |
| 5) | |
| #pip, venv installation | |
| echo 'installing pip' | |
| sudo apt install python-pip python-dev build-essential python3-pip -y | |
| sudo pip install --upgrade pip | |
| sudo pip install --upgrade virtualenv | |
| ;; | |
| 6) | |
| #oh-my-zsh installation | |
| echo 'installing oh-my-zsh' | |
| sudo apt install zsh -y | |
| sudo chsh -s /usr/bin/zsh $(whoami) | |
| wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh | |
| cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc | |
| source ~/.zshrc | |
| ;; | |
| 7) | |
| #wine installation | |
| echo 'installing wine' | |
| sudo dpkg --add-architecture i386 | |
| wget -nc https://dl.winehq.org/wine-builds/Release.key | |
| sudo apt-key add Release.key | |
| sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/ | |
| sudo apt-get update | |
| sudo apt-get install --install-recommends winehq-stable | |
| ;; | |
| 8) | |
| #LEMP stack installation | |
| echo 'installing LEMP' | |
| sudo apt update | |
| sudo apt install nginx | |
| sudo apt install mysql-server | |
| sudo mysql_secure_installation | |
| sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" | |
| sudo mysql -e 'FLUSH PRIVILEGES;' | |
| sudo apt install php-fpm php-mysql | |
| ;; | |
| 9) | |
| #composer installation | |
| echo 'installing composer' | |
| php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
| php composer-setup.php | |
| sudo mv composer.phar /usr/local/bin/composer | |
| rm composer-setup.php | |
| ;; | |
| 10) | |
| #docker & docker compose installation | |
| echo 'installing Docker' | |
| sudo apt update | |
| sudo apt install -y \ | |
| apt-transport-https \ | |
| ca-certificates \ | |
| curl \ | |
| gnupg-agent \ | |
| software-properties-common | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
| sudo apt-key fingerprint 0EBFCD88 | |
| sudo add-apt-repository \ | |
| "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ | |
| $(lsb_release -cs) \ | |
| stable" | |
| sudo apt update | |
| sudo apt install -y docker-ce docker-ce-cli containerd.io | |
| sudo groupadd docker | |
| sudo usermod -aG docker $USER | |
| sudo service docker restart | |
| sudo systemctl enable docker | |
| ;; | |
| 11) | |
| #Docker compose installation | |
| echo 'installing Docker compose' | |
| sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
| sudo chmod +x /usr/local/bin/docker-compose | |
| sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose | |
| ;; | |
| 12) | |
| #redis sever installation | |
| echo 'installing redis sever' | |
| sudo apt update | |
| sudo apt install -y redis-server | |
| ;; | |
| 0) | |
| echo 'bye bye' | |
| exit | |
| ;; | |
| *) | |
| echo 'Not a valid Option' | |
| ;; | |
| esac | |
| done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment