Weitere ähnliche Inhalte Ähnlich wie ローカル開発環境の構築をしよう VirtualBox + Vagrant (20) ローカル開発環境の構築をしよう VirtualBox + Vagrant39. • Java インストール
$ yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
…
$ java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
$ javac -version
javac 1.8.0_161
40. • Apache インストール
• Apache 起動
$ yum -y install httpd
…
$ httpd -version
Server version: Apache/2.4.6 (CentOS)
Server built: Oct 19 2017 20:39:16
$ systemctl start httpd
…
41. • Tomcat インストール
• Tomcat 起動
$ yum -y install tomcat
…
$ tomcat version
Server version: Apache Tomcat/7.0.76
Server built: Oct 30 2017 10:21:55 UTC
…
$ systemctl start tomcat
…
43. • Firewallの設定
• Apache
• Tomcat
$ firewall-cmd --add-service=http --zone=public —permanent
$ firewall-cmd —reload
# デフォルトに設定がなかったので、tomcat.xmlを作成
$ vim tomcat.xml
$ firewall-cmd --add-service=tomcat --zone=public --permanent
$ firewall-cmd --reload
45. • Apache
• index.htmlの作成
• Tomcat
• sample.warをデプロイ
$ vim /var/www/html/index.html
———
<h1>Hello World</h1>
———
$ ls /usr/share/tomcat/webapps
sample
sample.war
55. • Apache <=> Tomcatの連携
• Apache
• Tomcat
# ProxyPassの追加 Apache -> Tomcat
$ vim /etc/httpd/conf.modules.d/httpd-proxy.conf
ProxyPass /sample/ ajp://192.168.33.10:8009/sample/
# httpd.conf Includeさせる
cat /etc/httpd/conf/httpd.conf | grep Include
Include conf.modules.d/*.conf
…
# 受口を設定 Apache -> Tomcat
$ cat /usr/share/tomcat/conf/server.xml
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
…
67. 仮想マシンの初期化
• VirtualBoxの初期化:vagrant init {boxName}
• Vagrantfileが作成される
$ vagrant init CentOS70
A `Vagrantfile` has been placed in this directory. You are now
…
$ ls vagrant/CentOS70
Vagrantfile
69. 仮想マシンの起動
• VirtualBoxを起動:vagrant up
• 起動されたか確認:vagrant status
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports…
…
$ vagrant status
Current machine states:
default running (virtualbox)
…