"mkdir: '/opt/anaconda' 디렉토리를 생성할 수 없습니다: 권한이 거부되었습니다."

"mkdir: '/opt/anaconda' 디렉토리를 생성할 수 없습니다: 권한이 거부되었습니다."

방금 우분투를 설치했습니다. 아나콘다 파이썬 패키지를 다운로드해서 설치해 보았는데,

bash Anaconda-2.1.0-Linux-x86_64.sh

어느 시점에서 터미널은 다음과 같이 말할 것입니다.

Anaconda will now be installed into this location:
/home/*username*/anaconda

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify an different location below

/opt그래서 (적절한 디렉토리라고 들었습니다) 에 설치하고 싶지만 터미널에서는 다음과 같이 말합니다.

mkdir: cannot create directory ‘/opt/anaconda’:Permission denied
ERROR: Could not create directory: /opt/anaconda

sudo설치 프로그램이 실행 중일 때 여기서는 어떻게 사용하는지 모르겠습니다 mkdir. 먼저 직접 디렉토리를 만들어 보았는데 디렉토리가 존재한다는 사실이 오류로 떴습니다. 어떡해?

답변1

그래서 설치하고 싶어요/opt

/opt디렉토리는 루트가 소유하며 일반 사용자는 여기에 쓸 수 없습니다. 루트가 아닌 사용자가 쓸 수 없는 디렉토리에 설치하고 싶다고 anaconda에 알리는 한, 높은 권한을 사용해야 합니다. 설치 프로그램을 시작할 때 처음부터 sudo를 사용해야 합니다.

sudo bash Anaconda-2.1.0-Linux-x86_64.sh
[...]
Anaconda will now be installed into this location:
/home/user/anaconda

  - Press ENTER to confirm the location
  - Press CTRL-C to abort the installation
  - Or specify an different location below

[/home/user/anaconda] >>> /opt/anaconda

Anaconda는 그때까지 아무 것도 작성하지 않으므로 안심하셔도 됩니다.

관련 정보