A5: 원격컴퓨터에서 개발환경 셋팅하기 (2)

Author

최규빈

Published

December 5, 2023

0. 몇가지 필수 패키지 설치

- 아래를 이용하여 설치

apt-get install unzip 
apt-get install curl 
apt-get install gdebi-core

- apt install vs apt-get install: 예전에는 apt-get이었음. 그래서 오래된 앱은 apt-get만 되는것도 있다고함. (본적은없음)

* apt install / pip install / conda install 차이

  • 설치되는 경로가 다름 (그래서 지우는 법도 다름)
  • apt install 로 설치되는건 우분투 자체의 프로그램
  • pip install 로 설치되는건 파이썬 모듈
  • 우분투자체의 프로그램: Python, CUDA, Anaconda, Quarto, Git, …
  • Python의 모듈: Numpy, Pandas, …
  • conda install: 모든 종류의 프로그램을 다 설치할 수 있음.. (apt, pip로만 설치가능한 것이 콘다로는 싹 설치가능, 심지어 tidyverse같은 R패키지도 설치가능)

1. CodeSpace설치

- 아래를 이용하여 codespace 설치

curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz
tar -xf vscode_cli.tar.gz

- 아래를 이용하여 초기설정 (깃헙아이디로 인증)

./code tunnel 

- 초기설정 이후 아래를 이용하여 백그라운드에서 실행

nohup ./code tunnel > /dev/null 2>&1 &

- 아래의 익스텐션을 설치하면 편리함

2. R과 Jupyter의 연결

- 아래를 이용하여 가상환경생성, 가상환경활성화, 가상환경에R설치,R실행

conda create -n r 
conda activate r 
conda install -c conda-forge r-essentials 
R

- R이 실행되면 아래를 입력

IRkernel::installspec()
q() # 이후에 n을 누르고 빠져나간다.

- 주피터에서 R이 실행되는지 확인한다.

3. 블로그만들기

사용하기 까다로움. (블로그 게시물을 올리는 컴퓨터는 하나로 정리하는게 좋음)

A. Quarto설치

- 아래를 이용해 설치

wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.deb
gdebi quarto-1.3.450-linux-amd64.deb

B. github 토큰얻기

- 아래의 주소로가서 토큰을 생성 (어디에 잘 저장할 것)

https://github.com/settings/tokens

C. github repo 생성후 clone

- 적당한 이름의 repo를 만들것

주의: repository 만들때 readme.md 파일을 생성 할 것. 그래야 이후의 작업이 편리.

- clone이후 local-git과 github를 연결

git clone {복사한주소}
cd {생성된디렉토리}
## README.md 파일 수정 
git add .
git commit -m .
## email, username 등록 
git commit -m .
git config credential.helper store
git push
## username 입력
## token 입력

- blog project 생성후 publish

quarto create-project --type website:blog
git add .
git commit -m .
git push 
quarto publish --no-browser 
## github선택 

- 이후에 수정사항이 생기면 아래를 연속적으로 실행

git add .
git commit -m .
git push 
quarto publish --no-browser --no-prompt 
!git add .
!git commit -m .
!git push 
!quarto publish --no-browser --no-prompt
[main 511b463] .
 2 files changed, 232 insertions(+), 70 deletions(-)
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 16 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 63.26 KiB | 7.91 MiB/s, done.
Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To https://github.com/guebin/STBDA2023.git
   47e83ff..511b463  main -> main
From https://github.com/guebin/STBDA2023
 * branch            gh-pages   -> FETCH_HEAD
Rendering for publish:

[ 1/67] posts/03wk-13.ipynb
[ 2/67] posts/01wk-02.ipynb
[ 3/67] posts/07wk-30.ipynb
[ 4/67] posts/06wk-24.ipynb
[ 5/67] posts/08wk-supp2.ipynb
[ 6/67] posts/12wk-46.ipynb
[ 7/67] posts/12wk-45.ipynb
[ 8/67] posts/03wk-10.ipynb
[ 9/67] posts/07wk-28.ipynb
[10/67] posts/08wk-supp1.ipynb
[11/67] posts/04wk-16.ipynb
[12/67] posts/13wk-48.ipynb
[13/67] posts/05wk-20.ipynb
[14/67] posts/11wk-40.ipynb
[15/67] posts/05wk-21.ipynb
[16/67] posts/13wk-54.ipynb
[17/67] posts/13wk-50.ipynb
[18/67] posts/11wk-42.ipynb
[19/67] posts/10wk-39.ipynb
[20/67] posts/02wk-03.ipynb
[21/67] posts/05wk-19.ipynb
[22/67] posts/03wk-11.ipynb
[23/67] posts/04wk-17.ipynb
[24/67] posts/07wk-35.ipynb
[25/67] posts/11wk-41.ipynb
[26/67] posts/07wk-27.ipynb
[27/67] posts/11wk-43.ipynb
[28/67] posts/13wk-51.ipynb
[29/67] posts/13wk-57.ipynb
[30/67] posts/10wk-38.ipynb

Starting python3 kernel...Done

Executing '10wk-38.ipynb'
  Cell 1/16: ''...Done
  Cell 2/16: ''...Done
  Cell 3/16: ''...Done
  Cell 4/16: ''...Done
  Cell 5/16: ''...Done
  Cell 6/16: ''...Done
  Cell 7/16: ''...Done
  Cell 8/16: ''...Done
  Cell 9/16: ''...Done
  Cell 10/16: ''...Done
  Cell 11/16: ''...Done
  Cell 12/16: ''...Done
  Cell 13/16: ''...Done
  Cell 14/16: ''...Done
  Cell 15/16: ''...Done
  Cell 16/16: ''...Done


Starting python3 kernel...Done

Executing '10wk-38.ipynb'
  Cell 1/16: ''...Done
  Cell 2/16: ''...Done
  Cell 3/16: ''...Done
  Cell 4/16: ''...Done
  Cell 5/16: ''...Done
  Cell 6/16: ''...Done
  Cell 7/16: ''...Done
  Cell 8/16: ''...Done
  Cell 9/16: ''...Done
  Cell 10/16: ''...Done
  Cell 11/16: ''...Done
  Cell 12/16: ''...Done
  Cell 13/16: ''...Done
  Cell 14/16: ''...Done
  Cell 15/16: ''...Done
  Cell 16/16: ''...Done

[31/67] posts/03wk-12.ipynb
[32/67] posts/07wk-32.ipynb
[33/67] posts/09wk-mid.ipynb
[34/67] posts/01wk-01.ipynb
[35/67] posts/06wk-26.ipynb
[36/67] posts/04wk-14.ipynb
[37/67] posts/06wk-23.ipynb
[38/67] posts/04wk-15.ipynb
[39/67] posts/07wk-29.ipynb
[40/67] posts/10wk-37.ipynb
[41/67] posts/10wk-36.ipynb
[42/67] posts/07wk-33.ipynb
[43/67] posts/06wk-22.ipynb
[44/67] posts/06wk-25.ipynb
[45/67] posts/07wk-31.ipynb
[46/67] posts/12wk-44.ipynb
[47/67] posts/13wk-52.ipynb
[48/67] posts/02wk-07.ipynb
[49/67] posts/13wk-55.ipynb
[50/67] posts/07wk-34.ipynb
[51/67] posts/03wk-09.ipynb
[52/67] posts/13wk-53.ipynb
[53/67] posts/02wk-06.ipynb
[54/67] posts/13wk-49.ipynb
[55/67] posts/02wk-04.ipynb
[56/67] posts/13wk-56.ipynb
[57/67] posts/04wk-18.ipynb
[58/67] posts/02wk-08.ipynb
[59/67] posts/02wk-05.ipynb
[60/67] posts/13wk-47.ipynb
[61/67] offline.qmd
[62/67] offline/A5.ipynb
[63/67] offline/A3.ipynb
[64/67] offline/A1.ipynb
[65/67] offline/A2.ipynb
[66/67] offline/A4.ipynb
[67/67] index.qmd

Preparing worktree (resetting branch 'gh-pages'; was at 3ca09fc)
Branch 'gh-pages' set up to track remote branch 'gh-pages' from 'origin'.
HEAD is now at 3ca09fc Built site for gh-pages
[gh-pages 8990107] Built site for gh-pages
 68 files changed, 674 insertions(+), 661 deletions(-)
 create mode 100644 offline/A5_files/figure-html/cf3edf80-1e9a-41e2-ac90-898b3a332280-1-95f7400d-82dd-45a5-913f-d83bd57fcbd3.png
origin  https://github.com/guebin/STBDA2023.git (fetch)
origin  https://github.com/guebin/STBDA2023.git (push)
To https://github.com/guebin/STBDA2023.git
   3ca09fc..8990107  HEAD -> gh-pages

NOTE: GitHub Pages sites use caching so you might need to click the refresh
button within your web browser to see changes after deployment.

[✓] Published to https://guebin.github.io/STBDA2023/

NOTE: GitHub Pages deployments normally take a few minutes (your site updates
will be visible once the deploy completes)