A VPS service called "lightsail" has started from AWS, so I tried using it as a trial. I wanted to use it as a learning environment for deep learning. I put Jupyter in and started it. The procedure is summarized here.
By the way, what you learn is O'Reilly's "Deep Learning from scratch". Recommended because it is very easy to understand! https://www.oreilly.co.jp/books/9784873117584/
If you have an AWS account
Go to lightsail page
Click "Base OS". Select "Ubuntu" and click "Apps + OS"
I want to use "Nginx" as a reverse proxy, so select "Nginx"
The price plan is of course the cheapest "$ 5"!
Specify the name of the instance to be created this time. This time, I created it with "python-deeplarning-jupyter" (when I actually made it, I misspelled it as depplarning ...) Once you have decided on a name, click "Create"!
You have an instance! Click the link of the created instance.
I want to see Jupyter in the browser, so I will make settings for that.
If the IP changes every time, it will be troublesome to access the browser, so give an Elastic IP (fixed IP) to the instance.
Click Networking on the screen below.
Click "Create Static IP" under Public IP
It is said that you should name the Static IP, so name it appropriately and click "Create"!
Now you have a fixed IP!
Now, let's go into the server and set up Nginx!
I want to SSH to log in to the server, but it's annoying so let's log in from the web console. Click "Connect using SSH" on the screen below.
From here on, work on the console. Rewrite the Nginx configuration file as follows.
sudo vim /opt/bitnami/nginx/conf/bitnami/bitnami.conf
===
upstream jupyter {
server localhost:8888;
}
server {
listen 80;
server_name localhost;
allow xxx.xxx.xxx.xxx;
deny all;
location / {
proxy_pass http://jupyter;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Origin "";
}
}
===
Settings for viewing Jupyter via Nginx. Of course I don't want to be seen by others
allow xxx.xxx.xxx.xxx;
By the way, specify the global IP address of your PC.
As for the setting of location, Jupyter uses WebSocket, so set WebSocket.
If you can do this, restart Nginx. If you don't get an error
sudo /opt/bitnami/ctlscript.sh restart nginx
If you can do so, try accessing Elastic IP (fixed IP) with a browser.
http://xxx.xxx.xxx.xxx
Success when the following screen is displayed!
First, install pip before installing Jupyter. O'Reilly's deep learning book is based on Python3, so I will use it for Python3.
curl -kL https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
curl -kL https://bootstrap.pypa.io/get-pip.py | sudo python3
Next, install Jupyter.
pip3 install jupyter
Create a save destination for files generated within Jupyter. It can be anywhere.
mkdir ~/jupyter
Generate Jupyter configuration file. And edit the configuration file.
jupyter notebook --generate-config
vim ~/.jupyter/jupyter_notebook_config.py
===
#Line 179 Specify the Jupyter file save destination directory. The directory created above.
c.NotebookApp.notebook_dir = '/home/bitnami/jupyter'
#Line 185 When you start Jupyter, the browser starts and it gets in the way, so it is OFF
c.NotebookApp.open_browser = False
===
At this point, start Jupyter.
jupyter notebook
Access the page you saw when checking the operation of Nginx with a browser
http://xxx.xxx.xxx.xxx
Complete when the screen below appears!
So I was able to start Jupter with lightsail. Other AWS services are pay-as-you-go, but this lightsail is a flat rate, so even beginners can rest assured. Recommended for people who don't like VMs because they are heavy.
Recommended Posts