CentOS7安裝配置jupyterhub

2021-09-21 13:42:27 字數 2322 閱讀 9117

前提已安裝好anaconda3

1、安裝jupyterhub和notebook

$pip install jupyterhub notebook
2、安裝configurable-http-proxy

$npm install -g configurable-http-proxy
如果沒有npm命令,還需要安裝npm

$yum install npm
如果在區域網中需要**才能上網,npm還需要設定proxy。如果第2步的安裝命令要用sudo,這裡設定**也需要加上sudo。

$npm config set proxy 

$npm config set https-proxy

3、配置jupyterhub。在合適位置新建乙個資料夾,比如/etc/jupyterhub,建立乙個配置檔案config.py,我輸入了如下內容。c.spawner.notebook_dir = '~/notebooks' 表示登入使用者的預設notebook資料夾是home目錄下的notebooks。一些額外的環境變數可以在c.spawner.environment中指定,比如ld_library_path。

c.spawner.cmd = ['/anaconda3/bin/jupyterhub-singleuser']

c.spawner.notebook_dir = '~/notebooks'

c.jupyterhub.ip = 'x.x.x.x'

c.jupyterhub.port = 8899

c.spawner.env_keep = ['path', 'pythonpath', 'conda_root', 'conda_default_env', 'virtual_env', 'lang', 'lc_all']

c.spawner.environment =

其實還有很多配置,可以生成乙個預設配置檔案檢視,具體命令:

$jupyterhub --generate-config -f /etc/jupyterhub/jupyterhub_config.py
4、配置notebook。用如下命令生成配置檔案(會生成~/.jupyter/jupyter_notebook_config.py),根據需要修改配置檔案即可

$jupyter notebook --generate-config
5、啟動jupyterhub,如果都安裝正確,jupyterhub應該就正常啟動了。可以在瀏覽器中輸入位址埠(用linux使用者名稱密碼進行登入。啟動命令如下:

/anaconda3/bin/jupyterhub --no-ssl -f /etc/jupyterhub/config.py
6、在jupyter 上 增加核心(bash_kernel)

$pip install bash_kernel

$python -m bash_kernel.install

遇到的問題:

1、使用者登入的過程中報錯:attributeerror: type object 'ioloop' has no attribute 'initialized'進而造成spawner failed to start [status=1]

解決辦法:        

$pip install --upgrade pyzmq notebook
2、使用者登入後,建立新python檔案報錯:attributeerror: module 'tornado.web' has no attribute 'asynchronous'

tornado版本不對,要回退到5.0,解決辦法:        

$pip uninstall tornado

$pip install tornado==5.0

nbconvert需要5.3.1版本,如果版本不對,也如上面那樣重新安裝。

這兩個問題解決後,使用者就可以成功登入使用jupyter-notebook了。

3、發現jupyter-notebook只能成功登入一次,退出後登入或者另一名使用者登入會報如下錯誤:[pam error 7] authentication failure

解決辦法:

在啟動jupyterhub的config檔案中加入下面的設定:

c.pamauthenticator.open_sessions = false

CentOS 7 安裝 配置

本例為 minimal iso 版本 centos 與 rhel 是同源,所以,在 centos 文件不足時,可以參考 rhel 的文件。本例子環境為 windows 可以使用 fedora liveusb creator 或者 ultraiso 等工具來把系統寫入 u盤,而後通過u盤啟動來安裝系統...

CentOS7 安裝配置 vsftpd

yum install y vsftpdvi etc vsftpd vsftpd.confanonymous enable no anonymous enable yes chroot local user yes 去掉前面的注釋 chroot list enable yes chroot list...

CentOS 7 安裝配置FTP

安裝vsftpd yum install y vsftpd編輯ftp配置檔案 vi etc vsftpd vsftpd.conf anonymous enable no anonymous enable yes chroot local user yes 去掉前面的注釋 chroot list en...