log in
register

[CSDN博客旧文] 在centos7上搭建jupyter lab服务器

Qingqi@2020-07-07 #tech

原日期: 2018-4-21

购买服务器

选择centos7操作系统

安装jupyter lab

  • 安装setuptools
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
  • 安装pip
wget https://files.pythonhosted.org/packages/ae/e8/2340d46ecadb1692a1e455f13f75e596d4eab3d11a57446f08259dee8f02/pip-10.0.1.tar.gz
tar -xzvf pip-10.0.1.tar.gz
cd pip-10.0.1
python setup.py install
cd ~
  • 安装gcc
yum install gcc
  • 安装python-devel
yum install python-devel  
  • 安装jupyterlab
pip install jupyterlab

添加远程访问jupyter notebook的功能

  • 生成配置文件
jupyter notebook --generate-config
  • 打开ipython,创建一个密文的密码,以123456为例
ipython
from notebook.auth import passwd
passwd()
Enter password: 123456
Verify password: 123456
'sha1:e00ee9ab9a42:22e8c0dc771612348eeee698cde8ec77fba42e7f'
exit()
c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha1:e00ee9ab9a42:22e8c0dc771612348eeee698cde8ec77fba42e7f'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888

防火墙开放8888端口

firewall-cmd --zone=public --add-port=8888/tcp --permanent
systemctl restart firewalld.service
iptables -L -n

关闭firewall(不推荐)

systemctl stop firewalld.service 
systemctl disable firewalld.service 
firewall-cmd --state 

安装python3.62和jupyterlab的python3解释器

yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
tar -xvJf  Python-3.6.2.tar.xz
cd Python-3.6.2
./configure --prefix=/usr/local/python3
make && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
cd ~
pip3 install --upgrade pip
python3 -m pip install ipykernel
python3 -m ipykernel install --user

安装R和jupyterlab的R解释器

yum -y install epel-release
yum -y install R 
yum -y install curl 
yum -y install libcurl libcurl-devel 
yum -y install libxml2 libxml2-devel 


R
install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest'))
devtools::install_github('IRkernel/IRkernel')
IRkernel::installspec()

启动jupyter notebook:

nohup jupyter lab --allow-root &

登录jupyter lab

http://服务器ip地址:8888/lab

Comments

Log in to add your comment

Don't have an account? register here