###### tags: `linux` `gpu`
# New system setup
[TOC]
## Utilities
```bash=
# windows switch only in current workspace
gsettings set org.gnome.shell.app-switcher current-workspace-only true
# acess settings
chmod 700 ~/.ssh
chmod 644 ~/.ssh/config
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
```
The following command will generate a new 4096 bits SSH key pair with your email address as a comment:
```bash=
ssh-keygen -t rsa -b 4096 -C "aravindsugunan@gmail.com"
# For copying ssh pub key to server
ssh-copy-id remote_username@server_ip_address
```
Jupyter-Notebook
```bash=
sudo apt-get install jupyter-notebook
```
Jupyter-Notebook over ssh
```bash=
ssh USERNAME@domain.suffix -L8223:localhost:8223
jupyter notebook --no-browser --port 8223
```
Multiple time zones for gnome
```bash=
sudo apt install gnome-clocks
```
## Root for ubuntu 18.04
Install guide webpage : [https://root.cern/install/](https://root.cern/install/)
Releases : [All Releases](https://root.cern/install/all_releases/)
```bash=
wget https://root.cern/download/root_v6.22.02.Linux-ubuntu18-x86_64-gcc7.5.tar.gz
tar -C ~/ -xvzf root_v6.22.02.Linux-ubuntu18-x86_64-gcc7.5.tar.gz
echo "">>~/.bashrc
echo "## ROOT SETUP">>~/.bashrc
echo "source ~/root/bin/thisroot.sh">>~/.bashrc
```
## CernBox client
<!-- #### Ubuntu 20.04 focal-fossa
```bash=
wget -q -O- https://cernbox.cern.ch/cernbox/doc/Linux/repo.2.7.0-beta1/Ubuntu_20.04/Release.key | sudo apt-key add -
sudo sh -c "echo 'deb https://cernbox.cern.ch/cernbox/doc/Linux/repo.2.7.0-beta1/Ubuntu_20.04/ /' > /etc/apt/sources.list.d/cernbox-client.list"
sudo apt-get update
sudo apt-get install cernbox-client
```-->
[CernBOX Client Page](https://cernbox.web.cern.ch/cernbox/downloads/)
#### Ubuntu 18.04 bionic-beaver
```bash=
export VERSION=`lsb_release -rs`
# example: the command above will set 18.04 if you are on Bionic Beaver
wget -q -O- https://cernbox.cern.ch/cernbox/doc/Linux/repo/Ubuntu_${VERSION}/Release.key | sudo apt-key add -
sudo sh -c "echo 'deb http://cernbox.cern.ch/cernbox/doc/Linux/repo/Ubuntu_${VERSION}/ /' > /etc/apt/sources.list.d/cernbox-client.list"
sudo apt-get update
sudo apt-get install cernbox-client
```
## TIFR SSL-VPN
```bash=
wget ftp://ftp.tifr.res.in/pulse_secure_linux_package/pulse-9.1R3.x86_64.deb
sudo dpkg -i pulse-9.1R3.x86_64.deb
sudo apt-get install libwebkitgtk-1.0-0
# to install dependancies for GUI run
bash /usr/local/pulse/PulseClient_x86_64.sh install_dependency_packages
```
VPN adress
```
https://sslvpn.tifr.res.in/tifruser
```
## Skype
Dowload client [here](https://www.skype.com/en/get-skype/)
```bash=
wget https://go.skype.com/skypeforlinux-64.deb
sudo dpkg --install skypeforlinux-64.deb
```
## Zoom
Dowload client [here](https://zoom.us/download)
```bash=
wget https://zoom.us/client/latest/zoom_amd64.deb
sudo apt-get install libxcb-xtest0
sudo dpkg -i zoom_amd64.deb
```
## CUDA Setup
Installation Documentation may be found [here](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html)
#### Preinstalation steps
Purge old nvidia/cuda instalations
```bash=
sudo apt-get --purge -y remove 'cuda*'
sudo apt-get --purge -y remove 'nvidia*'
sudo apt-get autoremove
```
Install the linux headers
```bash=
sudo apt-get install linux-headers-$(uname -r)
```
Download and setup the package manager (see [here](https://developer.nvidia.com/cuda-downloads))
Two options .deb network
```bash=
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
sudo apt-get -y install cuda
```
and .deb local
```bash=
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda-repo-ubuntu1804-11-1-local_11.1.0-455.23.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-11-1-local_11.1.0-455.23.05-1_amd64.debsudo apt-key add /var/cuda-repo-ubuntu1804-11-1-local/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda
```
Notes : there will be a prompt that will ask about secure boot permission for 3rd party drivers and some other MOC acesss ..And be careful at the next reboot to allow those permissions activate at BIOS
```bash=
reboot
```
#### Post Installation steps
Add to `*.bashrc*`
```bash=
export PATH=/usr/local/cuda-11.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
```
#### Validation
Before continuing, it is important to verify that the CUDA toolkit can find and communicate correctly with the CUDA-capable hardware. To do this, you need to compile and run some of the included sample programs.
```bash=
cuda-install-samples-11.1.sh
cd NVIDIA_CUDA-11.1_Samples
make -j 8
cd $PWD/bin/x86_64/linux/release
./deviceQuery
./bandwidthTest
```
Checking Driver & nvcc version
```bash=
cat /proc/driver/nvidia/version
nvcc -V
```
## Network Printer at D210
Install the driver and suff for brother printer from this url
```bash=
mkdir ~/Documents/brotherPrinter
cd ~/Documents/brotherPrinter
wget https://download.brother.com/welcome/dlf006893/linux-brprinter-installer-2.2.2-1.gz
sudo -i
XXXXXXXXXXXX
cd ~/Documents/brotherPrinter
gunzip linux-brprinter-installer-*.gz
sudo bash linux-brprinter-installer-*
```
Note :
model name MCF-L5900DW
When you see the message "Will you specify the DeviceURI ?",
For Network Users: Choose Y(Yes) and DeviceURI number.
The IP for the printer is `155.144.54.195`
## Fingerprint setup on XPS 15 9500
Source : [reddit post](https://www.reddit.com/r/Dell/comments/hpzsd2/how_to_get_the_fingerprint_reader_working_on_dell/) and [ubuntu forum post](https://askubuntu.com/questions/1049526/fingerprint-activation-on-ubuntu-18-04)
```bash=
# Updated deb file may be found at :
wget http://dell.archive.canonical.com/updates/pool/public/libf/libfprint-2-tod1-goodix/libfprint-2-tod1-goodix_0.0.4-0ubuntu1somerville1_amd64.deb
#might have to install some dependancies
sudo dpkg -i libfprint-2-tod1-goodix_0.0.4-0ubuntu1somerville1_amd64.deb
# go to settings/user to enroll fprints, verified and works [ or maybe do it using the reddit post methord, not verified]
# to test the match
fprintd-verify
```
***Note*** : only the last enrolled fprint gets validated
## Audio driver reinstall
[source](https://itectec.com/ubuntu/ubuntu-realtek-audio-drivers-for-ubuntu/)
Remove the ALSA packages.
```bash=
sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils
```
Reinstall the same packages.
```bash=
sudo apt-get install linux-sound-base alsa-base alsa-utils
```
<!-- Packages gdm and ubuntu-desktop are also removed in this process if you are using Gnome. They need to be reinstalled:
```bash=
sudo apt-get install gdm ubuntu-desktop
```
If you are using Xubuntu this will also happen to you.
sudo apt-get install gdm xubuntu-desktop
-->
Reboot.
```bash=
sudo reboot
```
## GitHub Setup
```
git config --global user.email "aravindsugunan@gmail.com"
git config --global user.name "Aravind Sugunan
```
## HEPMC3
[Source](https://gitlab.cern.ch/hepmc/HepMC3)
```
```
## Pythia8
Pythia Instalation [source]()
```bash=
cd ~
wget http://home.thep.lu.se/~torbjorn/pythia8/pythia8303.tgz
cd pythia830*
./configure --with-root-bin=~/root/bin/
make -j 4
```
Bashrc setup : No effect as of now .. need to debug
```
## PYTHIA SETUP
export PYTHIA8=~/pythia8303
export PATH=$PYTHIA8/bin:${PATH}
export LD_LIBRARY_PATH=$PYTHIA8/lib:${LD_LIBRARY_PATH}
```
## Setup SSH-Login
Generate a new SSH key pair
```bash=
ssh-keygen -t rsa -b 4096 -C "aravindsugunan@gmail.com"
```
copy the ssh-key to server end
```bash=
ssh-copy-id remote_username@server_ip_address
```
Once the user is authenticated, the public key will be appended to the remote user authorized_keys file and connection will be closed.
Workaround if ssh-copy-id is not present
```bash=
cat ~/.ssh/id_rsa.pub | ssh remote_username@server_ip_address "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
```
## Vim
.vimrc
```
:hi Search ctermbg=Cyan ctermfg=Black
:set autoindent
:syntax on
:set hlsearch
:set number
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
```
## Astyle
[website](http://astyle.sourceforge.net/)
- Download from the Sourceforge Website
- Or copy from the filestorage
```bash=
tar -xvf cernbox/fileStorage/sources/astyle_3.1_linux.tar.gz astyle/
cd astyle/build/gcc/
make
# for installing
sudo make install
# or
echo "">>~/.bashrc
echo "## ASTYLE">>~/.bashrc
echo "export PATH="`pwd`"/bin:\$PATH">>~/.bashrc
```
## Setup Jupyter over ssh
```bash=
# connect to server with a port forward to access the jupyter notebook server
ssh igpu -L8282:localhost:8282
jupyter notebook --no-browser --port 8282
```