- nvm and node.js
- java 8/9
- sublime text 3
- google chrome
- visual studio code
- yarn
- docker-ce
- vlc
- pgadmin
- zsh and oh-my-zsh (optional)
- mosh
- openssh-server
- virtualbox
- intellij
- sdkman (optional)
- gradle
- apache maven
- kotlin
- kscript
- scala
- anaconda and python36
- pig
- elixir [optional]
A tool that allows downloading and installing Node.js while ensuring multiple node versions do not causes conflicting issues.
Refers to https://github.com/creationix/nvm for more information.
Downloading NVM from github:
# run this from ~/ or copy git repo to ~/.nvm
git clone https://github.com/creationix/nvm.git .nvm
# checkout branch containing the latest version (v0.33.8) as master branch might not work
git checkout v0.33.8
# activating nvm
. nvm.sh
Append the following required configuration to ~/.bashrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# change to use a internal mirror of the node binaries by setting $NVM_NODEJS_ORG_MIRROR (default is http://nodejs.org/dist)
export NVM_NODEJS_ORG_MIRROR=http://nodejs.org/dist
Remember to reopen a new terminal or source ~/.bashrc for change to take effect
Installing Node.JS via nvm
# install the latest version of Node.JS
nvm install node
# install specifically v8.9.3 of Node.JS
nvm install 8.9.3
# if multiple version installed, switch to use specific version (e.g. v8.9.3)
nvm use 8.9.3
nvm alias default 8.9.3
# check version of runtime Node.JS is switched correct
node -v
Downloading Java from Oracle and put it under /usr/local/java
sudo mkdir -p /usr/local/java
sudo tar xvfz jdk-8u151-linux-x64.tar.gz -C /usr/local/java
Configure environment in ~/.bashrc
export JAVA_HOME=/usr/local/java/jdk1.8.0_151
Configure to make Java available
sudo update-alternatives --install /usr/bin/java java ${JAVA_HOME%*/}/bin/java 20000
sudo update-alternatives --install /usr/bin/javac javac ${JAVA_HOME%*/}/bin/javac 20000
Alternatively, registering the below PPA repos (not by Oracle) to install the JDK (not a prefer method for offline environment)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
# install latest version of oracle java 8
sudo apt-get install oracle-java8-installer
# alternatively, install latest version of oracle java 9
sudo apt-get install oracle-java9-installer
# remove the PPA since it only provides an installer, and not updates for the JDK
sudo add-apt-repository -r ppa:webupd8team/java
# for setting Java environment variables
sudo apt install oracle-java8-set-default
# for setting Java environment variables (for java 9)
sudo apt install oracle-java9-set-default
Run the following command for online environment
# sublime text 3
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
# google chrome
wget -qO - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
# visual studio code
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
# yarn (package manager)
# node is not needed/installed via apt as it will be managed by nvm
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
# docker-ce
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# virtual box
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
For offline environment, manually download the gpg/pub files on machine with access to Internet, copy to offline environment and finally run apt-key addcommand
Example for Sublime Text 3
Instead of running wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -, do the following:
On machine with Internet:
- Download gpg file from https://download.sublimetext.com/sublimehq-pub.gpg
- Rename gpg file to sublimehq-pub.gpg and copy it to offline environment
On offline machine:
cdto directory containing the gpg file- run the command
sudo apt-key add sublimehq-pub.gpg - repeat for other repository keys
This should be done after adding the various apt repository keys.
# sublime text 3
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
# google chrome
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
# visual studio code
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
# yarn (package manager)
# node is not needed/installed via apt as it will be managed by nvm
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# docker-ce
# note that add-apt-repository command requires software-properties-common to be already installed
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# docker-ce (edge) [as of Dec 2017, Support for Ubuntu 17.10 or artful is only in edge channel]
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge"
# virtual box
echo "deb http://download.virtualbox.org/virtualbox/debian artful contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
Download the apt-offline utility (deb file) from ubuntu manually on a machine with Internet access
wget -c http://security.ubuntu.com/ubuntu/pool/universe/a/apt-offline/apt-offline_1.8.1_all.deb
Copy and install the apt-offline utility on the offline machine. Take, for instance, the copied file resides on ~/Download directory
cd ~/Download
sudo dpkg -i apt-offline_1.8.1_all.deb
apt-offline uses /etc/apt/trusted.gpg instea of /etc/apt/trusted.gpg.d directory as keyring. Thus, if see errors related to can't to check signature: public key not found, alter /etc/apt/trusted.gpg file to import missing keys
sudo apt-key exportall | sudo gpg --no-default-keyring --import --keyring /etc/apt/trusted.gpgUpdate the index or package lists of the registered APT Repositories or PPAs for package installations/upgrades. This synchronization requires Internet access.
sudo apt-get updateFor offline environment, use apt-offline to update the index instead. See Section on Manual Installation of apt-offline for instructions to install apt-offline before continuing.
Define update action using apt-offline on the offline machine. This generate a signature file
# generate database of apt repositories and ppas that are needed for an update
sudo apt-offline set 01_apt_repos_update_20171212.sig --update
Copy the signature file (e.g. 01_apt_repos_update_20171212.sig) to machine with Internet access. Machine should have apt-offline as well. Note that it is possible to install apt-offline on Microsoft Windows (See apt-offline on MS Windows)
Run the following to fetch required APT data described in the signature file. The result is bundled as a single archive file (e.g. 01_apt_repos_update_20171212.zip).
# fetch data (using 2 threads) and bundled them into a single file
apt-offline get 01_apt_repos_update_20171212.sig --bundle 01_apt_repos_update_20171212.zip --threads 2
Copy the bundle file to the offline machine and finish package index update process by running below command
sudo apt-offline install 01_apt_repos_update_20171212.zip
For machine with Internet access, skip to Install Packages with apt-get.
For offline environment, do the following before running following the section Install Packages with apt-get.
Define install packages action using apt-offline on the offline machine. This generate a signature file
# generate database of packages to request for download
sudo apt-offline set apt_pkgs_install_20171212.sig --install-packages apt-transport-https ca-certificates curl software-properties-common vim tmux tree jq exfat-utils exfat-fuse cifs-utils smbclient nfs-common sublime-text google-chrome-stable code yarn docker-ce vlc browser-plugin-vlc pgadmin3 git-core zsh mosh openssh-server virtualbox-5.2 dkms
Copy the signature file (e.g. apt_pkgs_install_20171212.sig) to machine with Internet access. Machine should have apt-offline as well. Note that it is possible to install apt-offline on Microsoft Windows (See apt-offline on MS Windows)
Run the following to fetch required APT data described in the signature file. The result is bundled as a single archive file (e.g. apt_pkgs_install_20171212.zip).
# fetch data (using 2 threads) and bundled them into a single file
apt-offline get apt_pkgs_install_20171212.sig --bundle apt_pkgs_install_20171212.zip --threads 2
Copy the bundle file to the offline machine and update APT database with the downloaded packages. Note that this only make apt-get able to install packages not already installed them.
sudo apt-offline install apt_pkgs_install_20171212.zip
Run the following to install various packages from APT repositories and/or PPAs
# common useful utilities
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
# really useful tools
sudo apt-get install vim tmux tree jq
# support for exfat
sudo apt-get install exfat-utils exfat-fuse
# support for cifs, smb and nfs
sudo apt-get install cifs-utils smbclient nfs-common
# sublime text 3
sudo apt-get install sublime-text
# google chrome
apt-get install google-chrome-stable
# visual studio code
sudo apt-get install code
# yarn (package manager)
sudo apt-get install --no-install-recommends yarn
# docker-ce
sudo apt-get install docker-ce
# vlc
sudo apt-get install vlc browser-plugin-vlc
# pgadmin 3 (note that it's no longer maintained, should use pgadmin4 instead)
# e.g. sudo docker pull dpage/pgadmin4
sudo apt-get install pgadmin3
# zsh
sudo apt-get install git-core zsh
# mosh (mobile ssh)
sudo apt-get install mosh
# sshd
sudo apt-get install openssh-server
# virtual box
sudo apt-get install virtualbox-5.2 dkms
Ensure package list or index of APT repositories are updated. See Section Updating Index of APT Repositories for updating the index.
Define upgrade action using apt-offline on the offline machine. This generate a signature file
# generate database of packages to check for upgrade
sudo apt-offline set apt_repos_upgrade_20171212.sig --upgrade
Copy the signature file (e.g. apt_repos_upgrade_20171212.sig) to machine with Internet access. Machine should have apt-offline as well. Note that it is possible to install apt-offline on Microsoft Windows (See apt-offline on MS Windows)
Run the following to fetch required APT data described in the signature file. The result is bundled as a single archive file (e.g. apt_repos_upgrade_20171212.zip).
# fetch data (using 2 threads) and bundled them into a single file
apt-offline get apt_repos_upgrade_20171212.sig --bundle apt_repos_upgrade_20171212.zip --threads 2
Copy the bundle file to the offline machine and install it using apt-offline utility to update APT database
sudo apt-offline install apt_repos_upgrade_20171212.zip
Download the binaries from Jetbrains
Example:
2017.3.1 (build 173.3942.27) Released: Dec 12. 2017
Extract the downloaded file under /opt and run it for the 1st time to create Desktop Entry for Intellij Idea
sudo tar xvfz ideaIU-2017.3.1.tar.gz -C /opt/
/opt/ideaIU-2017.3.1.tar.gz/bin/idea.sh
Download and install the plugins from Jetbrains Plugins Repository
- kotlin 1.2.10-release-IJ2017.3-1 (https://plugins.jetbrains.com/plugin/download?updateId=41679)
- scala (https://plugins.jetbrains.com/plugin/download?updateId=41523)
- file watcher (https://plugins.jetbrains.com/plugin/download?updateId=40385)
- .ignore (https://plugins.jetbrains.com/plugin/download?updateId=40625)
- sonarLint? sonarqube community plugin?
- bootstrap 3 (https://plugins.jetbrains.com/plugin/download?updateId=39293)
- java decompiler intellij plugin (https://plugins.jetbrains.com/plugin/download?updateId=15663)
- protobuf support (https://plugins.jetbrains.com/plugin/download?updateId=37332)
- regexp tester (https://plugins.jetbrains.com/plugin/download?updateId=15621)
- nodejs (https://plugins.jetbrains.com/plugin/download?updateId=41061)
- pig (https://plugins.jetbrains.com/plugin/download?updateId=19054)
- save actions (https://plugins.jetbrains.com/plugin/download?updateId=40631)
- docker integration (https://plugins.jetbrains.com/plugin/download?updateId=40538)
This method uses the custom download_vsix.sh and install_vsix.sh shell scripts. It works for offline as well.
- Put the extensions to be downloaded into the vsix array inside
download_visxas a string of this format ".:" - Run
./download_vsix.sh(on machine with Internet access) that will download the vsix files into vsix directory - Run
./install_vsix.sh(on offline machine) to install all extension files inside vsix directory
Note that PeterJausovec.vscode-docker:0.0.22 has issue installing offline
{
"gitlens.advanced.messages": {
"suppressCommitHasNoPreviousCommitWarning": false,
"suppressCommitNotFoundWarning": false,
"suppressFileNotUnderSourceControlWarning": false,
"suppressGitVersionWarning": false,
"suppressLineUncommittedWarning": false,
"suppressNoRepositoryWarning": false,
"suppressUpdateNotice": false,
"suppressWelcomeNotice": true
},
"editor.renderIndentGuides": false,
"workbench.iconTheme": "vscode-icons",
"sublimeTextKeymap.promptV3Features": true,
"editor.formatOnSave": true,
"editor.tabCompletion": true,
"editor.quickSuggestions": {
"other": false,
"comments": false,
"strings": false
},
"prettier.eslintIntegration": true
}It is crucial to change profile preference of terminal to run command as a login shell for .bash_profile and .profile to work as expected.
In Ubuntu or its varient, preferably, use .profile instead of .bash_profile.
Note that ~/.profile will creased to work when ~/.bash_profile exists.
If online, via sdkman:
sudo curl -s "https://get.sdkman.io" | bash
sdk install gradle
If offline, download the binary from gradle and run the following command from download directory.
sudo mkdir /opt/gradle
sudo unzip -d /opt/gradle gradle-4.4.1-all.zip
sudo echo "export PATH=$PATH:/opt/gradle/gradle-4.4.1/bin" >> ~/.bashrc
If online, via sdkman:
sudo curl -s "https://get.sdkman.io" | bash
sdk install maven
If offline, download the binary from apache and run the following command from download directory.
sudo mkdir /opt/maven
sudo tar xvfz apache-maven-3.5.2-bin.tar.gz -C /opt/maven
sudo echo "export PATH=$PATH:/opt/maven/apache-maven-3.5.2/bin" >> ~/.bashrc
If online, via sdkman:
sudo curl -s "https://get.sdkman.io" | bash
sdk install kotlin
If offline, download the compiler from github and run the following command from download directory
sudo mkdir /opt/kotlin
sudo unzip -d /opt/kotlin-compiler-1.2.10.zip
sudo echo "export PATH=$PATH:/opt/kotlin/kotlin-1.2.10/bin" >> ~/.bashrckscript requires Kotlin and Maven to be installed.
If online, kscript can be installed via sdkman:
sudo curl -s "https://get.sdkman.io" | bash
sdk install kscript
If offline, download the binary from github and run the following command from download directory
sudo mkdir /opt/kscript
sudo unzip -d /opt/kscript-2.3.0-bin.zip
sudo echo "export PATH=$PATH:/opt/kotlin/kotlin-1.2.10/bin" >> ~/.bashrcIf online, via sdkman:
sudo curl -s "https://get.sdkman.io" | bash
sdk install scala
If offline, via Scala plugin in Intellij and Gradle with access to artifact repository
Ensure git core and zsh are installed before continuing
If online, run the below command to install oh-my-zsh:
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
If offline, perform the following steps instead:
- download the git repository from github, extract it to the home directory and rename it to .oh-my-zsh
Thus, it should be ~/.oh-my-zsh
-
Save the file
install-oh-my-zsh.shfrom hewerthomn's gist to home directory, i.e.~/install-oh-my-zsh.sh -
Give permission to execute for the script and run it
Run the script
chmod +x install-oh-my-zsh.sh
./install-oh-my-zsh.sh
# set default sh
chsh -s `which zsh`
- append the added config from .bashrc to .zshrc that are resulted from earlier package installation. Note that .zshrc does not read in .bashrc so the config need to be duplicated (which explanis the need for this step)
# nvm setup
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/home/<username>/.sdkman"
[[ -s "/home/<username>/.sdkman/bin/sdkman-init.sh" ]] && source "/home/<username>/.sdkman/bin/sdkman-init.sh"
- [Optional] very personal - change theme from robbyrussell to wezm.
Comment ZSH_THEME=robbyrussell and add the following in .zshrc
#ZSH_THEME="robbyrussell"
#ZSH_THEME="powerlevel9k/powerlevel9k"
#ZSH_THEME="agnoster"
#ZSH_THEME="nebirhos"
#ZSH_THEME="norm"
#ZSH_THEME="bira"
ZSH_THEME="wezm"
- Enable useful plugins in .zshrc by searching for
plugins=(...and change it to below:
plugins=(
git command-not-found
)
- Restart by runing
sudo shutdown -r 0
Run the below command or download the git repo for powerline font to certain folder, and run the various command
git clone https://github.com/powerline/fonts.git --depth=1
fonts/install.sh
#resolves issue where terminess pwerline is ignored by default and must be explicitly allowed via fontconfig
mkdir -p ~/.config/fontconfig/conf.d/ && cp fonts/fontconfig/50-enable-terminess-powerline.conf ~/.config/fontconfig/conf.d/
# refresh font cache
fc-cache -vfChange the Terminal profile preference to use Fira Mono for Powerline Regular
If oh-my-zsh is already installed, backup the following files to ~/config_backup and run uninstall_oh_my_zsh
- ~/.oh-my-zsh
- ~/.zshrc
Install zsh if you have not done so.
Run the below command to clone prezto git repos and all submodules to home directory.
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
Remove .zshrc if it exists. Run below command to install prezto
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
Put back all custom configurations, exports, alias from .zshrc (backup) to the new soft-linked .zshrc
Below is a sample of the custom config to be appended back
export EDITOR="vim"
export VISUAL=$EDITOR
export LSCOLORS="Gxfxcxdxbxegedabagacad"
# added by Anaconda2 installer
export PATH="/home/<username>/anaconda2/bin:$PATH"
# nvm setup
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/home/<username>/.sdkman"
[[ -s "/home/<username>/.sdkman/bin/sdkman-init.sh" ]] && source "/home/<username>/.sdkman/bin/sdkman-init.sh"
Modify the .zpreztorc to enable modules and set theme
# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
'environment' \
'terminal' \
'editor' \
'history' \
'history-substring-search' \
'directory' \
'spectrum' \
'utility' \
'tmux' \
'git' \
'completion' \
'command-not-found' \
'syntax-highlighting' \
'prompt' \
# ...
# Set the prompt theme to load.
# Setting it to 'random' loads a random theme.
# Auto set to 'off' on dumb terminals.
#zstyle ':prezto:module:prompt' theme 'sorin'
#zstyle ':prezto:module:prompt' theme 'powerlevel9k'
zstyle ':prezto:module:prompt' theme 'walters'
This provides data science related python packages and development environment. It includes Juypter Notebook.
Download the binary for Anaconda2 (since default python is 2.7) from anaconda.org and run these commands:
chmod +x Anaconda2-5.0.1-Linux-x86_64.sh
bash ~/Downloads/Anaconda2-5.0.1-Linux-x86_64.sh
Remember to copy the same path configuration in .bashrc to .zshrc if zsh is installed
Create a python 3.6 environment with anaconda3 packages installed by running this command (need to be online). For offline, require setting up an offline channel.
conda create -n <environment_name> python=3.6 anaconda
Activate the newly created environment to switch over
Running the following command
wget -m -e robots=off --no-parent --reject="index.html*" http://nodejs.org/dist/
Create directory to house mounted content. i.e. mkdir /media/samba_share
Append the following into fstab and run sudo mount -a
//servername/sharename /media/samba_share cifs uid=1000,iocharset=utf8,vers=2.1 0 0
Alternatively, mount it directly (show param necessary if is v3.0)
sudo mount -t cifs //servername/sharename /media/samba_share -o username=xxx,uid=1000,vers=3.0,sec=ntlm- append -vvv flag to see detailed trace of what is causing the delay or pause
ssh -vvv user@servername:/pathsProblem could be on server or client.
Check for:
- reverse DNS lookup timeout
Turn off reverse DNS lookup on server (it's use for diagnose breakin attempt only). add UseDNS no to /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config
grep -i dns /etc/ssh/sshd_config
systemctl sshd restart- GSSAPI authentication timeout on client
Turn off by adding the line GSSAPIAuthentication no to /etc/ssh/ssh_config or ~/.ssh/config (on client side)
https://robots.thoughtbot.com/a-tmux-crash-course https://github.com/sorin-ionescu/prezto http://mikebuss.com/2014/02/02/a-beautiful-productive-terminal-experience/