VirtualBox CentOS7
結局CentOS6を入れたあとに、
ptythonとか入れてみたいなー、Twitterbot作ってみたいなーって検索したところで
CentOS7じゃないとサポートしてないばっかりだったので。
①VirtualBox インストール手順 割愛
②今回もIPアドレスは自動で設定 第4オクテット見たらver6入れた時から+①されてた
③ssh接続でTeratarmからrootでログイン
ping飛ばしたら無事0%パケロス
一応有名お買い物サイトにもping飛ばしてパケロス0
④ブラウザからIP叩くと何も見れない
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
systemctl status httpd
systemctl start httpd
systemctl status firewalld
systemctl stop firewalld
systemctl status firewalld
ファイヤーウォール無効にしてもっかいブラウザからアクセス
無事見れました
とりあえず文字入れてみるかー
[root@localhost html]# cat index.html
<h1>hello world</h1>
[root@localhost html]#
無事に反映してくれました
けど、外部からのアクセス許可にはルータ設定いじらないとなのですね
試しにやってみたいけど
んー。。。やめときました。
せっかくCentOS7が無事に入ったので
ついでにdockerも入れてみます
[root@localhost ~]# yum install -y docker
[root@localhost ~]# systemctl enable docker.service
[root@localhost ~]# systemctl start docker.service
[root@localhost ~]# docker -v
Docker version 1.13.1, build 07f3374/1.13.1
[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
1b930d010525: Pull complete
Digest: sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Status: Downloaded newer image for docker.io/hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
[root@localhost ~]# 無事に入ったみたいです 特にファイル設定とかはなかったです
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3106eaed00ba hello-world "/hello" 3 seconds ago Exited (0) 1 second ago ramottest1 ←コンテナ名を指定
e96c6225c0c9 hello-world "/hello" 11 minutes ago Exited (0) 11 minutes ago jovial_leakey ← コンテナ名指定なしで作成したもの
[root@localhost ~]# curl -s https://registry.hub.docker.com/v2/repositories/library/httpd/tags/ | grep -Po '"name":.*?[^\\]",'
"name": "latest",
"name": "2",
"name": "2.4",
"name": "2.4.37",
"name": "alpine",
"name": "2-alpine",
"name": "2.4-alpine",
"name": "2.4.37-alpine",
"name": "2.4.35-alpine",
"name": "2.4.35", ←この数字がタグ名になるらしい docker httpdリポジトリの
[root@localhost ~]# docker run -d -p 8080:80 httpd:2.4.35
ブラウザから【 ホストのIPアドレス:8080】でアクセス
無事にコンテナ内で稼働するWebサーバと通信出来たみたいです