# Taiwan Server2 update history
## Update log
* ### 20231103
* [Install metaphlan4 within miniconda environment](#Install-metaphlan4-within-miniconda-environment)
* ### 20230928
* [Install Docker & Illumina TELL seq](#Install-Docker-amp-Illumina-TELL-seq)
* ### 20221208
* [Install Miniconda & QIIME2](#Install-Miniconda-amp-QIIME2)
## Install CentOS
### Partition assignment
| Disk | Parition | MountPoint | Size | Descriptions |
| ---- | -------- | ---------- | ----- | ------------ |
| sda | sda1 | /boot/efi | 200MB | 開機磁區 |
| sda | sda2 | /boot | 500MB | 開機磁區 |
| sdc | swap | swap | 128GB | 記憶體交換區 |
| sdc | home | /home | 3TB | 家目錄 |
| sdc | root | / | 4TB | 根目錄 |
| sdc | pkg | /pkg | 4TB | 公用程式 |
| sdc | work | /work | 16TB+ | 工作目錄 |
* #### /home
User specific space, which stores tools, references and etc. for their own use.
* #### /pkg
Public tools share among users.
Always install packages by root.
* #### /pkg/source
Downloaded packages.
* #### /work
Working space, stores references and working directory for each projects seperately.
* #### /work/reference
Stores references for projects.
## Install HTOP
>#install EPEL library
>sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
>sudo yum update
>sudo yum install htop
## Install sysbench
:::info
系統測試工具,也可用來測試DataBase效率
:::
>sudo yum -y install sysbench
### sysbench測試指令
>#CPU測試
>#透過尋找質數的方式檢測CPU速度,設定在數字10萬的範圍內尋找質數
>sudo sysbench --test=cpu --cpu-max-prime=100000 run
>#記憶體測試
>#測試記憶體扇區設定為8K,總記憶體設定為200G,執行測試。
>sudo sysbench --test=memory --memory-block-size=8k --memory-total-size=200G run
>#硬碟測試(檔案讀寫與同步效率測試)
>#準備階段
>sudo sysbench --test=fileio --num-threads=15 --file-total-size=4G --file-test-mode=rndrw prepare
>#執行階段
>sudo sysbench --test=fileio --num-threads=15 --file-total-size=4G --file-test-mode=rndrw run
>#執行緒測試
>#測定500個執行緒,每個執行序測試100次,其中每個執行緒有四個共享執行階段。
>sudo sysbench --test=threads --num-threads=500 --thread-yields=100 --thread-locks=4 run
## Install Miniconda & QIIME2
### Source
:::info
[Miniconda download page](https://docs.conda.io/en/latest/miniconda.html)
[QIIME2 official doc](https://docs.qiime2.org/2021.11/install/native/#install-qiime-2-within-a-conda-environment)
:::
### Miniconda
```bash=
cd /pkg/source
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
sh Miniconda3-latest-Linux-x86_64.sh
- Do you accept the license terms? [yes|no]
yes
- Miniconda3 will now be installed into this location: /root/miniconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
/pkg/miniconda3 #Change install path to /pkg/
- Do you wish the installer to initialize Miniconda3 by running conda init? [yes|no]
no
vi ~/.bash_profile
-insert: PATH=$PATH:/pkg/miniconda3/bin 在export PATH之前
# 不重新登入就使設定生效
source ~/.bash_profile
conda update conda -y
conda install wget -y
```
#### QIIME2
```bash=
cd /pkg/source
#安裝2021.11版本
wget https://data.qiime2.org/distro/core/qiime2-2021.11-py38-linux-conda.yml
conda env create -n qiime2-2021.11 --file qiime2-2021.11-py38-linux-conda.yml
# Initialize conda shell, activate when login
conda init bash
exit # Re-login
# Cancel activate when login
conda config --set auto_activate_base false
# Activate indicated environment when user login
vi ~/.bash_profile
-insert: conda activate qiime2-2021.11
# 不重新登入就使設定生效
source ~/.bash_profile
```
## Install XAMPP
### Source
:::info
[XAMPP official](https://www.apachefriends.org/zh_tw/index.html)
:::
### Commands
```bash=
cd /pkg/source
wget https://downloadsapachefriends.global.ssl.fastly.net/8.1.6/xampp-linux-x64-8.1.6-0-installer.run
chmod +x xampp-linux-x64-8.1.6-0-installer.run
./xampp-linux-x64-8.1.6-0-installer.run
/opt/lampp/lampp start
```
:::danger
Error: libnsl not found
:::
>XAMPP: SELinux is activated. Making XAMPP fit SELinux...
chcon: 無法存取 '/opt/lampp/lib/mysql/*.so': 沒有此一檔案或目錄
Starting XAMPP for Linux 8.1.1-2...
XAMPP: Starting Apache...fail.
httpd: Syntax error on line 522 of /opt/lampp/etc/httpd.conf: Syntax error on line 6 of /opt/lampp/etc/extra/httpd-xampp.conf: Cannot load modules/mod_perl.so into server: libnsl.so.1: cannot open shared object file: No such file or directory
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.
```bash=
## Do Repo update first if redhat licence expired.
#Install libnsl
dnf upgrade --refresh
sudo dnf install libnsl
#Activate XAMPP again
/opt/lampp/lampp start
```
>XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...already running.
XAMPP: Starting ProFTPD...already running.
## Install Docker & Illumina TELL seq
:::info
https://docs.docker.com/engine/install/rhel/ #failed
https://linuxconfig.org/how-to-install-docker-in-rhel-8 #success
:::
### Docker
```bash=
# Uninstall old versions
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine \
podman \
runc
yum install -y yum-utils
# Add repo
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
dnf repolist -v
# Find the latest docker version and install
dnf list docker-ce --showduplicates
dnf install docker-ce-3:24.0.6-1.el8
# Start docker
systemctl start docker
systemctl enable docker
# Create docker group and add MacGyver to cocker group
groupadd docker
usermod -aG docker MacGyver
```
### TellSeq
```bas
tar xzvf tellread.tar.gz
cd tellread-release
docker load -i docker-tellread
cd ../
tar zxvf tellsort.tar.gz
tar zxvf tellink.tar.gz
sh /pkg/TellSeq/releases_v1.1.1_package/tellread-release/run_tellread.sh \
-i /work/NGS_DATA/TellSeq_230310_M07490_0026_000000000-KPCC2 \
-o /work/TellSeqTest/T504-T508 \
-s T504,T505,T506,T507,T508 \
-g NONE,NONE,NONE,NONE,NONE
docker load -i /pkg/TellSeq/releases_v1.1.1_package/tellink-release/docker-tellink
sh /pkg/TellSeq/releases_v1.1.1_package/tellink-release/run_tellink.sh \
-r1 /work/TellSeqTest/T504-T508/Full/T504-T508_R1_T506.fastq.gz.corrected.err_barcode_removed.fastq \
-r2 /work/TellSeqTest/T504-T508/Full/T504-T508_R2_T506.fastq.gz.corrected.err_barcode_removed.fastq \
-i1 /work/TellSeqTest/T504-T508/Full/T504-T508_I1_T506.fastq.gz.corrected.err_barcode_removed.fastq \
-d metagenomics \
-o /work/TellSeqTest/Tellink \
-k 100 \
-lc 70 \
-p T506 \
-j 30
```
## Install metaphlan4 within miniconda environment
:::info
https://github.com/biobakery/MetaPhlAn/wiki/MetaPhlAn-4#installation
:::
```bash=
# add the conda-forge channel to conda
conda install -c conda-forge -c bioconda metaphlan
conda create --name metaphlan4 -c conda-forge -c bioconda r-base
conda activate metaphlan4
pip install metaphlan
```
###### tags: `Server`