――I want to do this and that of the company with Python --Operate GitLab (aggregate and post issues) --In addition to engineers, people who do not have a development environment also use it (managers and management people) ――This time, I will use a library collection called Anaconda.
OS Version
[root@XXX ~]# cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)
--If you want to specify the version, you can select it from Repository.
[root@XXX tmp]# cd /tmp
[root@XXX tmp]# curl https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh -O
Install
[root@XXX tmp]# bash ./Anaconda3-5.3.1-Linux-x86_64.sh
--Interactive format excerpt below
Please, press ENTER to continue
>>> *Enter male
Do you approve the license terms? [yes|no]
>>>yes
Anaconda3 will now be installed into this location:
/root/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/root/anaconda3] >>> *Enter male
Do you wish the installer to initialize Anaconda3
in your /root/.bashrc ? [yes|no]
[no] >>> yes
[root@XXX tmp]# source ~/.bashrc
[root@XXX tmp]# anaconda -V
anaconda Command line client (version 1.7.2)
--Already in jupyter when you put Anaconda --If you want to use it only locally, check the Path and then suddenly check the startup and OK.
[root@XXX tmp]# jupyter --version
4.4.0
[root@XXX tmp]# jupyter --path
config:
/root/.jupyter
/root/anaconda3/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter
data:
/root/.local/share/jupyter
/root/anaconda3/share/jupyter
/usr/local/share/jupyter
/usr/share/jupyter
runtime:
/run/user/0/jupyter
――The point is to start operation before a scary person asks, "Is this security okay?" (Digression) --If you have a sense of speed (?) (Digression) ――I think it's okay to tell the director appropriately, such as preparing a Web Page that collects statistics on GitLab issues (digression). --If you are worried, let's allow only a specific ip in the setting
--You will be asked for your password when you access it from your browser
--Pytnon's library for interactively hashing passwords
[root@XXX ~]# ipython
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:8e9f3XXXXXXXXXXXXXXXXXXXXXXXX'
In [3]: exit
--Created with cmd, but the contents are commented out, and if nothing is set, it will work by default (should)
--Since there are many contents, if you want to make a simple setting file, you can create the following path file with touch
and handwrite the setting.
[root@XXX tmp]# jupyter notebook --generate-config
Writing default config to: /root/.jupyter/jupyter_notebook_config.py
--The following is described in /root/.jupyter/jupyter_notebook_config.py
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888 #Defalt
c.NotebookApp.password = u'sha1:8e9f3XXXXXXXXXXXXXXXXXXXXXXXX'
c.NotebookApp.notebook_dir = '/root/jupyter_files/'
--This and what you wrote in jupyter_notebook_config.py
[root@XXX ~]# firewall-cmd --add-port=8888/tcp --zone=public --permanent
success
[root@XXX ~]# firewall-cmd --add-service=http --zone=public --permanent
success
[root@XXX ~]# firewall-cmd --reload
success
[root@XXX ~]# firewall-cmd --list-ports --zone=public
8888/tcp
--Speaking jupyter notebook
to complete
[root@XXX ~]# jupyter notebook
#If you are logged in as root, you need the ↓ option
[root@XXX ~]# jupyter notebook --allow-root
[I 10:17:31.193 NotebookApp] JupyterLab extension loaded from /root/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 10:17:31.194 NotebookApp] JupyterLab application directory is /root/anaconda3/share/jupyter/lab
[I 10:17:31.196 NotebookApp] Serving notebooks from local directory: /root/jupyter_files
[I 10:17:31.197 NotebookApp] The Jupyter Notebook is running at:
[I 10:17:31.197 NotebookApp] http://${hostname} or 127.0.0.1):8888/
--If connections from other hosts are not allowed, localhost
will be displayed, so I suspect Typo (commandment).
--The c.NotebookApp.ip ='*'
in "jupyter_notebook_config.py" may become c.NoebookApp.ip ='*'
[I 10:17:31.197 NotebookApp] The Jupyter Notebook is running at:
[I 10:17:31.197 NotebookApp] http://localhost:8888/
--If you leave the console closed or Ctrl + C
, jupyter will also end, so run it as a service.
[root@XXX ~]# touch /etc/systemd/system/notebook.service
[root@XXX ~]# vi /etc/systemd/system/notebook.service
--ʻExecStart` command requires option for root --For details, refer to the startup confirmation section above.
[Unit]
Description = Jupyter Notebook
[Service]
Type=simple
PIDFile=/var/run/jupyter-notebook.pid
ExecStart=/root/anaconda3/bin/jupyter notebook # `$ which jupyter`Confirm with
WorkingDirectory=/root #Home directory of users who have installed Anaconda(Immediately after login`$pwd`)
User=root #Username that introduced Anaconda`$ id`
Group=root #Group name to which the user who introduced Anaconda belongs
Restart=always
[Install]
WantedBy = multi-user.target
[root@XXX ~]# $ systemctl list-unit-files --type=service
#Start-up
[root@XXX ~]# systemctl start notebook
#Start confirmation
[root@XXX ~]# systemctl status notebook
#Set to start automatically at startup
[root@XXX ~]# systemctl enable notebook
-Is jupyter watching the port --Firewall settings and confirmation
-Basic settings -[Make it a service]([https://qiita.com/hiroseabook/items/1da01ea439b01c1eb48c#5-systemd-%E3%81%A7-jupyternotebook-%E3%82%92%E3%82%B5%E3% 83% BC% E3% 83% 93% E3% 82% B9% E5% 8C% 96% E3% 81% 99% E3% 82% 8B](https://qiita.com/hiroseabook/items/1da01ea439b01c1eb48c#5 -systemd-makes -jupyter notebook- a service))
Recommended Posts