OpenJDKとTomcat8を入れてwebappのサンプルとしてGitBucketを動作させる
インストール
root@cheddar:~# apt search tomcat
Sorting... Done
Full Text Search... Done
root@cheddar:~#
あれ?
調べてみると、なるほど、Universeリポジトリ。
root@cheddar:~# add-apt-repository "deb http://jp.archive.ubuntu.com/ubuntu/ bionic universe"
root@cheddar:~# apt install tomcat8
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
authbind ca-certificates-java default-jre-headless java-common
libcommons-collections3-java libcommons-dbcp-java libcommons-pool-java
libecj-java libjpeg-turbo8 libjpeg8 liblcms2-2 libpcsclite1 libtcnative-1
libtomcat8-java libxi6 libxrender1 libxtst6 openjdk-11-jre-headless
tomcat8-common x11-common
Suggested packages:
default-jre libcommons-collections3-java-doc libcommons-dbcp-java-doc
libgeronimo-jta-1.1-spec-java ant ecj liblcms2-utils pcscd libnss-mdns
fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho
fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic tomcat8-admin tomcat8-docs
tomcat8-examples tomcat8-user
The following NEW packages will be installed:
authbind ca-certificates-java default-jre-headless java-common
libcommons-collections3-java libcommons-dbcp-java libcommons-pool-java
libecj-java libjpeg-turbo8 libjpeg8 liblcms2-2 libpcsclite1 libtcnative-1
libtomcat8-java libxi6 libxrender1 libxtst6 openjdk-11-jre-headless tomcat8
tomcat8-common x11-common
0 upgraded, 21 newly installed, 0 to remove and 11 not upgraded.
Need to get 47.6 MB of archives.
After this operation, 195 MB of additional disk space will be used.
Do you want to continue? [Y/n]
...snip...
これでTomcat8と、依存するOpenJDKも入る。
GitBucketのデプロイ
war一つで動作するものとして手ごろだったので。。
zaki@cheddar:~/gitbucket$ curl -LO https://github.com/gitbucket/gitbucket/rele
ases/download/4.29.0/gitbucket.war
.gitbucket作成用にtomcat8ユーザのホームのownerをtomcat8にする。 ($TOMCAT_HOME
指定で別の場所に作ってもOK)
root@cheddar:~# chown tomcat8:tomcat8 /var/lib/tomcat8/
root@cheddar:~#
root@epoisses:~# ls -al /var/lib/tomcat8/
total 24
drwxr-xr-x 6 tomcat8 tomcat8 4096 Dec 8 00:43 .
drwxr-xr-x 37 root root 4096 Dec 8 00:24 ..
lrwxrwxrwx 1 root root 12 Aug 14 05:23 conf -> /etc/tomcat8
drwxr-xr-x 2 tomcat8 tomcat8 4096 Aug 14 05:23 lib
lrwxrwxrwx 1 root root 17 Aug 14 05:23 logs -> ../../log/tomcat8
drwxr-xr-x 2 root root 4096 Dec 8 00:43 policy
drwxrwxr-x 4 tomcat8 tomcat8 4096 Dec 8 00:29 webapps
lrwxrwxrwx 1 root root 19 Aug 14 05:23 work -> ../../cache/tomcat8
デプロイ
zaki@cheddar:~/gitbucket$ ls /var/lib/tomcat8/webapps/
ROOT
zaki@cheddar:~/gitbucket$ sudo cp gitbucket.war /var/lib/tomcat8/webapps/
zaki@cheddar:~/gitbucket$ ls /var/lib/tomcat8/webapps/
gitbucket gitbucket.war ROOT
あとはwebアクセスすればok