# A. Set up new computer with Ubuntu
## 1. From the web
#### 1.1 **Sign into Github**
+ Sign in, make an [ssh key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
+ [Add to github](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)
#### 1.2 **Starship prompt**
+ Install [NerdFont](https://www.nerdfonts.com/font-downloads) like FiraCode, move to `./fonts`
+ Go [starship.rs](starship.rs) and follow the instructions
#### 1.3 **Conda**.
Install miniconda and poetry
```shell=
mkdir -p ~/installs # if not available
cd ~/installs
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh # follow instructions
# sometimes the following will be necessary
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
```
#### 1.4 **Dropbox**
from [here](https://www.dropbox.com/en_GB/install-linux). If possible, install in the `/data` folder
#### 1.5 **Brave browser**:
Download from website, set as main browser.
#### 1.6 **Kitty terminal**
+ Install from [here](https://sw.kovidgoyal.net/kitty/binary/)
+ Add relevant things to path: `sudo ln -s ~/.local/kitty.app/bin/kitty /usr/local/bin/kitty` (also `kitten`)
#### Optional from web
**1password**: Download `deb` file from the website and then run `sudo apt install ./1password-latest.deb`
## 2. From `apt`
Run the following command:
```shell=
sudo apt install build-essential imagemagick pcmanfm rofi conky tldr neovim texlive libreoffice -y
```
Finish with `tldr -u` to update the database for `tldr`.
you have just installed the following:
| Name | id for `apt` | Description |
| -------- | -------- | -------- |
| Build Essentials | `build-essential`| C, C++, etc |
| ImageMagick | `imagemagick` | Utils for image analysis |
| pcmanfm | `pcmanfm` | File manager |
| rofi | `rofi` | Run prompt |
| conky | `conky` | Graphics and stuff |
| tldr | `tldr` | Easier `man` pages |
| NeoVim | `neovim` | Text editor |
| TeX Live | `texlive` | LaTeX libraries |
| LibreOffice | `libreoffice` | Office |
#### 2.1 Sometimes this might be needed
```shell=
sudo apt install qtwayland5 -y
```
## 3. Rust/cargo utils
These are really fast utilities to make your life easier. They substitute some of the linux core-utils like `ls`, `grep`, etc.
#### 3.1 Install
Go [here](https://doc.rust-lang.org/cargo/getting-started/installation.html). Once installed, add to the path with:
```shell
. "$HOME/.cargo/env"
```
#### 3.2 Actual programs to install:
Install the following:
```shell
cargo install exa fd-find ripgrep bat
```
| Name | id for `apt` | Description |
| -------- | -------- | -------- |
| EXA | `exa`| Substitute for `ls` |
| fd | `fd-find` | Easier to use substitute for `find` |
| ripgrep | `ripgrep` | Easier to use substitute for `grep` |
| bat | `bat` | Nicer looking substitute for `cat` |
Now, make `exa` super useful by adding the following to the `.bashrc` file
```
alias exa='exa -la --group-directories-first'
```
## 4. From snap
**VSCode** `sudo snap install code --classic`
**Slack** `sudo snap install slack`
## 5. From Github
### **Configration files** `myconfig`
```shell
mkdir -p ~/utils
git clone git@github.com:alonsoJASL/myconfig.git ~/utils/myconfig
cd ~/utils/myconfig
```
+ Copy config folder`cp -R rofi ~/.config/`
+ Move Starship TOML `cp starship.toml`
+ KITTY: move contents from `kitty` to `~/.config/kitty/`
+ CONKY: move contents from `conky` to `~/.config/conky`, then setup conky as startup application `$HOME/.config/conky/start_conky.sh`
+ BASHRC: get whatever is needed from `.bashrc` file.
+ COLORSCRIPT: apply the patch (see below)
### 6. (OPTIONALS) Colorscript and Wallpapers
If you haven't, do `mkdir -p ~/.installs`, and inside do:
```shell
git clone https://gitlab.com/dwt1/shell-color-scripts.git
git clone https://gitlab.com/dwt1/wallpapers.git
```
For `colorscript`, do a `sudo ln -s PATH/colorscript.sh /usr/local/bin/colorscript`. Add the line to the `.bashrc`
```shell
colorscript -r
```
# B. Important development configs
These come after you've installed everything else. By this, make sure you have a `~/dev` and an `~/installs` folders. Inside `dev`
```
➜ ls ~/dev/
build myconfig python src
```
## cemrg-heartbuilder
```shell=
cd python/
git clone git@github.com:OpenHeartDevelopers/cemrg-heartbuilder.git
cd cemrg-heartbuilder/
conda create -n cemrg-heartbuilder python=3.10 -y
conda activate cemrg-heartbuilder
poetry config virtualenvs.create false --local
poetry install
./setup.sh
```
## imatools
```shell=
git clone git@github.com:alonsoJASL/imatools.git
cd imatools/
conda env create -f environment.yaml
conda activate imatools
poetry install
./setup.sh
```
## meshtool
```shell=
git clone https://bitbucket.org/aneic/meshtool.git
cd meshtool/
make
# then link it to /usr/local/bin
sudo ln -s $(pwd)/meshtool /usr/local/bin/meshtool
```
## itk-snap (and c3d)
Download and move the compressed file to the `~/installs` folder
```shell=
mv ~/Downloads/itksnap-4.2.2-20241202-Linux-x86_64.tar.gz ~/installs/
cd ~/installs
tar xvf itksnap-4.2.2-20241202-Linux-x86_64.tar.gz # Extract
```
Create an `alias` on your `.bashrc` pointing to the binaries for `itksnap` and `c3d`. A symlink does not work in this context.
## Paraview
```shell=
mv ~/Downloads/ParaView-5.13.3-MPI-Linux-Python3.10-x86_64.tar.gz ~/installs/
cd ~/installs
tar ParaView-5.13.3-MPI-Linux-Python3.10-x86_64.tar.gz
cd ParaView-5.13.3-MPI-Linux-Python3.10-x86_64/bin
sudo ln -s $(pwd)/paraview /usr/local/bin/paraview
```
## Meshalyzer
```shell=
sudo apt install libfuse-dev
mv ~/Downloads/Meshalyzer-5.4-x86_64.AppImage ~/installs/
cd ~/installs
mkdir Meshalyzer
mv Meshalyzer-5.4-x86_64.AppImage Meshalyzer/
cd Meshalyzer
chmod +x Meshalyzer-5.4-x86_64.AppImage
sudo ln -s $(pwd)/Meshalyzer-5.4-x86_64.AppImage /usr/local/bin/meshalyzer
```
## CemrgApp
Follow the instructions in the [wiki](https://github.com/OpenHeartDevelopers/CemrgApp/wiki/Build-CemrgApp-from-Scratch)
## Docker
Follow the instructions in the [docs](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
# Shortcuts
+ <kbd>SUPER</kbd>+<kbd>R</kbd> : `rofi show -run -normal-window`
+ <kbd>SUPER</kbd>+<kbd>W</kbd> : `rofi show -window -normal-window`
+ <kbd>SUPER</kbd>+<kbd>Return</kbd> : `kitty`
+ <kbd>SUPER</kbd>+<kbd>Q</kbd> : Exchange for the one that closes apps
+ <kbd>SUPER</kbd>+<kbd>F</kbd> : Opemn `pcmanfm`
# Optional
Remove the dock on Ubuntu: `sudo apt remove gnome-shell-extension-ubuntu-dock`
Fix Nvidia driver from nouveau (ew) to nvidia:
```shell=
ubuntu-drivers devices
# Install the recommended driver
sudo ubuntu-drivers autoinstall
# OR if you want to be more specific (check output from step 2):
# sudo apt install nvidia-driver-535
sudo reboot
```
Once you rebooted, check
```shell=
nvidia-smi
lsmod | grep nouveau # should be empty
```
# C. Imperial-specific
## Login to computer through ssh
### Setup (only do once)
You need to install [OPKSSH](https://github.com/openpubkey/opkssh)
```bash=
# LINUX
curl -L https://github.com/openpubkey/opkssh/releases/latest/download/opkssh-linux-amd64 -o opkssh
chmod +x opkssh
# macOS
curl -L https://github.com/openpubkey/opkssh/releases/latest/download/opkssh-osx-amd64 -o opkssh
chmod +x opkssh
```
Initialise:
```bash=
./opkssh login --create-config
```
You'll need to install the imperial config file and save it to the `config.yml` that got created in the previous step:
```bash=
curl https://rhn.cc.ic.ac.uk/install/scripts/standalone/sshgw/opkssh/config.yml -o ~/.opk/config.yml
```
### Every time you want to log in
> Certificate lasts 24 hours, so you need to do this pretty much every time
```bash=
opkssh login
```
Follow instructions, you'll authenticate on the browser. This will create a pair of files in your `~/.ssh` folder (called `id_ecdsa`).
Now, you can log in:
```bash=
ssh <username>@opkssh.ic.ac.uk -i ~/.ssh/id_ecdsa
```