This posts shows how I setup a new Ubuntu for Data Science.

Update Ubuntu

sudo apt update
sudo apt upgrade

Configure apt

It’s always a good idea to check the baseline setup. So, let’s check the current apt keys.

sudo apt-key list

Then, let’s check the sources.

cat /etc/apt/sources.list
cd /etc/apt/sources.list.d/

And finally, let’s check the users and group.

cut -d: -f1 /etc/passwd # will list all local users
cat /etc/passwd # will list all local users with groups and other properties
getent passwd # same as above

cut -d: -f1 /etc/group # will list all local groups
cat /etc/group # will list all local groups
id -Gn
groups

getent group groupname # will list all members of groupaname
id username # will list all the groups a particular username belongs to

Configure Unity

To get minimise window on clicking its icon:

gsettings set org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ launcher-minimize-window true

Change folder view as tree

Files Preferences > Display > Navigate folders in a tree

Install git

sudo apt install git

Configure git

git config --global user.name "userName"
git config --global user.email "email@mailprovider.com"
git config --global core.excludesfile '~/.gitignore'

Connect to GitHub using a SSH key

mkdir ~/.ssh #if it does not already exist
chmod 700 ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa -C "email@mailprovider.com"
enter a keyname
enter a passphrase
cat ~/.ssh/keyname.pub

Copy the key to GitHub. Go to GitHub Settings. From the left margin, choose SSH and GPG keys and click on New SSH key. Paste the value copied above and give the key a name.

GitHubConfig1

eval `ssh-agent -s` # if needed
ssh-add ~/.ssh/KEYNAME

Connect to external servers using SSH keys

mkdir ~/.ssh #if it does not already exist
chmod 700 ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa
enter a keyname
enter a passphrase
ssh-copy-id -i [path to rsa file] USER@SERVER

Install SSHFS

SSHFS allows you to mount a remote filesystem using SFTP.

sudo apt install sshfs

Create a mounting point

sudo sshfs USER@SERVER:/ /mnt/foo/ -o allow_other,IdentityFile=/home/USER/.ssh/SERVER_rsa

Disconnect a mounting point

sudo umount /mnt/foo

or to mount the drivers without sudo everytime using an admin account

sudo chown firas: /mnt/foo/

Then using your account

chmod 700 foo

Now, you can do

sshfs USER@SERVER:/ /mnt/foo -o IdentityFile=/home/USER/.ssh/SERVER_rsa

Keeping allow_other will cause the error: fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf

Install CIFS

sudo apt-get install cifs-utils

To mount windows share (SMB) as local disk:

id
sudo mount //WINSRV/SHARE -t cifs -o uid=1000,gid=1000,username=USER,domain=DOMAIN /mnt/foo
sudo mount -t  cifs //WINSRV/SHARE ~/localmount -o user=userid,pass=mypass,cache=loose,noperm,dir_mode=0777,file_mode=0777

Install Remmina

sudo apt-add-repository ppa:remmina-ppa-team/remmina-next
sudo apt update
sudo apt install remmina remmina-plugin-rdp libfreerdp-plugins-standard

Configure Terminal

  /* 8 normal colors */
  [0] = "#2f1e2e", /* black   */
  [1] = "#ef6155", /* red     */
  [2] = "#48b685", /* green   */
  [3] = "#fec418", /* yellow  */
  [4] = "#06b6ef", /* blue    */
  [5] = "#815ba4", /* magenta */
  [6] = "#5bc4bf", /* cyan    */
  [7] = "#a39e9b", /* white   */

  /* 8 bright colors */
  [8]  = "#776e71", /* black   */
  [9]  = "#ef6155", /* red     */
  [10] = "#48b685", /* green   */
  [11] = "#fec418", /* yellow  */
  [12] = "#06b6ef", /* blue    */
  [13] = "#815ba4", /* magenta */
  [14] = "#5bc4bf", /* cyan    */
  [15] = "#e7e9db", /* white   */

  /* special colors */
  [256] = "#2f1e2e", /* background */
  [257] = "#a39e9b", /* foreground */

Install zsh and prezto

sudo apt update
sudo apt install zsh
chsh -s $(which zsh) # to change to zsh, don't use sudo otherwise it will change it for root
sudo vi /etc/passwd # just to check that now :/home/USERNAME:/usr/bin/zsh
# logout and login
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"

Configure prezto

cd ~
ln -s .zprezto/runcoms/z* .
mv zlogin .zlogin
mv zlogout .zlogout
mv zpreztorc .zpreztorc
mv zprofile .zprofile
mv zshenv .zshenv
mv zshrc .zshrc

Prezto has many useful modules and here is a list of all modules available. You can edit .zpreztorc to enable any of them:

# Set the Prezto modules to load (browse modules).
# The order matters.
zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory' \
  'spectrum' \
  'utility' \
  'completion' \
  'git' \
  'archive' \
  'osx' \
  'python' \
  'ruby' \
  'fasd' \
  'autosuggestions' \
  'command-not-found' \
  'dnf' \
  'dpkg' \
  'emacs' \
  'gnu-utility' \
  'gpg' \
  'haskell' \
  'helper' \
  'homebrew' \
  'macports' \
  'node' \
  'ocaml' \
  'pacman' \
  'perl' \
  'rails' \
  'rsync' \
  'screen' \
  'ssh' \
  'tmux' \
  'wakeonlan' \
  'yum' \
  'syntax-highlighting' \
  'history-substring-search' \
  'prompt'

Install R and RStudio

  • To get the most updated version of R, add CRAN repository
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'
sudo apt update
sudo apt install r-base
sudo apt install r-base-dev

To Install Rstudio,

sudo dpkg -i libgstreamer0.10-0_0.10.36-1.5_amd64.deb
sudo dpkg -i libgstreamer-plugins-base0.10-0_0.10.36-2_amd64.deb
sudo apt install libjpeg62 libedit2
sudo dpkg -i rstudio-1.1.383-amd64.deb

Install Python virutal environment

Ubuntu 16.04 comes with Python and Python3 installed.

Install and update pip3:

sudo apt install python3-pip
pip3 install --upgrade pip setuptools wheel

Install virtualenv and virtualenvwrapper

sudo apt install virtualenv virtualenvwrapper

Add the following lines to .zprofile:

# needed for virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Projects
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv
export PIP_REQUIRE_VIRTUALENV=true
source /usr/local/bin/virtualenvwrapper.sh

Install Jupyter notebook

mkproject -p `which python3` Jupyter
pip3 install jupyter

Install Sublime Text 3

Follow the steps mentioned in the Sublime 3 Docs

Install the GPG key:

wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -

Ensure apt is set up to work with https sources:

sudo apt-get install apt-transport-https

Select the channel to use:

echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

Update apt sources and install Sublime Text:

sudo apt-get update
sudo apt-get install sublime-text

Tips:

You can start Sublime Text from the terminal using subl command.

If Sublime Text is not showing in the ‘open with’ menu, then follow these steps to fix it:

  • Copy the contents of /usr/share/applications/sublime_text.desktop to ~/.local/share/applications/sublime_text.desktop
  • Then in the terminal type: sudo update-desktop-database

Install Source Code Pro

Download the latest release from GitHub repo


# For system wide installation, copy the fonts to `/usr/share/fonts` and run `sudo fc-cache` to rebuild the font cache,
# For a local installation: create `~/.fonts` if not already exists, copy the font files here, then rebuild the font cache.

mkdir ~/.fonts
cd ~/.fonts
# copy all OTF files to this directory
cp ~/Download/*.otf ~/.fonts
fc-cache -f -v

Install vim

sudo apt install vim

Install SnapGene viewer

wget http://www.snapgene.com//products/snapgene_viewer/download.php?&majorRelease=4.0&minorRelease=4.0.6&os=linux_deb
sudo dpkg -i snapgene_viewer_4.0.6_linux.deb
sudo apt-get install ttf-mscorefonts-installer
fc-cache -f -v # to rebuild font cache manually

Install htop

sudo apt install htop

Install Zotero

Download Zotero from here, and unzip the downloaded file

tar -xvjf Zotero-5.0.21_linux-x86_64.tar.bz2

where -j is equal to --bzip2. Rename the folder and move it to /opt/.

To create a shortcut that you can use in Unity launcher, do the following:

cd /usr/share/applications
sudo ln -s /opt/Zotero/zotero.desktop .

In Ubuntu 18.04 and gnome desktop:

cd ~/Downloads
wget https://download.zotero.org/client/release/5.0.47/Zotero-5.0.47_linux-x86_64.tar.bz2
tar -xjvf Zotero-5.0.47_linux-x86_64.tar.bz2
sudo mv Zotero_linux-x86_64/ /opt/zotero
ln -s /opt/zotero/zotero.desktop ~/.local/share/applications/

Instal WPS Office

wget http://ftp.debian.org/debian/pool/main/libp/libpng/libpng12-0_1.2.50-2+deb8u3_amd64.deb
sudo dpkg -i libpng12-0_1.2.50-2+deb8u3_amd64.deb
wget http://kdl1.cache.wps.com/ksodl/download/linux/a21//wps-office_10.1.0.5707-a21_amd64.deb
sudo dpkg -i wps-office_10.1.0.5707-a21_amd64.deb

Symbol fonts

cd /tmp
git clone https://github.com/iamdh4/ttf-wps-fonts.git
sudo mkdir /usr/share/fonts/wps-fonts
sudo mv ttf-wps-fonts/* /usr/share/fonts/wps-fonts
sudo chmod 644 /usr/share/fonts/wps-fonts/*
sudo fc-cache -vfs
rm -rf /tmp/ttf-wps-fonts

Install Hugo

To get the latest version of Hugo, use snap to install it.

sudo snap install hugo

Install SNX (optional)

sudo apt install libstdc++5:i386 libpam0g:i386 libx11-6:i386
sh +x checkpoint vpn snx linux 800007075

Tips

  • To open the directory from terminal
nautilus . &
xdg-open . &
  • To reset Ubuntu Desktop to its default settings
dconf reset -f /
  • To enable En-GB spell checking in LibreOffice
sudo apt install hunspell-en-gb
  • To install a better screen shot manager

Download the one that comes with Deepin distribution from here

sudo apt install python-xlib
sudo dpkg -i deepin-scrot_2.0-0deepin_all.deb
  • To preview a log file live
tail -f ATACseq_TimePiont_diffbind_analysis.R.log

Where -f is follow: output appended data as the file grows.

  • Install a graphical system load indicator for CPU, ram, etc..
sudo apt install indicator-multiload

Install sushi-gnome

sudo apt-get install gnome-sushi

Install Chromioum

sudo apt-get install chromium-browser