log in
register

[From my gist] Own your free remote Jupyterlab with python, R & octave on AWS

Qingqi@2020-07-07 #tech

post date: 2019-3-20

start a free AWC:

  1. Register an acount with free tier on aws.amazon.com
  2. EC2 -> launch instance -> AMI -> AWS Marketplace -> CentOS 7 (x86_64) - with Updates HVM
  3. Others -> use default setting
  4. launch -> with key pair

connect AWC:

  1. ssh using key pair
  2. username: centos
  3. start to use

install python3:

sudo su
yum -y install wget
yum -y install epel-release
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 libffi-devel python-pip
pip install --upgrade pip
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
tar -xzvf Python-3.7.2.tgz -C /tmp
cd  /tmp/Python-3.7.2/
mkdir /usr/local/python3 
./configure --prefix=/usr/local/python3 --with-ssl
make && make altinstall
ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
ln -s /usr/local/python3/bin/ipython3 /usr/bin/ipython3
yum -y install python-devel
pip3 install --upgrade pip
exit

install jupyterlab

sudu su
pip3 install jupyterlab
ln -s /usr/local/python3/bin/jupyter /usr/bin/jupyter
ln -s /usr/local/python3/bin/jupyter-lab /usr/bin/jupyter-lab
exit
jupyter notebook --generate-config
ipython
from notebook.auth import passwd
passwd()
        Enter password: xxx...
        Verify password: xxx...
        'sha1:xxx...'
exit()
vi ~/.jupyter/jupyter_notebook_config.py 
        c.NotebookApp.ip='*'
        c.NotebookApp.password = u'sha1:xxx...'
        c.NotebookApp.open_browser = False
        c.NotebookApp.port = 8888
        c.NotebookApp.allow_remote_access = True
sudo su
yum install firewalld
systemctl enable firewalld
firewall-cmd --zone=public --add-port=8888/tcp --permanent
systemctl restart firewalld.service
iptables -L -n
exit

install python, R & octave kernel

sudo su
python -m pip install ipykernel
python -m ipykernel install --user
yum -y install R 
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()
q()
yum install octave
pip install octave_kernel
exit

lunch jupyterlab

nohup jupyter lab &

use jupyter lab

yourip:8888/lab

build octave from source (TL;NR)

sudo su
yum -y install yum-utils
yum-builddep -y octave
yum -y install qt-devel mercurial gcc-c++ lapack-devel libtool
yum -y install epstool transfig pstoedit qscintilla-devel

    download github.com/opencollab/arpack-ng
cd arpack-ng-master
autoreconf -vif
mkdir /usr/local/arpack
./configure --prefix="/usr/local/arpack"
make; make install

yum -y remove automake
yum -y install intltool.noarch
yum -y install libtool.x86_64

# question :automake 1.14 needed, not 1.13
cd /usr/local/
mkdir automake
cd automake/
wget http://ftp.gnu.org/gnu/automake/automake-1.14.tar.gz
tar xvzf automake-1.14.tar.gz
cd automake-1.14
./configure
make
make install
ln -s /usr/local/automake/automake-1.14/bin/automake /usr/bin/automake

# question:libtool need automake 1.13
cd /usr/local/
mkdir libtool
cd libtool/
wget http://gnuftp.uib.no/libtool/libtool-2.4.tar.gz
tar xvzf libtool-2.4.tar.gz
cd libtool-2.4
./configure
make
make install
ln -s /home/centos/libtool-2.4/libtool /usr/bin/libtool
ln -s /home/centos/libtool-2.4/libtoolize /usr/bin/libtoolize

cd ~ #(/home/centos)
mkdir -p /usr/local/octave/dev
mkdir src build
cd src
hg clone http://hg.savannah.gnu.org/hgweb/octave
cd octave
./bootstrap
cd ../../build
../src/octave/configure --prefix=/usr/local/octave/dev
make -j6 all
make check
make install
Comments

Log in to add your comment

Don't have an account? register here