〇Jupyter Widgetsの画面
構築方法
以下のVagrantfileで、Jupyter LabとJupyter Widgetsをインストールした仮想マシン(CentOS7.6)を構築する事ができます。Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-7.6"
config.vm.hostname = "co76jupyterlabmariadb"
config.vm.provider :virtualbox do |vbox|
vbox.name = "co76jupyterlabmariadb"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.104", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.104", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
localectl set-locale LANG=ja_JP.UTF-8
yum install -y epel-release
yum check-update
yum -y update
timedatectl set-timezone Asia/Tokyo
# install node10.x
yum -y install gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_10.x | bash -
yum install -y nodejs
# install anaconda
wget https://repo.anaconda.com/archive/Anaconda3-2018.12-Linux-x86_64.sh
chmod +x Anaconda3-2018.12-Linux-x86_64.sh
./Anaconda3-2018.12-Linux-x86_64.sh -b -p /opt/anaconda
source /opt/anaconda/bin/activate
pip install --upgrade pip
pip install jupyterlab
pip install ipywidgets
jupyter labextension install @jupyter-widgets/jupyterlab-manager
useradd py
mkdir -p /home/py
chown -R py:py /home/py
sudo -u py bash -c "mkdir /home/py/.jupyter"
sudo -u py bash -c "cat << EOF > /home/py/.jupyter/jupyter_notebook_config.py
c.JupyterApp.allow_remote_access = True
c.JupyterApp.ip = '0.0.0.0'
c.JupyterApp.open_browser = False
c.JupyterApp.port = 8080
c.JupyterApp.token = 'jupyter'
EOF"
cat << EOF > /etc/systemd/system/jupyter.service
[Unit]
Description=Jupyter notebook
[Service]
Type=simple
EnvironmentFile=/opt/anaconda/bin/activate
ExecStart=/opt/anaconda/bin/jupyter lab
User=py
Group=py
WorkingDirectory=/home/py
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable jupyter
sudo systemctl start jupyter
echo 'access -> http://192.168.55.104:8080/?token=jupyter'
SHELL
end
0 件のコメント:
コメントを投稿