---
# System prepended metadata

title: '-- The Start of Linux [ UBUNTU ]--'

---

# -- The Start of Linux [ UBUNTU ]--
## 建立開機USB

### 下載影像檔
從下列網址選擇適當的版本
https://www.ubuntu-tw.org/modules/tinyd0/index.php?id=7

### 利用影像寫入軟體製作開機USB
BalanaEtcher:
https://www.balena.io/etcher/

:::info
BalenaEtcher 除了可以使用檔案進行製作外，也可以直接使用GitHub 的網址進行影像的寫入。
:::

:::danger
請選擇正確的磁碟空間，以免造成損失。
:::

## 磁碟分割 (Disk Partition)
### root (/)
- 根目錄
- 50 GB
- ext 4
### swap
- 交換空間
- 512 MB
- swap
:::info
交換空間需配合記憶體大小(RAM)
參考資料：https://www.gushiciku.cn/pl/gHtc/zh-tw
(yuhan)
:::
### 核心檔案空間 (/boot)
- 引導系統所需程式檔案
- 5 GB
- ext 4
### 暫存空間 (/tmp)
- 系統臨時檔案，重開機後消除
- 5 GB
- ext 4
### 主要空間 (/home)
- 分配使用者空間
- 剩餘所有空間
- ext 4


## Add *新酷音* to Ubuntu
* Adding input method by cmd
```sudo apt install ibus-chewing```

* log out

* Select Settings
![](https://i.imgur.com/rFVCb3n.png)

* Select Regin and Languages
* Push the button of "**+**"
* Find input method of Chinese(Chewing)
![](https://i.imgur.com/7wFb1tq.png)

## Installation of Nvidia and CUDA

### Nvidia Driver
* Search for the nvidia driver
```apt search nvidia-driver```

* Update and upgrade the drive
```sudo apt update```
```sudo apt upgrade```

* Install Selected Nvidia driver
```sudo apt install [driver_name]```

* Reboot computer
```sudo reboot```

* Examination
```nvidia-smi```

### Cuda toolkit
* Follow the step of the following website
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=20.04&target_type=deb_local
    


## ALIAS 快捷鍵功能
```sudo nano .bashrc```

add alias [name of function] = '[command detail]'

### Examples:

* Function coonnect to NEAF super computre
```alias neaf = 'ssh -i ~/ssh_key/id_rsa.pem name_of_pc_user@your_ip_address'```
* Function connect to Raspberry pi as assigned IP
```alias rasp='sudo ssh pi@192.168.50.115'```


## SSH Server

* 更新資料庫
```sudo apt-get update```
* 安裝 OpenSSH Server
```sudo apt-get install -y openssh-server```
* 確認 SSH 服務狀態
```sudo service ssh status```

## SSH Keygne
### 操作電腦：
* 產生key
```ssh-keygen -t rsa -b 4096 -C "your_email@example.com"```

    ```> Generating public/private ALGORITHM key pair```
    
    ```> Enter a file in which to save the key (/c/Users/user_name/.ssh/id_rsa): ```
    

### 目標電腦：

## Install vim
1. install vim
```
sudo apt-get install vim
```

## Mount to NAS
1. 建立一個空資料夾準備 mount 用
```
mkdir /home/neaf-2080ti/NAS_NAS/
```

2. 安裝 nfs 相關指令
```
sudo apt install nfs-common
```

3. Mount 
```
mount -t nfs 140.114.141.95:/volume1/nas /home/neaf-2080ti/NAS_NAS
```

4. 確認是否連接
```
df
```
![](https://i.imgur.com/VhLFAZ8.png)
> 最後一列即為剛連接之 NAS


5. 可以寫入 ~/.zshrc alias，每次開機時連接

## /tmp 空間不足

解除綁定 /tmp
```sudo umount /tmp```
or
```sudo umount -l /tmp```

重新綁定 /tmp
```sudo mount -t tmpfs -o size=size_of_your_wish(10G) ,mode=1777 overflow /tmp```

## Installation of zsh

Update data base
``` sudo apt update ```

Install zsh through Ubuntu system
``` sudo apt install zsh```

Check if the zsh is proper installed,
if zsh shows in the last row then it is sucess.
```cat /etc/shells```

### Set Zsh as the default bash

List all the bash
```chsh -l```

set the zsh as the default bash
```chsh -s $(which zsh)```


## install Oh my zsh
``` sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" ```

## install theme




## Install of pyenv
``` sudo apt-get update ```


