Daily Push
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
---
|
||||
title: "ubuntu 20.04 install nvidia driver / CUDA / postgresql / pg_strom"
|
||||
date: 2020-11-18T14:24:30+08:00
|
||||
draft: false
|
||||
noSummary: false
|
||||
categories: ['筆記']
|
||||
image: https://h.cowbay.org/images/post-default-3.jpg
|
||||
tags: [postgresql,nvidia,cuda,pg_strom,gpu]
|
||||
author: "Eric Chang"
|
||||
keywords:
|
||||
- postgresql
|
||||
- pg_strom
|
||||
---
|
||||
|
||||
最近又開始在亂搞postgresql ,一直想要玩玩看GPU運算的威力,大概一年多前,有測試了 ubuntu 18.04 + postgresql + pg_strom ,可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。
|
||||
|
||||
Breaks here
|
||||
<!--more-->
|
||||
---
|
||||
title: "ubuntu 20.04 install nvidia driver / CUDA / postgresql / pg_strom"
|
||||
---
|
||||
|
||||
這次搞到一張GTX 1030 顯示卡,作業系統也升級到了 ubuntu 20.04 ,就再來弄一次看看
|
||||
|
||||
### 安裝 nvidia Driver
|
||||
|
||||
我還是選擇用 apt 新增ppa 的方式來安裝
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:graphics-drivers/ppa
|
||||
sudo apt update
|
||||
sudo apt install ubuntu-drivers-common
|
||||
sudo apt install nvidia-driver-450
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
重開機後檢查一下是否有成功安裝
|
||||
|
||||
```
|
||||
chchang@hqdc039:~/git/pg-strom$ lsmod|grep nvidia
|
||||
nvidia_uvm 1007616 2
|
||||
nvidia_drm 49152 9
|
||||
nvidia_modeset 1183744 11 nvidia_drm
|
||||
nvidia 19722240 622 nvidia_uvm,nvidia_modeset
|
||||
drm_kms_helper 184320 2 nvidia_drm,i915
|
||||
drm 491520 13 drm_kms_helper,nvidia_drm,i915
|
||||
chchang@hqdc039:~/git/pg-strom$
|
||||
```
|
||||
OK ,看起來應該是沒有問題,接著來安裝 CUDA
|
||||
|
||||
### 安裝 CUDA
|
||||
|
||||
#### 下載 CUDA 安裝檔案
|
||||
```
|
||||
axel -n 10 http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run
|
||||
```
|
||||
|
||||
#### 執行安裝檔案進行安裝
|
||||
|
||||
注意在後面加上了 --override ,這是因為 ubuntu 20.04 預設的 gcc 是 9 ,但是 CUDA 目前還是只支援到 7 ,所以先用override 來解決這個問題,不然會出現 gcc version 的錯誤
|
||||
|
||||
```
|
||||
sudo bash cuda_10.1.243_418.87.00_linux.run --override
|
||||
```
|
||||
|
||||
安裝過程 nvidia 已經做成選單,就選擇要安裝的東西,記得<b>不要</b>選 Driver,因為剛剛已經安裝過了!
|
||||
|
||||
安裝完成後,需要修改一下 bashrc
|
||||
https://cyfeng.science/2020/05/02/ubuntu-install-nvidia-driver-cuda-cudnn-suits/
|
||||
|
||||
```
|
||||
echo '# CUDA Soft Link' >> ~/.bashrc
|
||||
echo 'export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}' >> ~/.bashrc
|
||||
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc
|
||||
source ~/.bashrc
|
||||
```
|
||||
然後確認一下是不是正確安裝了
|
||||
```
|
||||
chchang@hqdc039:~/git/pg-strom$ nvcc --version
|
||||
nvcc: NVIDIA (R) Cuda compiler driver
|
||||
Copyright (c) 2005-2019 NVIDIA Corporation
|
||||
Built on Sun_Jul_28_19:07:16_PDT_2019
|
||||
Cuda compilation tools, release 10.1, V10.1.243
|
||||
chchang@hqdc039:~/git/pg-strom$
|
||||
```
|
||||
|
||||
### 安裝 postgresql
|
||||
|
||||
ubuntu 20.04 預設就是搭載 postgresql 12 ,所以安裝很方便
|
||||
```
|
||||
sudo apt install postgresql-12 postgresql-client-12 postgresql-client-common postgresql-client postgresql-common postgresql-contrib postgresql-server-dev-12
|
||||
```
|
||||
|
||||
### 安裝 pg_strom
|
||||
|
||||
因為pg_strom 一樣也是不支援 gcc9 , g++9 ,所以先安裝會用到的套件
|
||||
```
|
||||
sudo apt install libicu-dev gcc-7 g++-7 libpmem-dev
|
||||
```
|
||||
然後改掉系統上的 gcc / g++
|
||||
|
||||
```
|
||||
sudo unlink /usr/bin/gcc
|
||||
sudo unlink /usr/bin/g++
|
||||
sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc
|
||||
sudo ln -s /usr/bin/g++-7 /usr/bin/g++
|
||||
```
|
||||
|
||||
然後clone pg_strom 回來做編譯, pg_config 的位置要看安裝的版本來決定
|
||||
同時也要修改兩個檔案的link
|
||||
|
||||
|
||||
```
|
||||
sudo ln -snf /usr/lib/postgresql/12/lib/libpgcommon.a /usr/lib/x86_64-linux-gnu/libpgcommon.a
|
||||
sudo ln -snf /usr/lib/postgresql/12/lib/libpgport.a /usr/lib/x86_64-linux-gnu/libpgport.a
|
||||
|
||||
git clone https://github.com/heterodb/pg-strom.git
|
||||
cd pg-strom
|
||||
make PG_CONFIG=/usr/lib/postgresql/12/bin/pg_config
|
||||
sudo make install
|
||||
```
|
||||
這邊成功編譯之後,要來修改一下 postgresql,在 /etc/postgresql/12/main/postgresql.conf 中,加入底下這行
|
||||
|
||||
```
|
||||
shared_preload_libraries = '$libdir/pg_strom'
|
||||
```
|
||||
然後重啟 postgresql service ,觀察一下syslog 有沒有錯誤
|
||||
如果服務有起來,那基本上就安裝成功了
|
||||
|
||||
之後再來找看看有什麼測試pg_strom 的方式
|
||||
|
||||
173
content/post/various-self-hosted-file-sharing-system-test.md
Normal file
173
content/post/various-self-hosted-file-sharing-system-test.md
Normal file
@@ -0,0 +1,173 @@
|
||||
---
|
||||
title: "[筆記] 幾種可以自建服務的 File Sharing 系統比較"
|
||||
date: 2021-06-25T15:49:54+08:00
|
||||
noSummary: false
|
||||
categories: ['筆記']
|
||||
image: [https://h.cowbay.org/images/post-default-18.jpg]
|
||||
tags: []
|
||||
author: "Eric Chang"
|
||||
keywords:
|
||||
- key1
|
||||
- key2
|
||||
---
|
||||
|
||||
感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點
|
||||
|
||||
就把系統弄起來玩玩看,順便建立ansible 的playbook
|
||||
|
||||
<!--more-->
|
||||
|
||||
### linx-server
|
||||
|
||||
https://github.com/andreimarcu/linx-server
|
||||
|
||||
目前已經停止開發的樣子
|
||||
|
||||
有Docker 版本,裝起來很容易,用起來也不難
|
||||
|
||||
可以自行架設伺服器
|
||||
|
||||
可以上傳任意類型的檔案
|
||||
|
||||
可以直接線上分享文字
|
||||
|
||||
可以自定分享密碼
|
||||
|
||||
上傳界面可以鎖密碼,但是鎖了密碼之後,就沒辦法用命令上傳檔案(不知道怎麼帶KEY進去)
|
||||
|
||||
#### 不支援整個目錄上傳
|
||||
|
||||
#### 關於API 如何使用沒有一個完整的說明
|
||||
|
||||
#### 始終找不到怎麼建立API KEY
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
在console 下,可以直接上傳並取得超連結
|
||||
|
||||
```shell
|
||||
chchang@hqdc039:~/docker/linx-server$ cat linx-server.conf
|
||||
bind = 0.0.0.0:7779
|
||||
sitename = myLinx
|
||||
siteurl = https://share.com.tw
|
||||
maxsize = 4294967296
|
||||
maxexpiry = 43200
|
||||
selifpath = s
|
||||
allowhotlink = false
|
||||
remoteuploads = false
|
||||
nologs = true
|
||||
force-random-filename = true
|
||||
cleanup-every-minutes = 5
|
||||
basicauth = false
|
||||
authfile = /data/authfile
|
||||
|
||||
chchang@hqdc039:~/docker/linx-server$ docker-compose up -d
|
||||
Creating linx-server ... done
|
||||
chchang@hqdc039:~/docker/linx-server$ ./linx-client README.md
|
||||
Copied https://share.com.tw/fyd81h81.md into clipboard!
|
||||
chchang@hqdc039:~/docker/linx-server$
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### Psitransfer
|
||||
|
||||
https://github.com/psi-4ward/psitransfer
|
||||
|
||||
不支援command 上傳
|
||||
|
||||
有docker版本,架設容易
|
||||
|
||||
適合給一般使用者用,可以自行設定密碼、保存期限
|
||||
|
||||
比較特別的是下載的連結可以產生QRCODE
|
||||
|
||||
上傳檔案的頁面也可以鎖密碼
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
### pictshare
|
||||
|
||||
https://github.com/HaschekSolutions/pictshare
|
||||
|
||||
有docker版本,但是需要自己手動調整
|
||||
|
||||
不然調整過的config 都會被蓋掉
|
||||
|
||||
調整過後的docker-compose.yml 我放了一份到github 上
|
||||
|
||||
https://github.com/changchichung/docker-compose-pictshare
|
||||
|
||||
需要拿掉pictshare.sh 中,每次自動更新config的部分
|
||||
|
||||
雖然web UI 有點醜,但是基本上想要的功能都有了
|
||||
|
||||
可以用WEB傳,也可以用terminal 傳
|
||||
|
||||
不限制上傳的檔案類型
|
||||
|
||||
可以限制可以上傳的subnet
|
||||
|
||||
回傳的URL 也可以有副檔名,所以可以直接連結當作圖床
|
||||
|
||||
算是很不錯用的了
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
#### upload in terminal
|
||||
|
||||
```shell
|
||||
chchang@hqdc039:~/docker/pictshare$ pict ~/Downloads/images/IMG_20190717_092723.jpg
|
||||
https://share.com.tw/1dpobr.jpg
|
||||
chchang@hqdc039:~/docker/pictshare$
|
||||
|
||||
```
|
||||
|
||||
就先決定用這個 <strong>pictshare</strong> 吧
|
||||
|
||||
|
||||
### 另外推薦的工具 anypaste
|
||||
|
||||
https://github.com/markasoftware/anypaste
|
||||
|
||||
這個雖然不能自己建立服務,需要依賴internet 上已經存在的多個網站服務
|
||||
|
||||
像是 file.io imgur hastebin 等等
|
||||
|
||||
不過呢,如果不是那麼計較安全性,要上傳的檔案不介意丟在internet上公開
|
||||
|
||||
那真的很推薦這個指令,不用安裝有的沒的一大堆,anypaste 本身就是一個script 整合了各家服務的上傳指令
|
||||
|
||||
所以「理論上」 要修改也不是太難..
|
||||
|
||||
跑起來大概像這樣
|
||||
|
||||
```shell
|
||||
chchang@hqdc039:~/docker/pictshare$ anypaste ~/Downloads/images/IMG_20190717_092723.jpg
|
||||
Current file: /home/chchang/Downloads/images/IMG_20190717_092723.jpg
|
||||
Attempting to upload with plugin 'imgur'
|
||||
################################################################################################################# 100.0%
|
||||
|
||||
Link: https://imgur.com/y0Suzjf
|
||||
Direct: https://i.imgur.com/y0Suzjf.jpg
|
||||
Edit: https://imgur.com/edit?deletehashD
|
||||
Delete: https://imgur.com/delete/fNJ
|
||||
|
||||
Upload complete.
|
||||
Sucessfully uploaded: '/home/chchang/Downloads/images/IMG_20190717_092723.jpg'
|
||||
All files processed. Have a nice day!
|
||||
chchang@hqdc039:~/docker/pictshare$
|
||||
```
|
||||
也是非常方便的一個工具,值得推薦!
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user