IT/clojure

clojure 환경 구성

가능성1g 2025. 2. 27. 10:53
반응형

요즘 함수형 프로그래밍에 대해서 공부를 하고 있다. 

최종적으로는 실무에서 써보고 싶어서 환경은 현재 근무하는 곳의 환경과 최대한 유사하게 구성해 보았다.

 

환경 구성:

Rocky Linux8 (WSL2)

JDK8

clojure

 

1. wsl 설치

wsl --install

 

2. Rokcy Linux8 이미지를 wsl에 임포트

Import Rocky Linux to WSL or WSL2 - Documentation

 

Import Rocky Linux to WSL or WSL2 - Documentation

interoperability windows wsl wsl2Import Rocky Linux to WSLPrerequisitesThe Windows-Subsystem for Linux feature has to be enabled. This is possible with one of these options:This feature should be available on every supported Windows 10 and 11 version right

docs.rockylinux.org

wsl --import  rock8.8_clojure C:\study\wsl\clojure Rocky-8-Container-Base.latest.x86_64.tar.xz --version 2

 

# wsl 기본이미지로 설정

wsl -s rocky8.8

 

이후 작업은 모두 wsl 내의 rocky linux 8 에서 하는 작업 입니다. 

 

3. 리포지터리 활성화

dnf install epel-release

dnf update

 

4. 필수 패키지 설치

dnf insatll rlwrap

dnf install java-1.8.0-openjdk-devel.x86_64

 

5. clojure 설치

curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh

chmod +x linux-install.sh

./linux-install.sh

 

6. 실행 확인

clj

2025년 2월 27일 기준 1.12.0 설치 

 

7. vscode 설치와 플러그인 설치

calva 플러그인 설치

 

8. 샘플프로젝트 시작

ctrl+shift+p 클릭 후 calva create project 입력 후 Calva: Create a Getting Started REPL project 선택

 

Get Started with Clojure - Calva User Guide

 

Get Started with Clojure - Calva User Guide

An interactive guide to get you started with Clojure and Interactive Programming

calva.io

 

9. calva 는 아직 유명하지 않으니 leiningen 을 추가로 설정한다.

Leiningen

 

Leiningen

Leiningen is the easiest way to use Clojure. With a focus on project automation and declarative configuration, it gets out of your way and lets you focus on your code.

leiningen.org

 

wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein

cp lein /usr/local/bin/

chmod a+x /usr/local/bin/lein

lein

 

# 프로젝트 생성

lein new hello

# 프로젝트 실행

lein run -m hello.core

# 프로젝트 컴파일

lein compile hello.core

 

참고 문서

시작하기 · 초보자를 위한 클로저

반응형