메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, Hadoop ecosystem, Semantic IoT등의 프로젝트를 진행중에 습득한 내용을 정리하는 곳입니다.
필요한 분을 위해서 공개하고 있습니다. 문의사항은 gooper@gooper.com로 메일을 보내주세요.


Jupyter 우분투 16.04LTS에 Jupyter설치

총관리자 2018.04.17 17:48 조회 수 : 90

0. root로 설치및 실행하는 경우임(홈디렉토리가 /svc/apps/gsda/bin/hadoop/라고 가정함)


1. Jupyter를 아래의 명령으로 설치한다.

   -sudo pip install jupyter 혹은(pip3 install jupyter)


2. Jupyter notebook디폴트 환경설정파일 생성한다.

  - sudo jupyter notebook -- generate-config


3. 사용자 계정 홈 디렉토리에 jupyter라는 이름의 디렉토리를 생성한다.

    (jupyter notebook이 사용할 디렉토리이며 이름은 아무거나 상관없음)

  - mkdir jupyter


4. ipython을 실행하여 Jupyter Notebook 서버에 접속할 때 사용할 패스워드의 해시값을 생성하고 복사해 둔다.


root@gsda4:~/:$ ipython

Python 3.5.2 (default, Nov 23 2017, 16:37:01)

Type 'copyright', 'credits' or 'license' for more information

IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help.


In [1]: from IPython.lib import passwd

In [2]: passwd()

Enter password:

Verify password:

Out[2]: 'sha1:0c46ffd3aab6:9c1bc7d7dad66a2de98c08c331a831a2b86e7aa0'

 *참고 : 패스워드를 12345로 한 경우임


5. 사용자 계정 홈디렉토리에는 숨겨진 디렉토리 .jupyter가 생성되어 있다. 이 디렉토리로 가서 서버 인증서 파일을 아래의 명령으로 생성한다.(https를 적용시에만 사용하고 설정함)

root@gsda4:~/.jupyter# openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

Generating a 1024 bit RSA private key

.............................................++++++

....................................................++++++

writing new private key to 'mycert.pem'

-----

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [AU]:KR

State or Province Name (full name) [Some-State]:Seoul

Locality Name (eg, city) []:Seoul

Organization Name (eg, company) [Internet Widgits Pty Ltd]:FreeL

Organizational Unit Name (eg, section) []:Dev

Common Name (e.g. server FQDN or YOUR name) []:SangHyeonPark

Email Address []:gooper@gooper.com


6. /svc/apps/gsda/bin/hadoop/.jupyter디렉토리에 있는 jupyter_notebook_config.py파일을 열어서 다음 항목을 수정한다.

## The full path to an SSL/TLS certificate file.

c.NotebookApp.certfile = u'/svc/apps/gsda/bin/hadoop/.jupyter/mycert.pem'

(이부분은 https로 접근하기 위해서 설정하는 부분이고 https가 필요하지 않으면 설정하지 않아도 됨)


## The IP address the notebook server will listen on.
c.NotebookApp.ip = '*'

## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = u'/svc/apps/gsda/bin/hadoop/jupyter'

## Whether to open in a browser after starting. The specific browser used is
#  platform dependent and determined by the python standard library `webbrowser`
#  module, unless it is overridden using the --browser (NotebookApp.browser)
#  configuration option.
c.NotebookApp.open_browser = False

#  The string should be of the form type:salt:hashed-password.
c.NotebookApp.password = u'sha1:a334bc73b70e:8c2d56e5dd27deca01bbdb06549655b51af23e6a'
(이것을 설정하지 않으면 jupyter를 실행시마다 발생되는 token을 지정하여 brower에서 notebook을 사용할 수 있음)

## The port the notebook server will listen on.
c.NotebookApp.port = 8888

*참고 : 아무런 인증없이 사용하는 경우는 아래와 같이 ''으로 설정해준다.
c.NotebookApp.token = ''
c.NotebookApp.password = ''

7. jupyter notebook실행(백그라운드로 실행)
jupyter notebook --allow-root &

8. brower로 확인
https://gsda4:8888

* 최초 접근 :  https://gsda4:2244/?token=d3f42fc4f47d22eb421de8cc85953180c15a351a943355f2

*주의 : http로 접근하면 "[W 18:06:51.864 NotebookApp] SSL Error on 10 ('39.115.133.57', 53438): [SSL: WRONG_VERSION_NUMBER] wron number (_ssl.c:645)" 와 같은 Error가 발생하므로 https로 지정해서 접근해야 하며 brower에서 안정하지 않은 연결이 표시되더라도 "안전하지 않은 상태로" 진행하면 로그인 화면이 뜬다.

번호 제목 글쓴이 날짜 조회 수
50 Apache Toree설치(Jupyter에서 Scala, PySpark, SparkR, SQL을 사용할 수 있도록 하는 Kernel) 총관리자 2018.04.17 146
49 Spark Streaming으로 유실 없는 스트림 처리 인프라 구축하기 총관리자 2016.03.11 137
48 scala application 샘플소스(SparkSession이용) 총관리자 2018.03.07 135
47 ./spark-sql 실행시 "java.lang.NumberFormatException: For input string: "1s"오류발생시 조치사항 총관리자 2016.06.09 132
46 JavaStreamingContext를 이용하여 스트림으로 들어오는 문자열 카운트 소스 총관리자 2017.03.30 128
45 streaming작업시 입력된 값에 대한 사본을 만들게 되는데 이것이 실패했을때 발생하는 경고메세지 총관리자 2017.04.03 126
44 start-all.sh로 spark데몬 기동시 "JAVA_HOME is not set"오류 발생시 조치사항 총관리자 2016.08.01 126
43 [Kudu]Schema별 혹은 테이블별 사용량(Replica포함) 구하는 방법 gooper 2022.07.14 121
42 Toree 0.1.0-incubating이 Scala 2.10.4까지만 지원하게 되어서 발생하는 NoSuchMethod오류 문제 해결방법(scala 2.11.x을 지원하지만 오류가 발생할 수 있음) 총관리자 2018.04.20 110
41 kudu 테이블 metadata강제 삭제시 발생하는 오류 메세지 총관리자 2022.01.12 109
40 impala external 테이블 생성시 컬럼과 라인 구분자를 지정하여 테이블 생성하는 예시 총관리자 2020.02.20 108
39 spark 2.0.0를 windows에서 실행시 로컬 파일을 읽을때 발생하는 오류 해결 방법 총관리자 2017.01.12 106
38 참고할만한 spark예제를 설명하는 사이트 총관리자 2016.11.11 98
37 It is indirectly referenced from required .class files 오류 발생시 조치방법 총관리자 2017.03.09 93
36 Impala Admission Control 설정시 쿼리가 사용하는 메모리 사용량 판단 방법 gooper 2023.05.19 93
» 우분투 16.04LTS에 Jupyter설치 총관리자 2018.04.17 90
34 impala session type별 표시되는 정보로 구분하는 방법 총관리자 2021.05.25 90
33 Kudu tablet이 FAILED일때 원인 확인 방법 총관리자 2022.01.17 90
32 hive의 메타정보 테이블을 MariaDB로 사용하는 경우 table comment나 column comment에 한글 입력시 깨지는 경우 utf8로 바꾸는 방법. gooper 2023.03.10 86
31 kudu rebalance수행 command예시 총관리자 2022.01.17 85

A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로