4.3 jupyterhub_config
生成配置文件,命令:jupyterhub --generate-config
4.3.1 OAuthenticator
安装:pip install oauthenticator
出现Requirement already satisfied,表示成功。
4.3.2 用户配置
创建userlist文件:vim userlist 添加内容
GitHub_profile_name1admin GitHub_profile_name2admin GitHub_profile_name3 将用户添加到系统中,命令:adduser GitHub_profile_name1 按需添加用户
4.3.3 修改配置文件
在jupyterhub_config文件末尾添加以下内容: #---------------------------------------------------------------------------------------------------- # Application configuration #-------------------------------------------------------------------------------------------------------- # This is an application. c.JupyterHub.authenticator_class = 'oauthenticator.GitHubOAuthenticator' c.GitHubOAuthenticator.oauth_callback_url = 'https://your_ip_addrees/hub/oauth_callback' c.GitHubOAuthenticator.client_id = 'Github_OAuth_application_Client ID' c.GitHubOAuthenticator.client_secret = 'Github_OAuth_application_Client Secret ' # This is an application. # create system users that don't exist yet c.LocalAuthenticator.create_system_users = True c.Authenticator.whitelist = {'name1', 'name2', 'name3'} c.Authenticator.admin_users = {'name1', 'name2'} c.Spawner.notebook_dir = '/home/name1/notebooks' c.JupyterHub.ssl_cert = 'mycert.pem' c.JupyterHub.ssl_key = 'mykey.key' 4.4 验证访问
命令:jupyterhub