---
# System prepended metadata

title: 重灌 Ubuntu 後該做什麼

---

# 重灌 Ubuntu 後該做什麼

## 設定有線網路
![03-how-to-configure-static-ip-address-on-ubuntu-22-04-jammy-jellyfish-desktop-server](https://hackmd.io/_uploads/SkAK283n0.jpg)
參考資料: [How to configure static IP address on Ubuntu 22.04](https://linuxconfig.org/how-to-configure-static-ip-address-on-ubuntu-22-04-jammy-jellyfish-desktop-server)

---
## 基礎設定
```bash
# 將使用者添加到 sudo 群組 (若可正常使用 sudo 則可跳過)
usermod -a -G sudo "username"

# 更新系統
sudo apt update && sudo apt upgrade -y

# 安裝基本工具
sudo apt install build-essential

# 調整時間 (同步雙系統時間)
timedatectl set-local-rtc 1 --adjust-system-clock
timedatectl status

# 安裝 .deb
sudo dpkg -i XXX.deb
sudo apt --fix-broken install
```

---
## Nvidia Driver
```bash
# 查詢顯卡規格和可用的驅動
sudo lshw -numeric -C display
sudo ubuntu-drivers list

# 安裝合適的版本
sudo apt install nvidia-driver-XXX
sudo reboot

# 確認安裝結果
nvidia-smi
```

---
## Miniconda
```bash
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ~/Miniconda3-latest-Linux-x86_64.sh
```
基礎操作
```bash
# 更新
conda update conda

# 列出已建立的虛擬環境
conda env list

# 創建虛擬環境
conda create --name myenv python=X.X
conda activate myenv
conda deactivate

# 刪除虛擬環境或其中的 package
conda env remove --name myenv
conda remove --name myenv package

# 複製環境
conda create --name <new_env> --clone <env_name>
```

---
## OBS Studio (for 22.04)
```bash
sudo add-apt-repository ppa:obsproject/obs-studio
sudo apt update
sudo apt install ffmpeg obs-studio
```

---
## 建立 GitHub SSH 連線
### 1. 生成 SSH key
> Run the following command:
> ```bash
> ssh-keygen -t ed25519 -C "your_email@example.com"
> ```
> For ease of use, just press Enter several times
> ![upload_de31e8fdea8806a76180633176ac0ae8](https://hackmd.io/_uploads/BkeH6UbaC.jpg)
>
### 2. 將 SSH key 加入 ssh-agent
> Run the following command:
> ```bash
> cd ~/.ssh
> eval "$(ssh-agent -s)"
> ssh-add ~/.ssh/id_ed25519
> cat id_ed25519.pub
> ```
> After the above operation, you can get the SSH key
> ![upload_b21254f57b5ea85a2e9a621b9aba1c98](https://hackmd.io/_uploads/r1ei6LZp0.jpg)
> 
### 3. 將 SSH key 加入 github 帳戶裡
> Add SSH key above into your github
> ![upload_d136f8cc59bc3f0af9f6bdebaa299696](https://hackmd.io/_uploads/HkosA8W6C.jpg)
>
### 4. 測試 SSH 連線
> Run the following command, and types yes
> ```bash
> ssh -T git@github.com
> ```
> ![upload_0099bf02dbf14583d0d601cd60ecb579](https://hackmd.io/_uploads/ryLiJDZa0.jpg)
> If you see 'Hi username!', it means the SSH connection is working well

### 5. 更改遠端儲存庫路徑
> ![upload_64c2ef0aa402fc212ebe9d768efefc17](https://hackmd.io/_uploads/S1oDZDbTR.jpg)


參考資料: [Generating a new 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?platform=linux)、[Testing your SSH connection](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection)