Virtualize (isolate) IBM i python development environment with chroot

I want to try open source software such as python, Node.js, and R on IBM i, but I'm reluctant to try development on the server IBM i environment. .. I thought, so I would like to introduce and utilize chroot.

Try it in the environment where yum is already installed by following the procedure here in advance.

Introducing chroot

Introduce the chroot package provided for IBM i with yum.

bash-4.4$ yum install -y ibmichroot

In the environment I tried, four other packages were also installed.

==================================================================================================
 Package                     Arch                 Version                 Repository         Size
==================================================================================================
Installing:
 ibmichroot                  noarch               2.1.3-0                 ibm                20 k
Installing for dependencies:
 coreutils-gnu               ppc64                8.25-2                  ibm                27 M
 findutils                   ppc64                4.6.0-4                 ibm               1.8 M
 tar-gnu                     ppc64                1.29-1                  ibm               1.1 M
 unzip                       ppc64                6.0-3                   ibm               249 k

Transaction Summary
==================================================================================================
Install       5 Packages

Setting up a chroot environment

It is a function to make an arbitrary directory under / QOpenSys as the root of the virtual environment with chroot. This allows open source to be deployed without affecting the original environment. Here, the root is the directory ** / QOpenSys / chroot_test **. You didn't have to create the directory in advance.

bash-4.4$ chroot_setup /QOpenSys/chroot_test minimal nls

Setup will take a few minutes. Looking at the progress log, it looks like the environment under / QOpenSys is duplicated in the specified directory.


  #####  #     # ######  ####### ####### #######
 #     # #     # #     # #     # #     #    #
 #       #     # #     # #     # #     #    #
 #       ####### ######  #     # #     #    #
 #       #     # #   #   #     # #     #    #
 #     # #     # #    #  #     # #     #    #
  #####  #     # #     # ####### #######    #

  #####  ####### ####### #     # ######
 #     # #          #    #     # #     #
 #       #          #    #     # #     #
  #####  #####      #    #     # ######
       # #          #    #     # #
 #     # #          #    #     # #
  #####  #######    #     #####  #


**********************
Live IBM i session (changes made).
**********************
/QOpenSys/chroot_test
/QOpenSys/chroot_test Does not Exist
+++/QOpenSys/chroot_test creation was successful!+++
Chroot type is: minimal
Chroot type is: nls
=====================================
setting up based on /QOpenSys/pkgs/lib/ibmichroot/config/chroot_minimal.lst
=====================================
action = :file
action = :mkdir
mkdir -p /QOpenSys/chroot_test/QOpenSys/usr/sbin

(Omission)

Extracting the tar file  /QOpenSys/pkgs/lib/ibmichroot/config/icu4c.tar

To enter Your Chroot
RUN: chroot /QOpenSys/chroot_test /QOpenSys/usr/bin/sh

DONE!

Since the created chroot environment is in a clean state, we will introduce the package using yum. First, add ** bash ** and ** yum **.

bash-4.4$ yum --installroot=/QOpenSys/chroot_test install -y bash yum

Prepare yum repolist in chroot environment.

bash-4.4$ mkdir /QOpenSys/chroot_test/QOpenSys/etc/yum/repos.d/
bash-4.4$ cp /QOpenSys/etc/yum/repos.d/ibm.repo /QOpenSys/chroot_test/QOpenSys/etc/yum/repos.d/ibm.repo

Enter the chroot environment

Enter the set up environment. Change the bash prompt to distinguish between sessions.

bash-4.4$ chroot /QOpenSys/chroot_test /QOpenSys/usr/bin/bash
bash-4.4$ export PS1='chroot_test \$ '
chroot_test $

Run Jupyter notebook in chroot environment

I will put python and necessary packages etc. with yum.

chroot_test $ yum install -y python3 python3-pip python3-pyzmq yum-utils vim

Insert Jupyter with pip.

chroot_test $ pip3 install --upgrade pip
chroot_test $ pip3 install jupyter

Generate a Jupyter notebook configuration file.

chroot_test $ jupyter notebook --generate-config
chroot_test $ vim /home/DEMO/.jupyter/jupyter_notebook_config.py

Edit the parameters.

#c.NotebookApp.ip = 'localhost'
c.NotebookApp.ip = 'xxx.xxx.xxx.xxx'

#c.NotebookApp.open_browser = True
c.NotebookApp.open_browser = False

Start Jupyter notebook.

chroot_test $ jupyter notebook
[I 13:12:16.529 NotebookApp] Writing notebook server cookie secret to /home/DEMO/.local/share/jupyter/runtime/notebook_cookie_secret
[I 13:12:16.952 NotebookApp] Serving notebooks from local directory: /
[I 13:12:16.952 NotebookApp] The Jupyter Notebook is running at:
[I 13:12:16.952 NotebookApp] http://xxx.xxx.xxx.xxx:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Access it with a browser and check it.

image.png

You can now use the Jupyter Notebook set up in the chroot environment.

For the setup of jupyter notebook on IBM i, I also referred to the article here!

Recommended Posts

Virtualize (isolate) IBM i python development environment with chroot
Prepare Python development environment with Atom
[Development environment] Python with Xcode [With screen transition]
I tried to build a Mac Python development environment with pythonz + direnv
Build Python development environment with Visual Studio Code
[Python] Build a Django development environment with Docker
Create a Python execution environment on IBM i
Get a quick Python development environment with Poetry
Python development environment construction
About Python development environment
Python environment with docker-compose
python2.7 development environment construction
Development environment in Python
Virtual environment with Python 3.6
Create a python development environment with vagrant + ansible + fabric
I made a Python3 environment on Ubuntu with direnv.
Build a machine learning application development environment with Python
Python development environment with Windows + Anaconda3 + Visual Studio Code
QGIS3 Python plugin development environment construction with VSCode (macOS)
Manage Python runtime packages and development environment packages with Poetry
Python development environment with Windows + Python + PipEnv + Visual Studio Code
Set up a Python development environment with Sublime Text 2
I tried fp-growth with python
I tried scraping with Python
Install Python environment with Anaconda
Manage python environment with virtualenv
I made blackjack with python!
Build python3 environment with ubuntu 16.04
Prepare python3 environment with Docker
Build python environment with direnv
Organize your Python development environment
[ev3dev × Python] Build ev3dev development environment
[MEMO] [Development environment construction] Python
[For organizing] Python development environment
I tried gRPC with Python
I tried scraping with python
I made blackjack with Python.
I made wordcloud with Python.
Unify the environment of the Python development team starting with Poetry
Set up a Python development environment with Visual Studio Code
Video cannot be loaded with Spyder in Python development environment
Prepare Python development environment with Mac + Windows + VisualStudio Code (Windows version)
Prepare Python development environment with Mac + Windows + VisualStudio Code (Mac version)
Get a clean Python development environment with pyenv + pipx + Poetry
How to build a python2.7 series development environment with Vagrant
Create a simple Python development environment with VSCode & Docker Desktop
How to get into the python development environment with Vagrant
I want to set up a GUI development environment with Python or Golang on Mac
I wrote a script to create a Twitter Bot development environment quickly with AWS Lambda + Python 2.7
Get started with Python! ~ ① Environment construction ~
Prepare Python development environment on Ubuntu
Build python virtual environment with virtualenv
Setup modern Python environment with Homebrew
I can't install python3 with pyenv-vertualenv
I checked Mac Python environment construction
I tried web scraping with python.
Build Mysql + Python environment with docker
Create a virtual environment with Python!
I made a fortune with Python.
Prepare your first Python development environment
I sent an SMS with Python