메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.


Jupyter CentOS 7.x에 Jupyter설치

총관리자 2018.04.18 00:05 조회 수 : 751

1. python3.4및 pip3설치

yum install -y epel-release

yum install python34-pip


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

  - pip3.4 install foo


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:a334bc73b70e:8c2d56e5dd27deca01bbdb06549655b51af22e6a'


Do you really want to exit ([y]/n)?


5. 사용자 계정 홈디렉토리에는 숨겨진 디렉토리 .jupyter가 생성되어 있다. 이 디렉토리로 가서 서버 인증서 파일을 아래의 명령으로 생성한다.

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'


## 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'

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

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

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

*주의 : 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에서 안정하지 않은 연결이 표시되더라도 "안전하지 않은 상태로" 진행하면 로그인 화면이 뜬다.


번호 제목 날짜 조회 수
521 lubuntu 호스트 네임변경 2014.08.03 723
520 kudu table와 impala(hive) table정보가 틀어져서 테이블을 읽지 못하는 경우(Error Loading Metadata) 조치방법 2023.11.10 716
519 conda를 이용한 jupyterhub(v0.9)및 jupyter설치 (v4.4.0) 2018.07.30 711
518 uEnv.txt위치및 내용 2014.07.09 710
517 Apache Spark와 Drools를 이용한 CEP구현 테스트 2016.07.15 709
516 kafka-manager 1.3.3.4 설정및 실행하기 2017.03.20 700
515 spark-shell을 실행하면 "Attempted to request executors before the AM has registered!"라는 오류가 발생하면 2018.06.08 699
514 kafka로 부터 메세지를 stream으로 받아 처리하는 spark샘플소스(spark의 producer와 consumer를 sbt로 컴파일 하고 서버에서 spark-submit하는 방법) 2016.07.13 699
513 hadoop 클러스터 실행 스크립트 정리 2018.03.20 698
512 Tracking URL = N/A 가발생하는 경우 - 환경설정값을 잘못설정하는 경우에 발생함 2015.06.17 694
511 컬럼및 라인의 구분자를 지정하여 sqoop으로 데이타를 가져오고 hive테이블을 생성하는 명령문 2018.08.03 692
510 HDFS 파일및 디렉토리 생성시 생성방법에 따라 권한이 다르게 부여된다. 2022.05.30 691
509 원격지에서 zio공유기를 통해서 노트북의 mysql접속을 허용하는 방법 2014.09.07 688
508 not leader of this config: current role FOLLOWER 오류 발생시 확인방법 2022.01.17 682
507 Drools 6.0 - 비즈니스 룰 기반으로 간단한 룰 애플리케이션 만들기 file 2016.07.18 682
506 spark, kafka, mariadb, jena, springframework등을 이용하여 공통모듈을 jar로 만들기 위한 build.gradle파일(참고용) 2016.08.19 681
505 hadoop의 data디렉토리를 변경하는 방법 2014.08.24 675
504 root가 localhost에서 mysql로 접근하지 못하는 경우의 해결방법(패스워드) 2014.09.10 674
503 java.lang.ClassNotFoundException: org.apache.hadoop.util.ShutdownHookManager 오류조치사항 2015.05.20 673
502 anaconda3 (v5.2) 설치및 머신러닝 관련 라이브러리 설치 절차 2018.07.27 672
위로