Skip to content

Instantly share code, notes, and snippets.

@Liam-Deacon
Last active June 17, 2024 05:46
Show Gist options
  • Save Liam-Deacon/c9ffd1b434332f8cd9bbce5de2a45d49 to your computer and use it in GitHub Desktop.
Save Liam-Deacon/c9ffd1b434332f8cd9bbce5de2a45d49 to your computer and use it in GitHub Desktop.
My WSL Setup
# run from Anaconda prompt (Windows) or activate conda environment (Linux)
# set up default channels
conda config --append channels
conda config --append channels pytorch
conda config --append channels conda-forge
conda config --append channels anaconda
# other config settings
conda config --set auto_update_conda True
# install packages
conda install r-essentials r-base -y
conda install -c biobuilds perl -y
conda install --channel https://conda.anaconda.org/menpo opencv3 # opencv
conda install -c conda-forge cling octave_kernel octave jupyterlab-git beakerx go texlive jupyter_latex_envs -y
conda install -c conda-forge fortran-compiler
conda install -c auto fortranformat
conda install -c anaconda openjdk -y
conda install -c conda-forge cmake make automake autoconf -y
conda install -c doxygen -y
conda install pytorch-cpu torchvision-cpu -c pytorch
conda install -c conda-forge julia
pip install numpy scipy pandas scikit-learn cython pyod pandas matplotlib statsmodels theano keras scikit-image scikit-plot
pip install fortran-magic jupyter-fortran-kernel
conda install -c conda-forge nodejs bower gulp
conda install -c conda-forge typescript
echo 'export PATH=~/bin:/usr/local/bin:/usr/bin/:$PATH' >> ~/.bashrc
echo 'export DISPLAY=:0' >> ~/.bashrc
echo 'export BROWSER=$(which firefox || which chrome || which chromium || which edge)' >> ~/.bashrc
source ~/.bashrc
# some dirty hacks for browser support
sudo ln -s "$(find /mnt/c/ -name firefox.exe -print -quit 2>/dev/null)" /usr/local/bin/firefox
sudo ln -s "$(find /mnt/c/ -name chrome.exe -print -quit 2>/dev/null)" /usr/local/bin/chrome
sudo ln -s "$(find /mnt/c/ -name MicrosoftEdge.exe -print -quit 2>/dev/null)" /usr/local/bin/edge
# workaround for dbus issue
sudo apt-get install -y python3-dbus
sudo dbus-uuidgen --ensure
# update package list
sudo apt-get update
sudo apt-get install -y dirmngr
# install most used packages
sudo apt-get install -y vim unzip samba git expect
sudo apt-get install -y make automake autoconf autotools-dev m4 gfortran g++ gdb doxygen libcppunit-dev libboost-dev valgrind
sudo apt-get install -y build-essential cmake gfortran git pkg-config
sudo apt-get install -y python-dev software-properties-common wget vim
sudo apt-get install -y qt5-qmake libqt5* # qt5
sudo apt-get install -y golang-go # golang
sudo apt-get install -y default-jdk # java
sudo apt-get install -y r-base r-recommended
sudo apt-get install -y octave octave-zenity octave-strings octave-struct octave-signal octave-splines octave-specfun \
octave-optiminterp octave-optim octave-odepkg octave-miscellaneous octave-linear-algebra \
octave-io octave-image octave-general octave-geometry octave-dataframe octave-data-smoothing mwrap
sudo apt-get install -y python3-dev python3-pip python3-wheel python3-virtualenv python3-cffi \
python3-pandas python3-numpy python3-scipy python3-matplotlib python3-sklearn python3-mpltoolkits.basemap \
python3-sympy python3-plotly python3-seaborn python3-statsmodels python3-networkx \
python3-bson python3-bson-ext python3-pymongo python3-pymongo-ext python3-mongoengine python3-motor \
python3-keras python3-nltk python3-networkx python3-theano python3-lasagne \
python3-dill python3-dsv python3-glob2 python3-reportlab python3-simplejson python3-dateutil \
python3-scrapy python3-pydot python3-pydotplus python3-bs4 python3-graphviz \
python3-geopy python3-geopandas python3-geojson python3-grib python3-h5py python3-hdf5storage \
python3-six python3-voluptuous python3-arrow python3-envparse \
python3-json-tricks python3-jsonpickle python3-marshmallow python3-measurement python3-multidict \
python3-mock python3-mutagen python3-netcdf4 python3-openpyxl python3-parse python3-pilkit python3-png \
python3-pytest python3-nose python3-mypy python3-pylama python3-pyflakes python3-pytest-pylint \
python3-pyfits python3-pylama python3-pyopencl python3-pypandoc python3-pypdf2 python3-schema \
python3-soundfile python3-smbus python3-usb python3-sqlalchemy python3-pil python3-sklearn-pandas \
python3-jinja2 python3-flask python3-sphinx python3-docutils python3-psutil
sudo apt-get install -y libudev-dev libspeex-dev libpulse0
sudo apt-get install -y alsa-tools alsa-utils # audio
sudo apt-get install -y vlc mplayer ffmpeg mencoder x265 # video encoding
sudo apt-get install -y proj-bin libgeos-dev libproj-dev libeccodes-dev libeccodes0 # geospatial, weather, etc.
sudo apt-get install -y imagemagick ghostscript psutils groff latexmk texlive-xetex texlive-fonts-recommended fonts-mathjax
sudo apt-get install -y gnat gnat-gps gprbuild # ada
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common # for docker
sudo apt-get install -y nodejs npm mongodb mongodb-server mongodb-dev mongo-tools # mean stack related
sudo npm install -g bower grunt-cli yarn @angular/cli
# Set python interpreter
PYTHON3=`which python3`
PYTHON=$PYTHON3
# python development tools
sudo -H `which python3` -m pip install twine lxml pyyaml requests colorama beautifulsoup4 psutil opencv-python \
xlparser csvxls pyheaderfile convert2json csv-to-dictionary csvutils csv2dict \
magics cython numba \
simpleml mlkit milk geolearn
# Install Docker
sudo apt-get update -y && sudo apt-get install -y 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 -y
sudo apt-get install -y docker-ce
sudo usermod -aG docker $USER
sudo -H `which python3` -m pip install --user docker-compose
echo "export DOCKER_HOST=tcp://localhost:2375" >> ~/.bashrc && source ~/.bashrc
# machine learning tools
sudo apt-get install -y caffe-cpu python3-caffe-cpu # python3-caffe-gpu caffe-gpu
sudo -H `which python3` -m pip install bokeh eli5 xgboost catboost lightgbm gensim spacy pyod \
scikit-vis scikit-learn statsmodels seaborn pydot xgboost eli5 nltk gensim scrapy
sudo -H `which python3` -m pip install tensorflow tensorflow-model tensorflow-utils tensorflow-probability \
tensorflow-datasets tensorflow-plot tensorflow-estimator \
tensorflow-template tensorflow-metadata tfdebugger tensorpack json-nn
PYTHON3_PLATFORM=$(python3 -c "import distutils.util; print(distutils.util.get_platform().replace('-', '_'))")
PYTHON3_VERSION=$(python3 -c "import sys; print('cp' + ''.join(map(str, sys.version_info[:2])))")
PYTORCH_VERSION='0.4.1'
sudo -H `which python3` -m pip install pytorch || ( \
sudo -H `which python3` -m pip install http://download.pytorch.org/whl/cpu/torch-${PYTORCH_VERSION}-${PYTHON3_VERSION}-${PYTHON3_VERSION}m-${PYTHON3_PLATFORM}.whl && \
sudo -H `which python3` -m pip install torchvision)
# python3.7
sudo apt-get install -y python3.7 python3.7-venv
### Kaldi for speech recognition
sudo apt-get install autoconf automake cmake curl g++ git graphviz \
libatlas3-base libtool make pkg-config subversion unzip wget zlib1g-dev
sudo -H `which python3` -m pip install pyparsing ninja
sudo -H `which python3` -m pip install git+https://github.com/pykaldi/pykaldi
## Bash kernel ##
KERNEL_SYS_PREFIX=/usr/local/share/jupyter/kernels/ # system prefix for jupyter kernels
sudo -H `which python3` -m pip install bash_kernel
`which python3` -m bash_kernel.install # normal user
sudo mkdir -p $KERNEL_SYS_PREFIX
sudo mv ~/.local/share/jupyter/kernels/bash ${KERNEL_SYS_PREFIX}
## Octave ##
sudo -H `which python3` -m pip install octave_kernel
sudo -H `which python3` -m octave_kernel install
## Rust ##
cd ~/ && wget https://static.rust-lang.org/rustup.sh && \
chmod +x rustup.sh && \
./rustup.sh -y && \
rm -f ./rustup.sh && \
cd - && \
source ~/.cargo/env && \
cargo install evcxr_jupyter && \
evcxr_jupyter --install
## Elixir ##
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get install -y elixir
#mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez
git clone https://github.com/pprzetacznik/IElixir.git
cd IElixir/ && mix local.hex --force && mix deps.get -y && mix test && MIX_ENV=prod mix compile && \
mix local.rebar --force && ./install_script.sh
## Erlang ##
cd ~/
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb && rm erlang-solutions_1.0_all.deb
sudo apt-get update && sudo apt-get install -y esl-erlang
git clone http://github.com/robbielynch/ierlang.git
cd ierlang/
git clone http://github.com/zeromq/erlzmq2.git
cd erlzmq2
mix local.rebar
make
make test
## Jython ##
sudo apt install -y jython
sudo -H `which python3` -m pip install git+https://github.com/suvarchal/IJython
## MongoDB ##
sudo apt-get install -y llvm-8
sudo ln -s /usr/bin/llvm-config-8 /usr/bin/llvm-config
export LLVM_CONFIG=/usr/bin/llvm-config-8
sudo -H `which python3` -m pip install orange3
sudo -H `which python3` -m pip install imongo-kernel
## PHP ##
sudo apt-get install -y php php-zmq curl php-cli php-mbstring git unzip
cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
wget https://litipk.github.io/Jupyter-PHP-Installer/dist/jupyter-php-installer.phar
chmod +x ./jupyter-php-installer.phar && php ./jupyter-php-installer.phar install
## Powershell core ##
wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -sr)/packages-microsoft-prod.deb && \
sudo dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb && \
sudo apt-get update && sudo apt-get install -y powershell
## Mono & DotNet core ##
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xEB3E94ADBE1229CF" | sudo apt-key add
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" | sudo apt-key add
echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
curl https://download.mono-project.com/repo/xamarin.gpg | sudo apt-key add -
sudo apt update
sudo apt-get install -y mono-devel mono-complete #referenceassemblies-pcl ca-certificates-mono mono-xsp4
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg && \
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -sr)/prod.list && \
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list && \
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg && \
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list && \
sudo apt-get update && sudo apt-get install -y apt-transport-https dotnet-sdk-2*
sudo apt-get install -y fsharp nuget
## Setup Jupyter
sudo `which python3` -m pip install jupyterlab fortranmagic oct2py rpy2 \
jupyterlab_git yamlmagic \
jupyter-fortran-kernel octave_kernel bash_kernel ipywidgets bokeh plotly
which jupyter || (echo '$0-$1 $* || python3 -m jupyter $*' | sudo tee /usr/local/bin/jupyter && sudo chmod ug+x /usr/local/bin/jupyter)
sudo -H `which python3` -m pip uninstall prompt-toolkit -y && sudo -H python3 -m pip install prompt-toolkit==1.0.15 # fix broken prompt-toolkit
jupyter nbextension enable --py widgetsnbextension
jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab_bokeh
jupyter labextension install @jupyterlab/git @jupyterlab/toc @jupyterlab/latex @jupyterlab/mp4 \
@jupyterlab/plotly-extension @jupyterlab/shortcutui
git clone https://github.com/jupyterlab/jupyterlab-mp4
jupyter labextension install jupyterlab-mp4
jupyter labextension enable jupyterlab_bokeh jupyterlab_git
jupyter serverextension enable --py jupyterlab_git
jupyter labextension install jupyterlab-system-monitor jupyterlab-kernelspy \
jupyterlab-flake8 jupyterlab-drawio jupyterlab-nbmetadata jupyterlab_toastify jupyterlab_conda \
jupyterlab_commands jupyterlab_autoversion jupyterlab-easygit jupyterlab_hidecode # jupyterlab-spreadsheet
# add dash for jupyterlab
sudo -H `which python3` -m pip install aiohttp jupyter jupyter-plotly-dash
jupyter serverextension enable nbserverproxy
jupyter serverextension enable jupyter_plotly_dash.serverext
## install python 2.7 kernel
sudo apt-get install -y python-pip python-numpy python-scipy python-matplotlib python-pillow
python2 -m pip install --upgrade setuptools --user python2
python2 -m pip install --upgrade ipykernel --user
python2 -m ipykernel install --user # register Python 2 kernel
## install JVM kernels
sudo -H `which python3` -m pip install beakerx
sudo sed -i 's/jupyter", "/jupyter-/g' /usr/local/lib/python3.6/dist-packages/beakerx/install.py
sudo -H beakerx install
## install other kernels
sudo -H `which python3` -m pip install git+https://github.com/gusthoff/jupyter-ada-kernel # ada kernel
sudo -H `which python3` -m pip install git+https://github.com/brendan-rius/jupyter-c-kernel
sudo -H install_c_kernel --sys-prefix
sudo -H install_ada_kernel --sys-prefix
## Ruby ##
sudo apt install -y libtool libffi-dev ruby ruby-dev make libzmq3-dev libczmq-dev
sudo -H gem install cztop
sudo -H gem install iruby --pre
iruby register #--force
sudo mkdir -p /usr/local/share/jupyter/kernels
sudo mv ~/.local/share/jupyter/kernels/iruby /usr/local/share/jupyter/kernels
## Julia ##
INSTALL_PREFIX=/usr/local/
OS_TYPE="$(uname -s | tr '[:upper:]' '[:lower:]')"
JULIA_REPO="https://julialang-s3.julialang.org/bin/${OS_TYPE}/x64/"
JULIA_VERSION=1.3
JULIA_RELEASE="julia-1.3.0"
cd ~/
wget -O julia-${JULIA_VERSION}.tar.gz "${JULIA_REPO}${JULIA_VERSION}/${JULIA_RELEASE}-${OS_TYPE}-$(uname -i).tar.gz"
tar -xzf julia-${JULIA_VERSION}.tar.gz && rm julia-${JULIA_VERSION}.tar.gz
cd julia-${JULIA_VERSION}*
sudo cp -rvn bin/ etc/ include/ lib/ share/ ${INSTALL_PREFIX} # install files
cd - && rm -rf julia-${JULIA_VERSION} # clean up
echo -e "using Pkg\nPkg.add(\"IJulia\"); using IJulia; notebook()" | sudo -H ${INSTALL_PREFIX}/bin/julia # install IJulia kernel
## Ansible ##
sudo -H `which python3` -m pip install ansible-kernel
sudo -H `which python3` -m ansible_kernel.install --sys.prefix
## Typescript ##
sudo -H npm install -g itypescript && sudo -H its --install=global
sudo npm install -g ijavascript && sudo -H ijsinstall --install=global
## xonsh
sudo -H `which python3` -m pip install xonsh_kernel
sudo -H `which python3` -m xonsh_kernel.install --sys-prefix
## Powershell ##
sudo -H `which python3` -m pip install powershell_kernel && \
sudo `which python3` -m powershell_kernel.install --sys-prefix
## gnuplot ##
sudo apt install -y gnuplot
sudo -H `which python3` -m pip install gnuplot_kernel && \
sudo `which python3` -m gnuplot_kernel install --sys-prefix
## iperl6 ##
sudo apt-get install build-essential git libssl-dev
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x379CE192D401AB61" | sudo apt-key add
echo "deb https://dl.bintray.com/nxadm/rakudo-pkg-debs `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list.d/rakudo-pkg.list
curl https://dl.bintray.com/nxadm/rakudo-pkg-debs/dists/`lsb_release -cs`/Release.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install rakudo-pkg
sudo ln -s /opt/rakudo-pkg/bin/* /usr/local/bin/
sudo zef install Jupyter::Kernel
cd ~/ && git clone https://github.com/bduggan/p6-jupyter-kernel && cd p6-jupyter-kernel && \
sudo bin/jupyter-kernel.p6 --generate-config --location=/usr/local/share/jupyter/kernels/perl6 && \
cd -
## Fortran ##
git clone https://github.com/ZedThree/jupyter-fortran-kernel.git
cd jupyter-fortran-kernel && sudo -H `which python3` -m pip install -e . && \
sudo jupyter-kernelspec install fortran_spec/ --sys-prefix && cd .. && rm -rf jupyter-fortran-kernel
## Fsharp ##
mkdir ~/ifsharp && cd ~/ifsharp && wget https://github.com/fsprojects/IfSharp/releases/download/v3.0.1/IfSharp.v3.0.1.zip &&
unzip IfSharp*.zip && chmod +x ifsharp.exe && mono ifsharp.exe && \
fsharp=$(jupyter-kernelspec list 2>/dev/null | grep ifsharp | tr -s ' ' | sed 's/^ //g' | cut -d ' ' -f2) && \
sudo mv $fsharp /usr/local/share/jupyter/kernels/ && \
cp ifsharp.exe /usr/local/share/jupyter/kernels/ifsharp/ && \
sudo sed -i -E "s|mono\", \".*ifsharp.exe\"|mono\", \"${ifsharp}/ifsharp.exe\"|g" /usr/local/share/jupyter/kernels/ifsharp/kernel.json
&& cd -
## Haskell ##
sudo apt-get install -y python3-pip git libtinfo-dev libzmq3-dev libcairo2-dev \
libpango1.0-dev libmagic-dev libblas-dev liblapack-dev
cd ~/ && curl -sSL https://get.haskellstack.org/ | sh
git clone https://github.com/gibiansky/IHaskell
cd IHaskell
sudo -H `which python3` -m pip install $(sed -E 's/==.*//g' requirements.txt | tr '\n' ' ')
stack install gtk2hs-buildtools
stack install --fast
ihaskell install --stack
jupyter-labextension install ihaskell_jupyterlab
sudo mv ~/.jupyter/share/kernels/ihaskell* /usr/local/share/jupyter/kernels/
cd -
sudo -H `which python3` -m pip uninstall prompt-toolkit -y && sudo -H python3 -m pip install prompt-toolkit==1.0.15 # fix broken prompt-toolkit
## cling ##
sudo apt-get install -y libzmqpp-dev
cd ~/ && mkdir cling && cd cling && \
wget https://raw.githubusercontent.com/root-project/cling/master/tools/packaging/cpt.py && \
chmod +x cpt.py && \ echo -e 'yes\n' | ./cpt.py --check-requirements
#./cpt.py --create-dev-env Debug--with-workdir=./cling-build/
CLING_VERSION=2019-12-12
CLING_DISTRIBUTION="$(lsb_release -si | tr '[:upper:]' '[:lower:]')$(lsb_release -sr | cut -d '.' -f1)"
wget https://root.cern.ch/download/cling/cling_${CLING_VERSION}_${CLING_DISTRIBUTION}.tar.bz2
tar -xjf cling*.tar.bz2
cd cling_${CLING_VERSION}_${CLING_DISTRIBUTION}/share/cling/Jupyter/kernel
`which python3` setup.py build bdist_wheel && sudo jupyter-kernelspec install --sys-prefix cling-cpp*
cd -
sudo -H `which python3` -m pip install cling_${CLING_VERSION}_${CLING_DISTRIBUTION}/share/cling/Jupyter/kernel/dist/*.whl
sudo mv cling_${CLING_VERSION}_${CLING_DISTRIBUTION} /opt/
sudo ln -s /opt/cling_${CLING_VERSION}_${CLING_DISTRIBUTION} /opt/cling
sudo ln -s /opt/cling/bin/cling /usr/local/bin/
cd -
## icsharp ##
sudo apt-get install -y dos2unix
cd ~ && git clone --recursive https://github.com/zabirauf/icsharp.git && \
cd icsharp && dos2unix ./build.sh && dos2unix Engine/build.sh && \
sudo mozroots --import --machine --sync && \
echo -e 'y\ny\ny' | sudo certmgr -ssl -m https://go.microsoft.com && \
echo -e 'y\ny\ny' | sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net && \
echo -e 'y\ny\ny' | sudo certmgr -ssl -m https://nuget.org && \
cp .nuget/NuGet.exe Engine/.nuget/NuGet.exe && \
bash ./build.sh && cp -r kernel-spec/ icsharp && cp -r Kernel/ icsharp/ && \
sed -i -E 's|<INSTALL_PATH>|/usr/local/share/jupyter/kernels|g' icsharp/kernel.json && \
sudo jupyter-kernelspec install icsharp --sys-prefix && cd -
## gophernotes ##
sudo apt-get install -y libzmq3-dev libczmq-dev libczmq4
go get golang.org/x/tools/cmd/goimports
go get github.com/gophergala2016/gophernotes
sudo cp ~/go/bin/gophernotes /usr/local/bin/
sudo mkdir -p /usr/local/share/jupyter/kernels/gophernotes
sudo mv ${GOPATH:-$(go env GOPATH)}/src/github.com/gophergala2016/gophernotes/kernel/* /usr/local/share/jupyter/kernels/gophernotes/
## fortran co-array
# cd ~ && git clone https://github.com/sourceryinstitute/jupyter-CAF-kernel
# cd prebuild/jupyter-caf-kernel
# python3 build bdist_wheel
# sudo -H python3 -m pip install dist/*.whl
# sudo -H jupyter-kernelspec install Coarray-Fortran/ --sys-prefix
# cd ~
## latex ##
sudo apt-get install -y texlive-base texlive-xetex pandoc texlive-science texlive-latex-recommended \
texlive-extra-utils texlive-latex-extra search-ccsb bibtexconv bibtex2html bibclean bibus bibutils
sudo -H `which python3` -m pip install jupyterlab_latex
jupyter labextension install @jupyterlab/latex
jupyter serverextension enable --sys-prefix jupyterlab_latex
# setup IRKernel
sudo apt-get install r-base r-recommended r-cran-caret r-cran-dplyr r-cran-dt r-cran-ggvis r-cran-git2r \
r-cran-ggplot2 r-cran-gbm r-cran-hdf5 r-cran-isocodes r-cran-jsonlite r-cran-isoweek r-cran-its \
r-cran-iterators r-cran-knitr r-cran-lambda.r r-cran-lattice r-cran-latticeextra r-cran-maps \
r-cran-matrix r-cran-markdown r-cran-plotly r-cran-randomforest \
r-cran-rpostgresql r-cran-rmysql r-cran-rsqlite r-cran-xml2 r-cran-yaml
echo "install.packages('IRkernel'); IRkernel::installspec(user = FALSE)" | sudo R --save
echo """install.packages(c('tidyverse', 'data.table', 'lubridate',
'corrplot', 'rcharts', 'slidify', 'mlr', 'xgboost', 'prophet', 'randomforest'));""" | sudo R --save
# add vscode
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sudo apt-get update && sudo apt-get install code
for ext in $(echo -e """aeschli.vscode-css-formatter
batisteo.vscode-django
christian-kohler.path-intellisense
CodeStream.codestream
DavidAnson.vscode-markdownlint
dbaeumer.vscode-eslint
donjayamanne.jupyter
donjayamanne.python-extension-pack
DotJoshJohnson.xml
DSKWRK.vscode-generate-getter-setter
emilast.LogFileHighlighter
Entomy.ada
Equinusocio.vsc-material-theme
formulahendry.code-runner
formulahendry.terminal
glen-84.sass-lint
GrapeCity.gc-excelviewer
jasonnutter.search-node-modules
magicstack.MagicPython
mitaki28.vscode-clang
mohsen1.prettify-json
ms-python.anaconda-extension-pack
ms-python.python
ms-toolsai.vscode-ai
ms-vscode.azure-account
ms-vscode.cpptools
ms-vscode.csharp
ms-vsliveshare.vsliveshare
PKief.material-icon-theme
rogalmic.bash-debug
sdras.vue-vscode-snippets
shardulm94.trailing-spaces
sidthesloth.html5-boilerplate
slevesque.vscode-hexdump
slevesque.vscode-zipexplorer
Tyriar.shell-launcher
vector-of-bool.cmake-tools
VisualStudioExptTeam.vscodeintellicode
waderyan.nodejs-extension-pack
wayou.vscode-todo-highlight
wholroyd.jinja""" | tr -s ' ' | tr ' ' '\n' ); do
code --install-extension $ext;
done
# set git config
git config --global core.autocrlf true
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
git config --global alias.visual '!code'
# open files in windows explorer using wsl-open
sudo npm install -g wsl-open
# Anaconda
# Go to home directory
cd ~
# You can change what anaconda version you want at
# https://repo.continuum.io/archive/
ANACONDA_VERSION="2019.03-Linux-x86_64"
wget https://repo.anaconda.com/archive/Anaconda3-${VERSION}.sh
bash Anaconda3--${VERSION}.sh -b -p ~/anaconda
rm Anaconda3--${VERSION}.sh
echo 'export PATH="~/anaconda/bin:$PATH"' >> ~/.bashrc
source .bashrc
conda update conda
conda install shapely geopandas pyproj
# RISE
conda install -y -c conda-forge rise
## Azure
sudo apt-get install apt-transport-https lsb-release software-properties-common dirmngr -y
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xBC528686B50D79E339D3721CEB3E94ADBE1229CF" | sudo apt-key add
sudo apt-get update && sudo apt install azure-cli
## Redis
sudo apt-get install -y redis libhiredis-dev python3-aioredis python3-hiredis
sudo -H `which python3` -m pip install hiredis redis
# A compilation of Jupyter kernels for DataScience
# Copyright (c) Light Bytes Technology Ltd.
# Distributed under the terms of the Modified BSD License.
ARG BASE_CONTAINER=jupyter/tensorflow-notebook
FROM $BASE_CONTAINER
LABEL maintainer="Liam Deacon <[email protected]>"
# Install
# update package list
RUN apt-get update
# install most used packages
RUN apt-get install -y dirmngr unzip samba git expect dos2unix \
make automake autoconf autotools-dev m4 gfortran g++ gcc gdb \
build-essential libssl-dev \
doxygen libcppunit-dev libboost-dev valgrind \
build-essential cmake gfortran git pkg-config \
python-dev software-properties-common wget \
libtinfo-dev libzmqpp-dev libzmq3-dev libcairo2-dev libpango1.0-dev libmagic-dev libblas-dev liblapack-dev \
golang-go libczmq-dev libczmq4 \
default-jdk \
gnuplot \
r-base r-recommended \
octave octave-zenity octave-strings octave-struct octave-signal octave-splines octave-specfun \
octave-optiminterp octave-optim octave-odepkg octave-miscellaneous octave-linear-algebra \
octave-io octave-image octave-general octave-geometry octave-dataframe octave-data-smoothing mwrap \
python3-dev python3-pip python3-wheel python3-virtualenv python3-cffi \
python3-pandas python3-numpy python3-scipy python3-matplotlib python3-sklearn python3-mpltoolkits.basemap \
python3-sympy python3-plotly python3-seaborn python3-statsmodels python3-networkx \
python3-bson python3-bson-ext python3-pymongo python3-pymongo-ext python3-mongoengine python3-motor \
python3-keras python3-nltk python3-networkx python3-theano python3-lasagne \
python3-dill python3-dsv python3-glob2 python3-reportlab python3-simplejson python3-dateutil \
python3-scrapy python3-pydot python3-pydotplus python3-bs4 python3-graphviz \
python3-geopy python3-geopandas python3-geojson python3-grib python3-h5py python3-hdf5storage \
python3-six python3-voluptuous python3-arrow python3-envparse \
python3-json-tricks python3-jsonpickle python3-marshmallow python3-measurement python3-multidict \
python3-mock python3-mutagen python3-netcdf4 python3-openpyxl python3-parse python3-pilkit python3-png \
python3-pytest python3-nose python3-mypy python3-pylama python3-pyflakes python3-pytest-pylint \
python3-pyfits python3-pylama python3-pyopencl python3-pypandoc python3-pypdf2 python3-schema \
python3-soundfile python3-smbus python3-usb python3-sqlalchemy python3-pil python3-sklearn-pandas \
python3-jinja2 python3-flask python3-sphinx python3-docutils python3-psutil \
caffe-cpu python3-caffe-cpu \
alsa-tools alsa-utils \
ffmpeg mencoder x265 \
imagemagick ghostscript psutils groff latexmk texlive-xetex texlive-fonts-recommended fonts-mathjax \
gnat gnat-gps gprbuild \
apt-transport-https ca-certificates curl gnupg-agent software-properties-common \
nodejs npm mongodb mongodb-server mongodb-dev mongo-tools
RUN npm install -g bower grunt-cli yarn @angular/cli
# python development tools
RUN python3 -m pip install twine lxml pyyaml requests colorama beautifulsoup4 psutil opencv-python \
xlparser csvxls pyheaderfile convert2json csv-to-dictionary csvutils csv2dict \
magics cython numba \
simpleml mlkit milk geolearn \
bokeh eli5 xgboost catboost lightgbm gensim spacy chainer mxnet \
jupyterlab fortranmagic oct2py rpy \
jupyterlab_git \
jupyter-fortran-kernel octave_kernel bash_kernel xonsh_kernel gnuplot_kernel ipywidgets \
beakerx \
git+https://github.com/gusthoff/jupyter-ada-kernel \
git+https://github.com/brendan-rius/jupyter-c-kernel
tensorflow tensorflow-model tensorflow-utils tensorflow-probability \
tensorflow-datasets tensorflow-plot tensorflow-estimator \
tensorflow-template tensorflow-metadata tfdebugger tensorpack json-nn
PYTHON3_PLATFORM=$(python3 -c "import distutils.util; print(distutils.util.get_platform().replace('-', '_'))")
PYTHON3_VERSION=$(python3 -c "import sys; print('cp' + ''.join(map(str, sys.version_info[:2])))")
PYTORCH_VERSION='0.4.1'
sudo -H python3 -m pip install pytorch || ( \
sudo -H python3 -m pip install http://download.pytorch.org/whl/cpu/torch-${PYTORCH_VERSION}-${PYTHON3_VERSION}-${PYTHON3_VERSION}m-${PYTHON3_PLATFORM}.whl && \
sudo -H python3 -m pip install torchvision)
# Powershell, Mono & DotNet core
RUN wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -sr)/packages-microsoft-prod.deb && \
dpkg -i packages-microsoft-prod.deb && rm packages-microsoft-prod.deb
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
RUN echo "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" | tee /etc/apt/sources.list.d/mono-official-stable.list
RUN curl https://download.mono-project.com/repo/xamarin.gpg | sudo apt-key add -
RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg && \
RUN mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
RUN wget -q https://packages.microsoft.com/config/ubuntu/$(lsb_release -sr)/prod.list && \
mv prod.list /etc/apt/sources.list.d/microsoft-prod.list && \
chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg && \
chown root:root /etc/apt/sources.list.d/microsoft-prod.list
RUN apt update
RUN apt-get install -y powershell mono-devel mono-complete \ # referenceassemblies-pcl ca-certificates-mono mono-xsp4
fsharp nuget apt-transport-https dotnet-sdk-2*
# setup jupyter
which jupyter || (echo '$0-$1 $* || python3 -m jupyter $*' | sudo tee /usr/local/bin/jupyter && sudo chmod ug+x /usr/local/bin/jupyter)
RUN python3 -m pip uninstall prompt-toolkit -y && python3 -m pip install prompt-toolkit==1.0.15 # fix broken prompt-toolkit
RUN jupyter nbextension enable --py widgetsnbextension
RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager
RUN jupyter labextension install jupyterlab_bokeh
RUN jupyter labextension install @jupyterlab/git @jupyterlab/toc @jupyterlab/latex @jupyterlab/mp4 \
@jupyterlab/plotly-extension @jupyterlab/shortcutui
RUN jupyter labextension enable jupyterlab_bokeh jupyterlab_git
RUN jupyter serverextension enable --py jupyterlab_git
RUN jupyter labextension install jupyterlab-system-monitor jupyterlab-kernelspy \
jupyterlab-flake8 jupyterlab-drawio jupyterlab-nbmetadata jupyterlab_toastify \
jupyterlab_commands jupyterlab_autoversion jupyterlab_hidecode # jupyterlab-spreadsheet
# install JVM kernels
RUN sed -i 's/jupyter", "/jupyter-/g' /usr/local/lib/python3.6/dist-packages/beakerx/install.py
RUN beakerx install
# install other kernels
RUN install_c_kernel --sys-prefix
RUN install_ada_kernel --sys-prefix
# typescript
RUN npm install -g itypescript && its --ts-install=global
RUN npm install -g ijavascript && ijsinstall --install=global
# xonsh
RUN python3 -m xonsh_kernel.install --sys-prefix
# powershell
RUN python3 -m pip install powershell_kernel
RUN python3 -m powershell_kernel.install --sys-prefix
# gnuplot kernel
RUN python3 -m gnuplot_kernel install --sys-prefix
# iperl6
RUN curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x379CE192D401AB61" | sudo apt-key add
RUN echo "deb https://dl.bintray.com/nxadm/rakudo-pkg-debs `lsb_release -cs` main" | sudo tee -a /etc/apt/sources.list.d/rakudo-pkg.list
RUN curl https://dl.bintray.com/nxadm/rakudo-pkg-debs/dists/`lsb_release -cs`/Release.gpg | sudo apt-key add -
RUN apt-get update && apt-get install rakudo-pkg
RUN ln -s /opt/rakudo-pkg/bin/* /usr/local/bin/
RUN zef install Jupyter::Kernel
RUN cd ~/ && git clone https://github.com/bduggan/p6-jupyter-kernel && cd p6-jupyter-kernel && \
RUN bin/jupyter-kernel.p6 --generate-config --location=/usr/local/share/jupyter/kernels/perl6 && \
RUN cd -
RUN git clone https://github.com/ZedThree/jupyter-fortran-kernel.git && \
cd jupyter-fortran-kernel && sudo -H python3 -m pip install -e . && \
jupyter-kernelspec install fortran_spec/ --sys-prefix && cd .. && rm -rf jupyter-fortran-kernel
# Fsharp
RUN mkdir ~/ifsharp && \
cd ~/ifsharp && \
wget https://github.com/fsprojects/IfSharp/releases/download/v3.0.1/IfSharp.v3.0.1.zip &&
unzip IfSharp*.zip && chmod +x ifsharp.exe && mono ifsharp.exe && \
fsharp=$(jupyter-kernelspec list 2>/dev/null | grep ifsharp | tr -s ' ' | sed 's/^ //g' | cut -d ' ' -f2) && \
mv $fsharp /usr/local/share/jupyter/kernels/ &&
cp ifsharp.exe /usr/local/share/jupyter/kernels/ifsharp/ && \
sed -iE "s|mono\", \".*ifsharp.exe\"|mono\", \"${ifsharp}/ifsharp.exe\"|g" /usr/local/share/jupyter/kernels/ifsharp/kernel.json && \
cd -
# Haskell
RUN cd ~/ && curl -sSL https://get.haskellstack.org/ | sh
RUN git clone https://github.com/gibiansky/IHaskell && \
cd IHaskell && \
python3 -m pip install $(sed -E 's/==.*//g' requirements.txt | tr '\n' ' ') && \
stack install gtk2hs-buildtools && \
stack install --fast && \
ihaskell install --stack
RUN jupyter labextension install ihaskell_jupyterlab
RUN mv ~/.jupyter/share/kernels/ihaskell* /usr/local/share/jupyter/kernels/
cd -
RUN python3 -m pip uninstall prompt-toolkit -y && python3 -m pip install prompt-toolkit==1.0.15 # fix broken prompt-toolkit
# cling
RUN cd ~/ && mkdir cling && cd cling && \
wget https://raw.githubusercontent.com/root-project/cling/master/tools/packaging/cpt.py && \
chmod +x cpt.py && \ echo -e 'yes\n' | ./cpt.py --check-requirements && \
CLING_VERSION=2018-11-27
CLING_DISTRIBUTION="$(lsb_release -si | tr '[:upper:]' '[:lower:]')$(lsb_release -sr | cut -d '.' -f1)"
RUN wget https://root.cern.ch/download/cling/cling_${CLING_VERSION}_${CLING_DISTRIBUTION}.tar.bz2
tar -xjf cling*.tar.bz2
cd cling_${CLING_VERSION}_${CLING_DISTRIBUTION}/share/cling/Jupyter/kernel
python3 setup.py build bdist_wheel && sudo jupyter-kernelspec install --sys-prefix cling-cpp*
cd -
RUN python3 -m pip install cling_${CLING_VERSION}_${CLING_DISTRIBUTION}/share/cling/Jupyter/kernel/dist/*.whl
RUN mv cling_${CLING_VERSION}_${CLING_DISTRIBUTION} /opt/
RUN ln -s /opt/cling_${CLING_VERSION}_${CLING_DISTRIBUTION} /opt/cling
RUN ln -s /opt/cling/bin/cling /usr/local/bin/
RUN cd -
# icsharp
RUN cd ~ && git clone --recursive https://github.com/zabirauf/icsharp.git && \
cd icsharp && dos2unix ./build.sh && dos2unix Engine/build.sh &&
mozroots --import --machine --sync && \
echo -e 'y\ny\ny' | sudo certmgr -ssl -m https://go.microsoft.com && \
echo -e 'y\ny\ny' | sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net && \
echo -e 'y\ny\ny' | sudo certmgr -ssl -m https://nuget.org && \
cp .nuget/NuGet.exe Engine/.nuget/NuGet.exe && \
bash ./build.sh && cp -r kernel-spec/ icsharp && cp -r Kernel/ icsharp/ && \
sed -iE 's|<INSTALL_PATH>|/usr/local/share/jupyter/kernels|g' icsharp/kernel.json && \
jupyter kernelspec install icsharp --sys-prefix && cd -
# gophernotes
RUN go get golang.org/x/tools/cmd/goimports
RUN go get github.com/gophergala2016/gophernotes
RUN cp ~/go/bin/gophernotes /usr/local/bin/ && \
mkdir -p /usr/local/share/jupyter/kernels/gophernotes && \
mv ${GOPATH:-$(go env GOPATH)}/src/github.com/gophergala2016/gophernotes/kernel/* /usr/local/share/jupyter/kernels/gophernotes/
# fortran co-array
RUN cd ~ && git clone https://github.com/sourceryinstitute/jupyter-CAF-kernel && \
cd prebuild/jupyter-caf-kernel && \
python3 build bdist_wheel && python3 -m pip install dist/*.whl && \
jupyter kernelspec install Coarray-Fortran/ --sys-prefix && \
cd ~
# setup IRKernel
RUN echo "install.packages('IRkernel'); IRkernel::installspec(user = FALSE)" | sudo R --save
## Extras - Kafka
sudo apt-get install -y python3-kafka librdkafka++1 librdkafka-dev librdkafka1
sudo -H python3 -m pip install pykafka
sudo useradd kafka -m
mkdir ~/Downloads/
curl "https://www.apache.org/dist/kafka/2.1.1/kafka_2.11-2.1.1.tgz" -o ~/Downloads/kafka.tgz
mkdir ~/kafka && cd ~/kafka
tar -xvzf ~/Downloads/kafka.tgz --strip 1
echo "delete.topic.enable = true" >> ~/kafka/config/server.properties
echo -e """[Unit]
Requires=network.target remote-fs.target
After=network.target remote-fs.target
[Service]
Type=simple
User=kafka
ExecStart=/home/kafka/kafka/bin/zookeeper-server-start.sh /home/kafka/kafka/config/zookeeper.properties
ExecStop=/home/kafka/kafka/bin/zookeeper-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target""" | sudo tee -a /etc/systemd/system/zookeeper.service
echo -e """[Unit]
Requires=zookeeper.service
After=zookeeper.service
[Service]
Type=simple
User=kafka
ExecStart=/bin/sh -c '/home/kafka/kafka/bin/kafka-server-start.sh /home/kafka/kafka/config/server.properties > /home/kafka/kafka/kafka.log 2>&1'
ExecStop=/home/kafka/kafka/bin/kafka-server-stop.sh
Restart=on-abnormal
[Install]
WantedBy=multi-user.target""" | sudo tee -a /etc/systemd/system/kafka.service
sudo systemctl start kafka
sudo systemctl enable kafka
# do first - requires restart
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing
# extract
Rename-Item ~/Ubuntu.appx ~/Ubuntu.zip
Expand-Archive ~/Ubuntu.zip ~/Ubuntu
# add to path
$userenv = [System.Environment]::GetEnvironmentVariable("Path", "User")
[System.Environment]::SetEnvironmentVariable("PATH", $userenv + "C:\Distros\Ubuntu", "User")
function commits(){
echo -e "commit\tbranch\tcomment\ttimestamp\tauthor_name\tauthor_email"
git log --pretty=format:'%H,\t%D,\t%s,\t%ai,\t%aN,\t%ae%n' \
--abbrev-commit --date=relative --branches | sed 's/,\\t/\t/g'
}
function commit_tree() {
git log --graph --abbrev-commit --date=relative --branches \
--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset%n'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment