FrameWork/Django

AWS EC2, Ubuntu에서 Django 프로젝트 배포하기 - 1) 인스턴스 생성 , 우분투 접속, anaconda 설치

print(blue) 2023. 5. 22. 16:45

🔔 인스턴스 생성 , 우분투 접속, anaconda 설치

 

1.  AWS EC2 인스턴스 생성

<사진은 참고용으로 새로 만들어 찍음>

인스턴스 이름 : test_site

어플리케이션 및 os : Ubuntu

키페어 : 기존에 가지고 있는 coupang 키페어사용

네트워크 : 사진참고

스토리지(볼륨) : 40GiB

 

 


2.  Ubuntu 접속

test_site 인스턴스의 퍼블릭 IPv4 주소를 확인하기

나같은 경우 바탕화면에 키페어가 있음

C:\Users\YOUNG_FUNNY\Desktop>ssh -i coupang.cer ubuntu@<퍼블릭 IPv4 주소>

 


3.  아나콘다 설치 

1) 시스템 패키지 업데이트

$ sudo apt update

 

2) codna 설치 

https://repo.anaconda.com/archive/ 접속 후 원하는 버전 링크 주소 복사하기

$ wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh

 

3) 스크립트 실행

$ bash Anaconda3-2023.03-1-Linux-x86_64.sh

 

실행 후 "yes" 입력 후 설치 후 소프트웨어의 설치 경로 기억하기

설치 경로 표시

 

 

4) codna 경로 추가

$ export PATH=/home/ubuntu/anaconda3/bin:$PATH

만약 경로를 추가해도 command not found가 계속 뜨는 경우

참고 :

1- https://itslinuxfoss.com/fix-conda-command-not-found-error/
2 - https://ttrlog.tistory.com/entry/command-not-found-%EC%9A%B0%EB%B6%84%ED%88%AC

 

command not found 우분투

우분투 컴파일시에 아래와 같은 오류가 난다면, 아마도 업그레이드를 했거나 권한이 없어서 일수 있다 아래와 같이 commands.db를 일기 권한을 주면 된다 sudo chmod a+r /var/lib/command-not-found/commands.db

ttrlog.tistory.com

 

 


4.  conda activate 가상환경

codna 가상환경을 만들고 실행하려던 도중 에러 발생

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

 

 

일단 하라는대로 

 

$ conda init bash

실행해도 변경 사항도 없고, 다시 우분투 접속해도 해결이 되지 않음

 

해결 방안 : conda.sh가 있는 경로를 찾아내어 source 명령어 실행하기

source 명령어 :  스크립트 파일을 수정한 후에 수정된 값을 바로 적용하기 위해 사용하는 명령어

$ source ~/anaconda3/etc/profile.d/conda.sh

참고 : https://velog.io/@zxxzx1515/%EC%98%A4%EB%A5%98-%EB%85%B8%ED%8A%B8-CommandNotFoundError-Your-shell-has-not-been-properly-configured-to-use-conda-activate

 

[오류 노트] CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.

linux 환경에서 conda 가상환경을 만들고 실행하려던 도중 에러가 발생했다. 일단 하라는 대로 $ conda init bash 를 실행했다. 변경 사항은 없었고, 껐다 켜도 해결이 되지 않았다. 나는 두가지 방법으

velog.io

 

 

만약 해결이 됐다면 !

ubuntu@ip<~~>:~$ conda activate
(base) ubuntu@ip<~~>:~$