๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
IT-Engineering/Linux

๋ฆฌ๋ˆ…์Šค(Linux) ์šฐ๋ถ„ํˆฌ(Ubuntu) Singularity ์„ค์น˜ ๋ฐฉ๋ฒ•

by ๐Ÿงž‍โ™‚๏ธ 2021. 10. 2.
๋ฐ˜์‘ํ˜•

๋ฆฌ๋ˆ…์Šค(Linux)์—์„œ Singularity ์„ค์น˜ํ•˜๋Š” ๋ฐฉ๋ฒ•

 

Singularity๋Š” ๋„์ปค(Docker)์™€ ์œ ์‚ฌํ•œ ์ปจํ…Œ์ด๋„ˆ(Container) ์‹œ์Šคํ…œ์œผ๋กœ ๋„์ปค์˜ ๋‘๊ฐ€์ง€ ๋‹จ์ (ํŒŒ์ผ ์‹œ์Šคํ…œ ๊ฒฉ๋ฆฌ, ์‚ฌ์šฉ์ž ID ๋ฌธ์ œ)์„ ํ•ด๊ฒฐํ•œ ์‹œ์Šคํ…œ์œผ๋กœ ๋ฐฐ์น˜ ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ ๋“ฑ์˜ ๋‹ค๋ฃจ๋Š” ๋ฌธ์ œ์— ๋”ฐ๋ผ ๋„์ปค๋ฅผ ๋Œ€์ฒดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค๋งŒ, ๋„์ปค์˜ ์ƒํƒœ๊ณ„๊ฐ€ ํ›จ์”ฌ ํฌ๊ณ  ๊ฐ€์žฅ ๋Œ€์„ธ๋กœ ๊ตฌ์ถ•๋˜์–ด์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ผ๋ฐ˜์ ์ธ ์ปจํ…Œ์ด๋„ˆ ์‹œ์Šคํ…œ์„ ์ด์šฉํ•˜๊ณ ์ž ํ•˜๋Š” ๊ฒฝ์šฐ ๋„์ปค๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ์—ฌ๋Ÿฌ๋ชจ๋กœ ๋ฐ”๋žŒ์งํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

โ€ปSingularity๊ฐ€ ๋„์ปค์˜ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•œ ๋ฐฉ๋ฒ•

  1. ์ปจํ…Œ์ด๋„ˆ๋Š” ํ˜ธ์ŠคํŠธ ํŒŒ์ผ ์‹œ์Šคํ…œ์— ์ž๋™์œผ๋กœ ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค( $HOME, $PWD, ๋ฐ /tmp์ž๋™์œผ๋กœ ๋งˆ์šดํŠธ๋จ).
  2. ์ปจํ…Œ์ด๋„ˆ๋Š” ํ˜„์žฌ ์‚ฌ์šฉ์ž๋กœ ์ž๋™์œผ๋กœ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

 

๋ณธ ํฌ์ŠคํŒ…์—์„œ๋Š” ์ด๋Ÿฌํ•œ ์ปจํ…Œ์ด๋„ˆ ์‹œ์Šคํ…œ์ธ Singularity์˜ ์„ค์น˜ ๋ฐฉ๋ฒ•์„ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. Singularity ๋ฒ„์ „์€ ์ตœ์‹ ๋ฒ„์ „์ธ 3.8๋กœ ์„ ํƒํ•˜์˜€์œผ๋ฉฐ, ์ž‘์—… ํ™˜๊ฒฝ์€ ์šฐ๋ถ„ํˆฌ(Ubuntu) 20.04 LTS์ž…๋‹ˆ๋‹ค.

 

 1. ์˜์กด์„ฑ ํŒจํ‚ค์ง€ ์„ค์น˜

์ €๋Š” ์šฐ๋ถ„ํˆฌ(Ubuntu) ํ™˜๊ฒฝ์—์„œ ์‚ฌ์šฉํ•˜์˜€๊ธฐ ๋•Œ๋ฌธ์— apt-get์„ ์ด์šฉํ•˜์—ฌ ์˜์กด์„ฑ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

sudo apt-get update && sudo apt-get install -y \
    build-essential \
    libssl-dev \
    uuid-dev \
    libgpgme11-dev \
    squashfs-tools \
    libseccomp-dev \
    wget \
    pkg-config \
    git \
    cryptsetup

 

 2. Go ์„ค์น˜

Go๋Š” ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์˜ ํ•˜๋‚˜๋กœ, Singularity๋ฅผ ์„ค์น˜ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” Go๋ฅผ ์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. Go ์›น์‚ฌ์ดํŠธ์—์„œ ์ง์ ‘ ๋ณด๋ฉด์„œ ์„ค์น˜ํ•ด๋„ ๋ฉ๋‹ˆ๋‹ค๋งŒ, ์ตœ์‹  ๋ฒ„์ „์ด Singularity ์„ค์น˜ ๋งค๋‰ด์–ผ๊ณผ ๋ฒ„์ „์ด ๋งž์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋ฅผ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•ด์„œ ์„ค์น˜ํ•˜์‹œ๊ธฐ๋ฅผ ์ถ”์ฒœ๋“œ๋ฆฝ๋‹ˆ๋‹ค. Go ์„ค์น˜ ๋ฐฉ๋ฒ• ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.

export VERSION=1.16.4 OS=linux ARCH=amd64 && \  # Replace the values as needed
  wget https://dl.google.com/go/go$VERSION.$OS-$ARCH.tar.gz && \ # Downloads the required Go package
  sudo tar -C /usr/local -xzvf go$VERSION.$OS-$ARCH.tar.gz && \ # Extracts the archive
  rm go$VERSION.$OS-$ARCH.tar.gz    # Deletes the ``tar`` file

์ด์™€ ๊ฐ™์ด ํ•˜๋ฉด /usr/local ๋””๋ ‰ํ† ๋ฆฌ ์•„๋ž˜์˜ ๊ฒฝ๋กœ์— go ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํ™˜๊ฒฝ๋ณ€์ˆ˜ ์„ค์ •์„ ํ•ด์ฃผ์–ด์•ผ ํ•˜๋Š”๋ฐ, home ๊ฒฝ๋กœ์˜ .bashrc์— ์•„๋ž˜์™€ ๊ฐ™์€ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด ํ•œ๋ฒˆ์— ํ™˜๊ฒฝ๋ณ€์ˆ˜๋ฅผ ์„ค์ •ํ•ด์ค๋‹ˆ๋‹ค.

echo 'export PATH=/usr/local/go/bin:$PATH' >> ~/.bashrc && \
  source ~/.bashrc

ํ˜น์‹œ Go์˜ ๋‹ค๋ฅธ ๋ฒ„์ „์ด ์„ค์น˜๋˜์–ด ์žˆ์–ด์„œ ์ถฉ๋Œ์ด ๋‚  ๊ฒฝ์šฐ ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด go๋ฅผ ์™„์ „ ์‚ญ์ œํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค. ํ•ด๋‹น ๋ช…๋ น์–ด๊ฐ€ ์ˆ˜ํ–‰ ๋œ ๋’ค์— ์œ„์˜ ์ˆœ์„œ๋Œ€๋กœ ๋‹ค์‹œ ํ•œ๋ฒˆ ์ˆ˜ํ–‰ํ•˜์‹œ๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.

rm -rf /usr/local/go

 

  3. Singularity ์„ค์น˜

์ด์ œ Singularity๋ฅผ ์„ค์น˜ํ•  ์ฐจ๋ก€์ž…๋‹ˆ๋‹ค. ์•ž์„œ ์˜์กด์„ฑ ์žˆ๋Š” ํŒจํ‚ค์ง€๋“ค๊ณผ Go๊ฐ€ ์ œ๋Œ€๋กœ ์„ค์น˜๋˜์—ˆ๋‹ค๋ฉด, ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋กœ Singularity๋ฅผ ์„ค์น˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

export VERSION=3.8.1 && # adjust this as necessary \
    wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-ce-${VERSION}.tar.gz && \
    tar -xzf singularity-ce-${VERSION}.tar.gz && \
    cd singularity-ce-${VERSION}

 

์—ฌ๊ธฐ๊นŒ์ง€ ์™„๋ฃŒ๋˜๋ฉด, Singularity ์ €์žฅ์†Œ(Repository)์—์„œ ์†Œ์Šค(Source)๋ฅผ ๋ฐ›์•„์˜จ ์ƒํƒœ์ž…๋‹ˆ๋‹ค. ์†Œ์Šค ์ƒํƒœ์ด๊ธฐ ๋•Œ๋ฌธ์— ์‹คํ–‰ํŒŒ์ผ์„ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ์ปดํŒŒ์ผ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์œ„์˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ–ˆ๋‹ค๋ฉด singularity ๊ฒฝ๋กœ์— ์œ„์น˜ํ•˜๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ”๋กœ ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ด์ค๋‹ˆ๋‹ค.

./mconfig && \
    make -C builddir && \
    sudo make -C builddir install

์—ฌ๊ธฐ๊นŒ์ง€ ์™„๋ฃŒ๊ฐ€ ๋˜์—ˆ๋‹ค๋ฉด, bash ์ƒํƒœ์—์„œ singularity ์„ค์น˜ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

singularity --version

์ด๋ ‡๊ฒŒ ์ž…๋ ฅํ–ˆ์„ ๋•Œ ์•„๋ž˜์™€ ๊ฐ™์ด ๋‚˜์˜ค๋ฉด ์ •์ƒ ์„ค์น˜๊ฐ€ ์™„๋ฃŒ๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

singularity-ce version 3.8.1

 


์ฐธ๊ณ ์‚ฌ์ดํŠธ

1. Singularity ์„ค์น˜ ๋งค๋‰ด์–ผ: https://sylabs.io/guides/3.8/user-guide/quick_start.html#quick-installation-steps

 

Quick Start — SingularityCE User Guide 3.8 documentation

SingularityCE v3 and above is written primarily in Go, so you will need Go installed to compile it from source. Note If you have previously installed Go from a download, rather than an operating system package, you should remove your go directory, e.g. rm

sylabs.io

2. Go ์„ค์น˜ ๊ด€๋ จ: https://golang.org/doc/install

 

Download and install - The Go Programming Language

Download and install Download and install Go quickly with the steps described here. For other content on installing, you might be interested in: 1. Go download. Click the button below to download the Go installer. Download Go Don't see your operating syste

golang.org

3. Singularity ๊ด€๋ จ: https://sylabs.io/singularity/

 

Singularity

Singularity provides a single universal on-ramp from developers’ workstations to local resources, the cloud, and all the way to edge.

sylabs.io

4. Go ๊ด€๋ จ: https://golang.org/

 

The Go Programming Language

Download Go Binary distributions available for Linux, macOS, Windows, and more. // You can edit this code! // Click here and start typing. package main import "fmt" func main() { fmt.Println("Hello, ไธ–็•Œ") } Hello, World! Conway's Game of Life Fibonacci

golang.org

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€