Linux 에서 fnm 설치
fnm 은 Linux 에서 여러 설치 방법을 제공합니다. 이 가이드는 다양한 Linux 배포판에서 fnm 을 설치하는 데 도움을 드립니다.
설치 방법
curl 스크립트 사용 (권장)
가장 간단한 설치 방법:
bash
curl -fsSL https://fnm.vercel.app/install | bash설치 후 프롬프트에 따라 Shell 을 다시 로드하거나 수동으로 PATH 에 추가:
bash
export PATH="$HOME/.fnm:$PATH"
eval "$(fnm env --use-on-cd)"Homebrew 사용
Linux 에 Homebrew 가 설치된 경우:
bash
brew install fnm수동 다운로드
- fnm Releases 페이지 방문
- 아키텍처에 맞는 아카이브 다운로드:
bash
# x86_64
wget https://github.com/Schniz/fnm/releases/latest/download/fnm-linux.zip
# ARM64
wget https://github.com/Schniz/fnm/releases/latest/download/fnm-arm64.zip- 압축 해제 및 설치:
bash
unzip fnm-linux.zip -d ~/.local/bin
chmod +x ~/.local/bin/fnm배포판별 설치 가이드
Ubuntu / Debian
bash
# 방법 1: curl 스크립트 사용
curl -fsSL https://fnm.vercel.app/install | bash
# 방법 2: 수동 설치
sudo apt update
sudo apt install -y unzip
wget https://github.com/Schniz/fnm/releases/latest/download/fnm-linux.zip
sudo unzip fnm-linux.zip -d /usr/local/bin
sudo chmod +x /usr/local/bin/fnmCentOS / RHEL / Fedora
bash
# 종속성 설치
sudo dnf install -y unzip # Fedora
# 또는
sudo yum install -y unzip # CentOS/RHEL
# curl 스크립트 사용
curl -fsSL https://fnm.vercel.app/install | bash
# 또는 수동 설치
wget https://github.com/Schniz/fnm/releases/latest/download/fnm-linux.zip
sudo unzip fnm-linux.zip -d /usr/local/bin
sudo chmod +x /usr/local/bin/fnmArch Linux
bash
# AUR 헬퍼 사용
yay -S fnm-bin
# 또는 AUR 에서 빌드
git clone https://aur.archlinux.org/fnm-bin.git
cd fnm-bin
makepkg -siAlpine Linux
bash
# 종속성 설치
apk add bash curl unzip
# curl 스크립트 사용
curl -fsSL https://fnm.vercel.app/install | bash
# 또는 수동 설치
wget https://github.com/Schniz/fnm/releases/latest/download/fnm-linux.zip
unzip fnm-linux.zip -d ~/.local/bin
chmod +x ~/.local/bin/fnmShell 구성
Bash
~/.bashrc 편집:
bash
echo 'eval "$(fnm env --use-on-cd)"' >> ~/.bashrc
source ~/.bashrcZsh
~/.zshrc 편집:
bash
echo 'eval "$(fnm env --use-on-cd)"' >> ~/.zshrc
source ~/.zshrcFish
~/.config/fish/config.fish 편집:
fish
echo 'fnm env --use-on-c | source' >> ~/.config/fish/config.fish
source ~/.config/fish/config.fishShell 완성
Bash 완성
bash
# bash-completion 설치 (설치되지 않은 경우)
sudo apt install bash-completion # Debian/Ubuntu
sudo dnf install bash-completion # Fedora
# 완성 스크립트 추가
fnm completions --shell bash >> ~/.bashrc
source ~/.bashrcZsh 완성
bash
# 완성 디렉토리 생성
mkdir -p ~/.zsh/completions
# 완성 스크립트 생성
fnm completions --shell zsh > ~/.zsh/completions/_fnm
# ~/.zshrc 에 추가
fpath=(~/.zsh/completions $fpath)
autoload -U compinit && compinitFish 완성
bash
fnm completions --shell fish > ~/.config/fish/completions/fnm.fish중국에서 미러 사용
중국 본토에서는 미러를 구성하여 다운로드 속도를 높이는 것이 권장됩니다:
bash
# Shell 구성 파일에 추가
export FNM_NODE_DIST_MIRROR=https://npmmirror.com/mirrors/node
# 또는 eval 에서 지정
eval "$(fnm env --use-on-cd --node-dist-mirror=https://npmmirror.com/mirrors/node)"일반적인 미러:
| 미러 소스 | URL |
|---|---|
| npmmirror | https://npmmirror.com/mirrors/node |
| 칭화대학교 | https://mirrors.tuna.tsinghua.edu.cn/nodejs-release |
| 화웨이 클라우드 | https://mirrors.huaweicloud.com/nodejs |
설치 확인
bash
# fnm 버전 확인
fnm --version
# Node.js 설치
fnm install --lts
# Node.js 확인
node --version
npm --version일반적인 문제
Command Not Found
bash
# fnm 이 PATH 에 있는지 확인
which fnm
# 수동으로 PATH 에 추가
export PATH="$HOME/.fnm:$PATH"
# PATH 에 영구히 추가
echo 'export PATH="$HOME/.fnm:$PATH"' >> ~/.bashrc권한 문제
bash
# fnm 에 실행 권한이 있는지 확인
chmod +x ~/.fnm/fnm
# 또는
chmod +x /usr/local/bin/fnm다운로드 실패
bash
# 미러 사용
export FNM_NODE_DIST_MIRROR=https://npmmirror.com/mirrors/node
fnm install --lts다음 단계
설치 후 다음을 수행할 수 있습니다:
- Node.js 설치 - fnm 을 사용하여 Node.js 설치
- 명령어 참조 - 사용 가능한 모든 명령어 알아보기
- 버전 관리 - 버전 관리 알아보기
관련 링크
- fnm 설치 - 일반 설치 가이드
- Windows 설치 - Windows 설치 가이드
- macOS 설치 - macOS 설치 가이드
- Ubuntu 제거 - Ubuntu 제거 가이드