1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

短編映画「Hello, world!インセプション」

Last updated at Posted at 2020-12-08

第1階層 Windows

image.png

ファイル名を指定して実行

cmd

Microsoft Windows [Version 10.0.19042.630]
(c) 2020 Microsoft Corporation. All rights reserved.

C:\Users\user>

>echo "Hello, world!"

C:\Users\user>echo "Hello, world!"
"Hello, world!"

第2階層 Ubuntu (WSL)

image.png

>wsl

C:\Users\user>wsl
user@DESKTOP-EPGPMTG:/mnt/wsl/docker-desktop-bind-mounts/Ubuntu-20.04/7272****$

$ echo "Hello, world!"

user@DESKTOP-EPGPMTG:/mnt/wsl/docker-desktop-bind-mounts/Ubuntu-20.04/7272****$ echo "Hello, world!"
Hello, world!

第3階層 Amazon Linux (EC2)

image.png

$ ssh -i "****.pem" ec2-user@ec2-****.us-east-2.compute.amazonaws.com


user@DESKTOP-EPGPMTG:~$ ssh -i "****.pem" ec2-user@ec2-****.us-east-2.compute.amazonaws.com
Last login: *** ***  * **:**:** 2020 from ****.**.**

       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-2/
[ec2-user@ip-**** ~]$

$ echo Hello, world!

[ec2-user@ip-**** ~]$ echo Hello, world!
Hello, world!

第4階層 CentOS (Docker)

image.png

$ docker run -it centos /bin/bash

[ec2-user@ip-**** ~]$ docker run -it centos /bin/bash
[root@**** /]#

# echo "Hello, world!"

[root@**** /]# echo "Hello, world!"
Hello, world!

第5階層 Python

image.png

# yum install python3
# python3

[root@**** /]# yum install python3
[root@**** /]# python3
Python 3.6.8 (default, Apr 16 2020, 01:36:27)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

>>> print ("Hello, world!")

>>> print ("Hello, world!")
Hello, world!

脱出

>>> exit()
[root@**** /]# exit
exit
[ec2-user@ip-**** ~]$ exit
logout
Connection to ec2-****.us-east-2.compute.amazonaws.com closed.
user@DESKTOP-EPGPMTG:~$ exit
logout

C:\Users\user>exit

エピローグ

 実際の映画(?)ではここで謎の男が出てきてexitと入力すると主人公の存在が消えてしまいます。

 あと、一点つまづいた点として、wslがWindowsディレクトリのままいるとssh接続する時にPermissionエラーが出てしまうので、WSLのフォルダに入れた後にchmod 400しないといけませんでした。WSLからssh接続する時にLoad key "****.pem": bad permissions. Permission denied (publickey,gssapi-keyex,gssapi-with-mic).というエラーが出てくる時は参考ページの通りにやると上手くいきます(検索用要約)。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?