---
# System prepended metadata

title: StaMPS安裝步驟
tags: [InSAR, Linux]

---

StaMPS安裝步驟
===

Step1. Matlab安裝
---
### 所需檔案：
 - R2018a_glnxa64_dvd1.iso
 - R2018a_glnxa64_dvd2.iso
 - license.lic
 - network.lic
### 安裝步驟：
1. 建資料夾
```linux=
sudo mkdir /mnt/dvd
```

2. 掛載dvd1的ISO檔
```linux=
sudo mount -o loop /home/user/桌面/R2018a_glnxa64_dvd1.iso /mnt/dvd
```

3. 設定安裝路徑
```linux=
cd /usr/local
```

4. 安裝MATLAB
```linux=
/mnt/dvd/install &
```

5. 輸入install key

6. license檔案為`license.lic`

8. 接著會說退出dvd1、放入dvd2，在終端機下指令，掛載dvd2的ISO檔
9. 安裝完後將`/usr/local/MATLAB/R2018a/licenses/network.lic`用上述"所需檔案`network.lic`"取代掉
10. 卸載ISO檔
```linux=
sudo umount /mnt/dvd
```


---

Step2. Triangle安裝
---
### 所需檔案：
 - triangle
### 安裝步驟：
1. 將triangle解壓縮到`/usr/local`下

2. 設定路徑
```linux=
cd /usr/local/triangle
```
```linux=
sudo make
sudo make install
```

---

Step3. StaMPS安裝
---
### 所需檔案：
 - triangle
### 安裝步驟：
1. 將StaMPS解壓縮到`/usr/local`下

2. 設定路徑
```linux=
cd /usr/local/StaMPS/src
```
```linux=
sudo make
sudo make install
```
3. 更改StaMPS資料夾權限，從root變為user
```linux=
sudo chown -R user /usr/local/StaMPS
```
4. 修改`StaMPS_CONFIG.bash`文件(主要是`STAMPS`、`TRIANGLE_BIN`、`SNAPHU_BIN`這三個)：
```bash=
export STAMPS="/usr/local/StaMPS"
export SAR="/home/ahooper/software/ROI_PAC_3_0"
export GETORB_BIN="/usr/local/bin"
export SAR_ODR_DIR="/media/F/orbits"
#export SAR_PRC_DIR  "/home/ahooper/software/SAR_FILES/PRC"
export VOR_DIR="/home/ahooper/software/SAR_FILES/VOR"
export INS_DIR="/home/ahooper/software/SAR_FILES/INS"
export DORIS_BIN="/usr/local/bin"
export TRIANGLE_BIN="/usr/local/triangle"
export SNAPHU_BIN="/usr/local/bin"
```
5. 然後在`home/.bashrc`文件底部，添加：
```bash=
source /usr/local/StaMPS/StaMPS_CONFIG.bash
```

---

Step4. snaphu安裝
---
### 所需檔案：
 - snaphu-v1.4.2
### 安裝步驟：
```linux=
cd /usr/local/snaphu-v1.4.2/src
```
```linux=
sudo make
sudo mkdir /usr/local/man/man1
sudo make install
```

---

Step5. 安裝執行程式
---
```linux=
sudo apt-get install csh
sudo apt-get install gawk
```

---

Step6. 設定權限
---
```linux=
sudo passwd
$PATH
```
複製上面的環境變數
```linux=
sudo gedit /etc/sudoers
```
將上面複製的環境變數貼上

---

Step7. 設定為可執行檔
---
開新的終端機，不要切換到root權限
```linux=
cd /usr/local/StaMPS/bin
```
```linux=
chmod u+x mt_prep_snap
chmod u+x calamp
chmod u+x selpsc_patch
chmod u+x psclonlat
chmod u+x pscdem
chmod u+x pscphase
chmod u+x mt_extract_cands
```

---

Step8. snap安裝
---
### 所需檔案：
 - esa-snap_sentinel_unix_6_0.sh 
### 安裝步驟：
```linux=
sudo apt update
sudo apt install default-jre
```
指向到檔案路徑，這邊假設檔案放在下載
```linux=
cd /home/user/下載
```
編譯為可執行檔
```linux=
sudo chmod +x esa-snap_sentinel_unix_6_0.sh
```
安裝
```linux=
sudo ./esa-snap_sentinel_unix_6_0.sh
```

###### tags: `InSAR`、`Linux`