conda安装_使用conda部署jupyterhub以及ladp验证的安装

1.安装conda3

jupyterhub需要python3环境,python3现在在conda官网之上是配置的conda3,默认现在kylin中环境为conda2,对应着python2,同时/usr/hdp/hdp-select需要py2环境

所以原有机器的anaconda2环境不能变动

官网下载安装anaconda3

wget https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh

然后运行sh脚本即可

conda可以独立创建python3环境,但是会影响到其它组件的安装等,而且spark-sql和hive也均需要py2环境

2.安装jupyterhub

[root@10-112-41-157 .jupyterhub]# conda install -c conda-forge jupyterhub[root@10-112-41-157 .jupyterhub]# conda install notebook

如果执行jupyterhub没有的话,查看/letv/usr/local/anaconda2/envs/jupyterhub_python3/bin目录,如果也没有jupyterhub,则重新执行conda install -c conda-forge jupyterhub命令,可能openssl没有安装成功

3.jupyterhub安装检查

[root@10-127-220-93 .conda]#jupyterhub -h

4.生成config文件

[root@10-127-220-93 .conda]# jupyterhub --generate-config

注意:jupyterhub_config.py文件会在当时执行路径下生成,注意生成之后具体位置的存放,可以直接在/root目录下新建一个隐藏目录,本文中mkdir /root/.jupyterhub

5.加入ladp的验证

安装pip install jupyterhub-ldapauthenticator插件

[root@10-112-41-157 .jupyterhub]# conda install -c conda-forge jupyterhub-ldapauthenticator 

在jupyterhub_config.py文件中查找c.JupyterHub.authenticator_class

加入以下配置文件

c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'c.LDAPAuthenticator.server_address = 'ldap.letv.cn'c.LDAPAuthenticator.lookup_dn = Falsec.LDAPAuthenticator.user_search_base = 'OU=letv,DC=letv,DC=local'c.LDAPAuthenticator.user_attribute = 'sAMAccountName'c.LDAPAuthenticator.escape_userdn = Falsec.LDAPAuthenticator.bind_dn_template = '{username}@le.com'

6.其它配置文件的改动

[root@10-112-41-157 .jupyterhub]# grep ^[^#] jupyterhub_config.py c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'c.LDAPAuthenticator.server_address = 'ldap.letv.cn'c.LDAPAuthenticator.lookup_dn = Falsec.LDAPAuthenticator.user_search_base = 'OU=letv,DC=letv,DC=local'c.LDAPAuthenticator.user_attribute = 'sAMAccountName'c.LDAPAuthenticator.escape_userdn = Falsec.LDAPAuthenticator.bind_dn_template = '{username}@le.com'c.JupyterHub.port = 80c.Spawner.default_url = '/lab'
  • 1.jupyterhub的默认端口为8000,上述例子的参数c.JupyterHub.port改为80即可
  • 2.默认进入jupyterhub的页面为/tree?,将c.Spawner.default_url改为/lab即可
  • 3.jupyterhub默认为非交互模式,所以/etc/profile的环境变量对jupyterhub web中的环境不受影响,所以需要设定/etc/bashrc的值,同时/root/.bashrc中的值在初始安装anaconda3的时候,可能会有写入,注意对整个环境变量的影响,可注释

文中各环境变量为

[root@10-112-41-157 .jupyterhub]# cat /etc/profile以上略export ANACONDA2_HOME=/usr/local/anaconda2export JAVA_HOME=/usr/local/javaexport ANACONDA3_HOME=/letv/anaconda3export PYSPARK_PYTHON=$ANACONDA2_HOME/bin/pythonexport PYSPARK_DRIVER_PYTHON=$ANACONDA2_HOME/bin/pythonexport SPARK_HOME=/usr/hdp/current/spark2-clientexport PYTHONPATH=$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.10.4-src.zipexport PATH=$JAVA_HOME/bin:$ANACONDA2_HOME/bin:$PATH
[root@10-112-41-157 .jupyterhub]# cat /etc/bashrc 以上略export ANACONDA2_HOME=/usr/local/anaconda2export JAVA_HOME=/usr/local/javaexport ANACONDA3_HOME=/letv/anaconda3export PYSPARK_PYTHON=$ANACONDA2_HOME/bin/pythonexport PYSPARK_DRIVER_PYTHON=$ANACONDA2_HOME/bin/pythonexport SPARK_HOME=/usr/hdp/current/spark2-clientexport PYTHONPATH=$SPARK_HOME/python:$SPARK_HOME/python/lib/py4j-0.10.4-src.zipexport PATH=$JAVA_HOME/bin:$ANACONDA2_HOME/bin:$PATH
[root@10-112-41-157 .jupyterhub]# cat /root/.bashrc# .bashrc# User specific aliases and functionsalias rm='rm -i'alias cp='cp -i'alias mv='mv -i'# Source global definitionsif [ -f /etc/bashrc ]; then. /etc/bashrcfi# added by Anaconda3 installer#export PATH="/letv/anaconda3/bin:$PATH"

7.启动jupyterhub

[root@10-112-41-157 .jupyterhub]# /letv/anaconda3/bin/python /letv/anaconda3/bin/jupyterhub --debug &
[root@10-112-41-157 .jupyterhub]# /letv/anaconda3/bin/python /letv/anaconda3/bin/jupyterhub --debug &

因为jupyterhub需要py3环境,而系统环境又必须为py2,所以直接指定jupyterhub启动环境为py3

8.ladp用户登录访问后显示httpd 500

需要在linux系统中使用useradd创建ladp用户,登陆web页面之后,然后start service即可

a33a00a0104b1fa2f57099e91323db2c.png
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值