Last active
November 1, 2019 09:12
-
-
Save javagrails/cf536e4ddd902a5bd48fa4a90b372997 to your computer and use it in GitHub Desktop.
ubuntu develop environment ready commands
This file contains 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
===== ## ubuntu OS Information ===== | |
sudo lsb_release -a | |
===== ## build essential for ubuntu ===== | |
sudo apt-get install -y build-essential | |
sudo apt-get install libpng-dev libjpeg-dev -y | |
sudo apt-get install pngquant -y | |
sudo apt-get install unrar -y | |
# Fix local issue: https://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue | |
===== ## installing vim ===== | |
sudo apt-get update | |
sudo apt-get install vim -y | |
===== ## install curl ===== | |
sudo apt-get update && sudo apt-get install curl | |
===== ## xclip installation ===== | |
sudo apt install xclip -y | |
===== ## openssh-server installation ===== | |
sudo apt install openssh-server | |
ssh-keygen -t rsa | |
cat ~/.ssh/id_rsa.pub | |
sudo apt-get update | |
===== ## install git ===== | |
sudo apt-get update | |
sudo apt-get install git | |
whereis git | |
git version | |
===== ## git gonfig ===== | |
git config --global user.name "you" | |
git config --global user.email "[email protected]" | |
git config --global color.ui auto | |
# show info by command | |
git config -l | |
# generate ssh key | |
ssh-keygen -t rsa -C "[email protected]" | |
cat .ssh/id_rsa.pub | |
cat ~/.ssh/id_rsa.pub | xclip -sel clip | |
# now paste the generated key in bitbucket user profile - DONE | |
git clone [email protected]:bitbucket_username/anyrepo.git | |
cd anyrepo/ | |
git branch | |
touch some.txt | |
git add . | |
git status | |
git commit -m "a file added" | |
git push origin master | |
git remote -v | |
git pull origin master | |
===== ## Secondarygit account and it's repo config ===== | |
salman@salmanpc:~/IdeaProjects/tanz $ git clone [email protected]:kasablanka/dms.git | |
salman@salmanpc:~/IdeaProjects/tanz $ cd dms/ | |
salman@salmanpc:~/IdeaProjects/tanz/dms (master) $ git config --list | |
user.name=mainGitAccountName | |
[email protected] | |
color.ui=auto | |
core.repositoryformatversion=0 | |
core.filemode=true | |
core.bare=false | |
core.logallrefupdates=true | |
[email protected]:kasablanka/dms.git | |
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* | |
branch.master.remote=origin | |
branch.master.merge=refs/heads/master | |
salman@salmanpc:~/IdeaProjects/tanz/dms (master) $ | |
salman@salmanpc:~/IdeaProjects/tanz/dms (master) $ git config user.name "secondaryGitAccountName" | |
salman@salmanpc:~/IdeaProjects/tanz/dms (master) $ git config user.email "[email protected]" | |
salman@salmanpc:~/IdeaProjects/tanz/dms (master) $ git config --list | |
user.name=mainGitAccountName | |
[email protected] | |
color.ui=auto | |
core.repositoryformatversion=0 | |
core.filemode=true | |
core.bare=false | |
core.logallrefupdates=true | |
[email protected]:kasablanka/dms.git | |
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* | |
branch.master.remote=origin | |
branch.master.merge=refs/heads/master | |
user.name=secondaryGitAccountName | |
[email protected] | |
salman@salmanpc:~/IdeaProjects/tanz/dms (master) $ git remote -v | |
origin [email protected]:kasablanka/dms.git (fetch) | |
origin [email protected]:kasablanka/dms.git (push) | |
===== ## font installation - zip unzip - move file/folder ===== | |
whereis fonts | |
tar xf fonts_all.tar.gz | |
sudo mv SolaimanLipi_20-04-07.ttf /usr/share/fonts/truetype/ | |
===== ## java installation ===== | |
tar -xvf jdk-8u144-linux-x64.tar.gz | |
sudo mv ./jdk1.8.0_144 /usr/lib/jvm/ | |
## => then in /etc/bash.bashrc => sudo nano /etc/bash.bashrc | |
JAVA_HOME=/usr/lib/jvm/jdk1.8.0_144 | |
export JAVA_HOME | |
JRE_HOME=/usr/lib/jvm/jdk1.8.0_144/jre | |
export JRE_HOME | |
#CATALINA_HOME=/usr/local/apache-tomcat-8.5.14 | |
#export CATALINA_HOME | |
# PATH=${PATH}:${JAVA_HOME}/bin:${PATH}:${JRE_HOME}/bin:${PATH}:${CATALINA_HOME}/bin:${AND_TOOLS}:${AND_PLAT_TOOLS} | |
PATH=${PATH}:${JAVA_HOME}/bin:${PATH}:${JRE_HOME}/bin:${PATH}:${CATALINA_HOME}/bin | |
export PATH | |
#alias ton="/usr/local/apache-tomcat-8.5.14/bin/startup.sh" | |
#alias tof="/usr/local/apache-tomcat-8.5.14/bin/shutdown.sh" | |
===== ## java test code run in terminal ===== | |
whereis java | |
java --version | |
javac HelloWorld.java | |
java HelloWorld | |
===== ## tomcat installation ===== | |
tar xf apache-tomcat-8.5.16.tar.gz | |
sudo mv ./apache-tomcat-8.5.16 /usr/local/ | |
## => then in /etc/bash.bashrc => sudo nano /etc/bash.bashrc | |
CATALINA_HOME=/usr/local/apache-tomcat-8.5.14 | |
export CATALINA_HOME | |
PATH=${PATH}:${JAVA_HOME}/bin:${PATH}:${JRE_HOME}/bin:${PATH}:${CATALINA_HOME}/bin | |
export PATH | |
alias ton="/usr/local/apache-tomcat-8.5.14/bin/startup.sh" | |
alias tof="/usr/local/apache-tomcat-8.5.14/bin/shutdown.sh" | |
===== ## install sdkman and related stuffs ===== | |
curl -s "https://get.sdkman.io" | bash | |
source "$HOME/.sdkman/bin/sdkman-init.sh" | |
sdk version | |
sdk list groovy | |
sdk install groovy 2.4.9 | |
sdk list gradle | |
sdk install gradle 4.1 | |
===== ## Intelij Idea installation ===== | |
cd Downloads/ | |
tar -xvf ideaIU-2017.2.tar.gz | |
sudo mv ./idea-IU-172.3317.76 /opt | |
cd /opt/idea-IU-172.3317.76/ | |
cd bin | |
./idea.sh | |
===== ## Android-studio installation ===== | |
sudo unzip android-studio-ide-162.4069837-linux.zip -d | |
sudo unzip android-studio-ide-162.4069837-linux.zip -d /home/salman/Downloads | |
sudo mv ./android-studio /opt | |
sudo chmod 777 -R studio.sh | |
./studio.sh | |
===== ## when running android studion below commands may need to load app in mobile ===== | |
sudo usermod -aG plugdev $LOGNAME | |
sudo apt-get install android-tools-adb | |
sudo adb push app.apk /mnt/sdcard | |
===== ## MySql server installation ===== | |
sudo apt-get update | |
sudo apt-get install mysql-server-5.7 | |
===== ## install Node ===== | |
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
sudo apt-get update | |
whereis node | |
node -v | |
npm -v | |
===== ## install Yarn ===== | |
sudo apt-get update -y | |
sudo apt-get remove yarn -y && sudo apt-get purge yarn -y | |
yarn cache clean | |
whereis yarn && yarn -v | |
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 | |
sudo apt-get update -y && sudo apt-get install yarn -y | |
whereis yarn && yarn -v | |
===== ## install angular cli ===== | |
ng -v | |
sudo apt-get update | |
sudo chown -R $USER /usr/local | |
whoami | |
sudo chown -R {salman} /usr/local | |
ll -l /usr/local | |
sudo apt-get update | |
sudo npm install -g @angular/cli | |
whereis ng | |
ng -v | |
sudo apt-get update | |
===== ## jhipster installation ===== | |
whereis git | |
sudo yarn global add yo | |
sudo yarn global add bower | |
sudo yarn global add gulp-cli | |
sudo yarn global add generator-jhipster | |
// if above command gives any error then run below commands | |
npm config set registry "http://registry.npmjs.org" | |
// OR | |
yarn config set registry "http://registry.npmjs.org" | |
// then run | |
sudo yarn global add generator-jhipster | |
whereis jhipster & jhipster -v | |
Troubleshooting :: If you have problems using Yarn globally, be sure to have $HOME/.config/yarn/global/node_modules/.bin in your path. On Mac or Linux: export PATH="$PATH:`yarn global bin`:$HOME/.config/yarn/global/node_modules/.bin" | |
echo $PATH$ | |
whereis jhipster | |
cd hipapp/ | |
mkdir blog | |
cd blog/ | |
yo jhipster | |
yo jhipster:import-jdl ~/Downloads/blog.jh | |
===== ## fish shell installation ===== | |
sudo apt-add-repository ppa:fish-shell/release-2 | |
sudo apt-get update | |
sudo apt-get install fish | |
fish | |
===== ## Ubuntu Permission Issues ===== | |
sudo chown -R salman /opt/lampp | |
sudo chown -R salman:salman /opt/lampp | |
sudo chmod 777 /opt/lampp/* | |
sudo chmod +x /opt/lampp/* | |
UserGroupPermission on local dir and dir's in it | |
owner => salman@salmanpc:~$ sudo chown -R $USER /usr/local | |
owner Group => salman@salmanpc:~$ sudo chown -R $USER:USER_GROUP /usr/local | |
salman@salmanpc:~$ sudo chown -R salman /usr/local | |
owner => salman@salmanpc:~$ sudo chown -R salman /opt/lampp | |
owner Group => salman@salmanpc:~$ sudo chown -R salman:salman /opt/lampp | |
salman@salmanpc:~$ sudo chmod 777 /opt/lampp/* | |
salman@salmanpc:~$ sudo chmod +x /opt/lampp/* | |
===== ## docker installation ===== | |
whereis docker | |
docker --version | |
sudo apt-get update | |
sudo apt-get remove docker docker-engine docker.io | |
cls | |
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual | |
sudo apt-get update | |
sudo apt-get install apt-transport-https ca-certificates curl 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-get update | |
sudo apt-get install docker-ce | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
cd /var/run/ | |
sudo chown salman:salman docker | |
sudo chown salman:salman docker.sock | |
docker --version | |
sudo docker run hello-world | |
service docker staus | |
service docker status | |
docker images | |
docker containers | |
docker --help | |
docler ps | |
docker run -it hello-world | |
docker run -it hello-world /bin/bash | |
docker images | |
docker ps -a | |
docker run -it hello-world:latest /bin/bash | |
docker run -it hello-world /bin/bash | |
docker ps -a | |
docker rm 5369f8d27a07 # image/container id | |
docker images | |
docker run -it hello-world /bin/bash | |
docker run -it hello-world:latest /bin/bash | |
docker ps -a | |
docker rm 90f9f256aa2d | |
docker images | |
docker run -it hello-world:latest /bin/sh | |
docker run -it hello-world /bin/sh | |
docker ps -qa|xargs docker rm -f | |
docker images | |
docker ps -a | |
docker run -it hello-world | |
docker ps -a | |
docker images | |
docker start 7cea8c8bfde4 # image/container id | |
docker ps -a | |
docker start 7cea8c8bfde4 # image/container id | |
docker ps | |
docker info | |
docker ps | |
docker ps -a | |
docker container ls | |
service docker status | |
docker info | |
docker login | |
docker images | |
===== ## install docker compose ===== | |
sudo apt-get update | |
sudo apt install docker-compose | |
docker-compose -f src/main/docker/consul.yml up | |
./mvnw liquibase:dropAll liquibase:update | |
===== ## play with bash promt ===== | |
1. Create a file [~/.inputrc] in home and write with below contents .. this will auto complete previous bash command with up arrow | |
"\e[A": history-search-backward | |
"\e[B": history-search-forward | |
set show-all-if-ambiguous on | |
set completion-ignore-case on | |
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving | |
# https://askubuntu.com/questions/744625/can-no-longer-use-ctrlleft-right-in-bash-terminal | |
"\e[1;5C": forward-word | |
"\e[1;5D": backward-word | |
2. In [.bashrc] file of home write below contents for showing git repo namein terminal | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
#export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ " | |
#export PS1="\[\033[01;35m\]\u@\h:\[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ " | |
export PS1="\[\033[01;35m\]\u\[\033[01;30m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ " | |
## For more advanced coustomize of bash terminal you can follow like below | |
--------------------------------------------------------------------------- | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
#export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ " | |
#below line is ok | |
#export PS1="\[\033[01;35m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\]$ " | |
#export PS1="\[\033[01;35m\]\u\[\033[01;33m\]@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\$(short_pwd)\[\033[33m\]\$(parse_git_branch)\[\033[00m\]$ " | |
#export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\]@\[\033[0;36m\]\h:\w\[\033[0;32m\]$(__git_ps1)\n\[\033[0;32m\]ââ\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\] â¶\[\033[0m\] ' | |
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\]@\[\033[0;36m\]\h(\d \@):\w\[\033[0;32m\]$(__git_ps1)\n\[\033[0;32m\]ââ\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\] â¶\[\033[0m\] ' | |
#export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\]@\[\033[0;36m\]\h(\d \@):\e[44m\w\[\033[0;32m\]$(__git_ps1)\n\[\033[0;32m\]ââ\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\] â¶\[\033[0m\]' | |
STARTFGCOLOR='\e[0;34m'; | |
STARTBGCOLOR="\e[47m" | |
ENDCOLOR="\e[0m" | |
#export PS1="$STARTFGCOLOR$STARTBGCOLOR\u@\h \w> $ENDCOLOR" | |
# https://unix.stackexchange.com/questions/148/colorizing-your-terminal-and-shell-environment | |
# https://gist.github.com/jameshclrk/83bf7c015a08c508426220b17d1eda04 | |
# date tile :: https://askubuntu.com/questions/16728/hide-current-working-directory-in-terminal | |
# http://www.webdevotion.be/blog/2012/06/06/terminal-git-branch-status-colored-icons/ | |
# https://github.com/riobard/bash-powerline | |
# https://gist.github.com/justintv/168835 | |
# https://askubuntu.com/questions/123268/changing-colors-for-user-host-directory-information-in-terminal-command-prompt | |
# https://github.com/banga/powerline-shell | |
# Some Special fonts for terminal | |
# http://www.paradox.io/posts/9-my-new-zsh-prompt | |
## fonts https://github.com/powerline/fonts | |
# https://github.com/agnoster/agnoster-zsh-theme | |
# https://gist.github.com/agnoster/3712874 | |
# https://github.com/ryanoasis/powerline-extra-symbols | |
# https://github.com/ryanoasis/nerd-fonts | |
--------------------------------------------------------------------------- | |
===== ## some more ls aliases ===== | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias cls='clear' | |
alias dopen='nautilus' | |
alias xmp="sudo /opt/lampp/manager-linux-x64.run" | |
alias chnsalman="sudo chown -R salman:salman " | |
alias chdall="sudo chmod 777 " | |
# PHALCON-PHP ALIAS | |
alias nh="cd /var/www/html/" | |
alias wg="sudo chown -R salman:wwwgroup /var/www/" | |
alias wp="sudo chmod -R 777 /var/www/" | |
alias python="/usr/bin/python3.5" | |
===== ## pip installation ===== | |
# source # https://www.rosehosting.com/blog/how-to-install-pip-on-ubuntu-16-04/ | |
sudo apt-get update | |
sudo apt-get install python-pip | |
pip -V | |
===== ## wine installation ===== | |
# source # https://wiki.winehq.org/Ubuntu | |
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 | |
===== ## postgresql installation ===== | |
# source # http://www.codebind.com/postgresql/how-to-install-postgresql-on-ubuntu-16-04-lts/ | |
# source # https://askubuntu.com/questions/831292/how-to-install-postgresql-9-6-on-any-ubuntu-version | |
sudo add-apt-repository "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" | |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get install postgresql-9.6 | |
# Message | |
Success. You can now start the database server using: | |
/usr/lib/postgresql/9.6/bin/pg_ctl -D /var/lib/postgresql/9.6/main -l logfile start | |
Ver Cluster Port Status Owner Data directory Log file | |
9.6 main 5432 down postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log | |
update-alternatives: using /usr/share/postgresql/9.6/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode | |
===== ## postgresql password set for USER postgres ===== | |
# source # https://danieltse.com/using-pgadmin-and-default-password-for-postgres/ | |
sudo -u postgres psql | |
psql (9.6.6) | |
Type "help" for help. | |
postgres=# ALTER USER postgres WITH PASSWORD 'salmandb'; | |
ALTER ROLE | |
postgres=# \q | |
===== ## pgAdmin installation ===== | |
# pgAdmin 3 | |
# source # https://www.howtoinstall.co/en/ubuntu/xenial/pgadmin3 | |
# source # http://www.codebind.com/postgresql/how-to-install-postgresql-on-ubuntu-16-04-lts/ | |
sudo apt-get update | |
sudo apt-get install pgadmin3 | |
# pgAdmin 4 | |
https://gist.github.com/mdiener21/70afcef0b9e21c590415dd597102a8d2 | |
https://medium.com/@philip.mutua/postgresql-install-pgadmin-4-desktop-mode-in-ubuntu-16-04-6faca19f0cfe | |
https://gist.github.com/ThomasG77/c0769593196ee387c77ed77bb8a3dbe2 | |
https://www.dbrnd.com/2017/07/postgresql-install-pgadmin-4-desktop-mode-in-ubuntu-16-04/ | |
=== | |
# java learnings => https://github.com/eugenp/tutorials/tree/master/core-java |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment