1. 程式人生 > >阿里雲上裝JDK和Tomcat

阿里雲上裝JDK和Tomcat

[[email protected] install]# ls -lrt

total 1280156

-rw-r--r-- 1 root root 472760320 Jan 20 16:09 mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar

-rw-r--r-- 1 root root   9390469 Jan 23 11:00 apache-tomcat-8.0.48.tar.gz

-rw-r--r-- 1 root root 187157685 Jan 29 16:12 jdk-8u152-linux-x64.tar.gz

-rw-r--r-- 1 root root 641555814 Mar  4 13:44 mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz

drwxr-xr-x 2 root root      4096 Mar  5 13:55 mysql-5.7.16-linux-glibc2.5-x86_64

1.檢視Linux的版本:

[[email protected] install]# uname -r

3.10.0-693.2.2.el7.x86_64

2.解壓jdk和Tomcat檔案:

[[email protected] install]# tar -xzf jdk-8u152-linux-x64.tar.gz

[[email protected] install]# tar -xzf  apache-tomcat-8.0.48.tar.gz

解壓完畢:

[[email protected] install]# ls -lrt

total 1280164

drwxrwxrwx 8 root root      4096 Nov  9 09:33 jdk1.8.0_152

-rw-r--r-- 1 root root 472760320 Jan 20 16:09 mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar

-rw-r--r-- 1 root root   9390469 Jan 23 11:00 apache-tomcat-8.0.48.tar.gz

-rw-r--r-- 1 root root 187157685 Jan 29 16:12 jdk-8u152-linux-x64.tar.gz

-rw-r--r-- 1 root root 641555814 Mar  4 13:44 mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz

drwxr-xr-x 2 root root      4096 Mar  5 13:55 mysql-5.7.16-linux-glibc2.5-x86_64

drwxr-xr-x 9 root root      4096 Mar  6 10:00 apache-tomcat-8.0.48

3.把jdk 的檔案挪到  /application/jdk 下面

[[email protected] install]# mkdir  -p /application/jdk

[[email protected] install]# mv jdk1.8.0_152  /application/jdk   

[[email protected] install]# ll  /application/jdk   

total 4

drwxrwxrwx 8 root root 4096 Nov  9 09:33 jdk1.8.0_152

[[email protected] jdk]# ls -lrt

total 4

drwxrwxrwx 8 root root 4096 Nov  9 09:33 jdk1.8.0_152

[[email protected] jdk]# cd  jdk1.8.0_152

[[email protected] jdk1.8.0_152]# mv * ../

[[email protected] jdk1.8.0_152]# cd ..

[[email protected] jdk]# ls -lrt

total 25960

-rwxrwxrwx 1 root root    63933 Sep 14 14:34 THIRDPARTYLICENSEREADME-JAVAFX.txt

-rwxrwxrwx 1 root root  5202883 Sep 14 14:34 javafx-src.zip

-rwxrwxrwx 1 root root      159 Sep 14 17:24 README.html

-rwxrwxrwx 1 root root       40 Sep 14 17:24 LICENSE

-rwxrwxrwx 1 root root     3244 Sep 14 17:24 COPYRIGHT

-rwxrwxrwx 1 root root 21117451 Sep 14 17:24 src.zip

-rwxrwxrwx 1 root root      424 Sep 14 17:24 release

drwxrwxrwx 5 root root     4096 Nov  9 09:33 lib

drwxrwxrwx 3 root root     4096 Nov  9 09:33 include

drwxrwxrwx 4 root root     4096 Nov  9 09:33 db

drwxrwxrwx 5 root root     4096 Nov  9 09:33 man

drwxrwxrwx 5 root root     4096 Nov  9 09:33 jre

drwxrwxrwx 2 root root     4096 Nov  9 09:33 bin

-rwxrwxrwx 1 root root   145193 Nov  9 09:35 THIRDPARTYLICENSEREADME.txt

drwxrwxrwx 2 root root     4096 Mar  6 10:01 jdk1.8.0_152

[[email protected] jdk]# pwd

/application/jdk

[[email protected] jdk]# rm jdk1.8.0_152

rm: cannot remove 鈥榡dk1.8.0_152鈥 Is a directory

[[email protected] jdk]# rm -rf jdk1.8.0_152

4.在 /etc/profile 加入JAVA_HOME=/application/jdk

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

記得:source /etc/profile

 [[email protected] install]# vi /etc/profile

# /etc/profile

# System wide environment and startup programs, for login setup

# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you

# are doing. It's much better to create a custom.sh shell script in

# /etc/profile.d/ to make custom changes to your environment, as this

# will prevent the need for merging in future updates.

pathmunge () {

            fi

    esac

}

if [ -x /usr/bin/id ]; then

        UID=`/usr/bin/id -ru`

    fi

    USER="`/usr/bin/id -un`"

    LOGNAME=$USER

    MAIL="/var/spool/mail/$USER"

fi

# Path manipulation

if [ "$EUID" = "0" ]; then

    pathmunge /usr/sbin

    pathmunge /usr/local/sbin

else

    pathmunge /usr/local/sbin after

# /etc/profile

# System wide environment and startup programs, for login setup

# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you

# are doing. It's much better to create a custom.sh shell script in

# /etc/profile.d/ to make custom changes to your environment, as this

# will prevent the need for merging in future updates.

pathmunge () {

    case ":${PATH}:" in

        *:"$1":*)

            ;;

        *)

            if [ "$2" = "after" ] ; then

                PATH=$PATH:$1

            else

                PATH=$1:$PATH

            fi

    esac

}

if [ -x /usr/bin/id ]; then

    if [ -z "$EUID" ]; then

        # ksh workaround

        EUID=`/usr/bin/id -u`

        UID=`/usr/bin/id -ru`

    fi

    USER="`/usr/bin/id -un`"

    LOGNAME=$USER

    MAIL="/var/spool/mail/$USER"

fi

# Path manipulation

if [ "$EUID" = "0" ]; then

    pathmunge /usr/sbin

    pathmunge /usr/local/sbin

else

    pathmunge /usr/local/sbin after

    pathmunge /usr/sbin after

fi

HOSTNAME=`/usr/bin/hostname 2>/dev/null`

HISTSIZE=1000

if [ "$HISTCONTROL" = "ignorespace" ] ; then

    export HISTCONTROL=ignoreboth

else

    export HISTCONTROL=ignoredups

fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell

# Current threshold for system reserved uid/gids is 200

# You could check uidgid reservation validity in

# /usr/share/doc/setup-*/uidgid file

if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then

    umask 002

else

    umask 022

fi

for i in /etc/profile.d/*.sh ; do

    if [ -r "$i" ]; then

        if [ "${-#*i}" != "$-" ]; then

            . "$i"

        else

            . "$i" >/dev/null

        fi

    fi

done

unset i

unset -f pathmunge

unset -f pathmunge

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

JAVA_HOME=/application/jdk

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

"/etc/profile" 80L, 1986C written

[[email protected] install]#

[[email protected] install]#

[[email protected] install]# source /etc/profile

[[email protected] install]#  java -version

java version "1.8.0_152"

Java(TM) SE Runtime Environment (build 1.8.0_152-b16)

Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

[[email protected] ~]# cd install

[[email protected] install]# ls -rlt

total 1280160

-rw-r--r-- 1 root root 472760320 Jan 20 16:09 mysql-5.7.21-1.el6.x86_64.rpm-bundle.tar

-rw-r--r-- 1 root root   9390469 Jan 23 11:00 apache-tomcat-8.0.48.tar.gz

-rw-r--r-- 1 root root 187157685 Jan 29 16:12 jdk-8u152-linux-x64.tar.gz

-rw-r--r-- 1 root root 641555814 Mar  4 13:44 mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz

drwxr-xr-x 2 root root      4096 Mar  5 13:55 mysql-5.7.16-linux-glibc2.5-x86_64

drwxr-xr-x 9 root root      4096 Mar  6 10:00 apache-tomcat-8.0.48

5.把Tomcat 移到  /application 目錄下面

[[email protected] install]# mv apache-tomcat-8.0.48 /application

[[email protected] application]# ls -lrt

total 8

drwxr-xr-x 9 root root 4096 Mar  6 10:00 apache-tomcat-8.0.48

drwxr-xr-x 8 root root 4096 Mar  6 10:02 jdk

[[email protected] application]# mv apache-tomcat-8.0.48 tomcat

[[email protected] application]# ls -lrt

total 8

drwxr-xr-x 9 root root 4096 Mar  6 10:00 tomcat

drwxr-xr-x 8 root root 4096 Mar  6 10:02 jdk

[[email protected] application]# cd tomcat

[[email protected] tomcat]# ls

bin  conf  lib  LICENSE  logs  NOTICE  RELEASE-NOTES  RUNNING.txt  temp  webapps  work

[[email protected] tomcat]# cd bin

6.解壓 commons-daemon-native.tar.gz

[[email protected] bin]#  tar zxf commons-daemon-native.tar.gz 

[[email protected] bin]# ls -lrt

total 836

-rw-r--r-- 1 root root   2026 Dec  1 00:29 version.bat

-rw-r--r-- 1 root root   4586 Dec  1 00:29 tool-wrapper.bat

-rw-r--r-- 1 root root 405109 Dec  1 00:29 tomcat-native.tar.gz

-rw-r--r-- 1 root root  48302 Dec  1 00:29 tomcat-juli.jar

-rw-r--r-- 1 root root   2022 Dec  1 00:29 startup.bat

-rw-r--r-- 1 root root   2020 Dec  1 00:29 shutdown.bat

-rw-r--r-- 1 root root   3574 Dec  1 00:29 setclasspath.bat

-rw-r--r-- 1 root root   2091 Dec  1 00:29 digest.bat

-rw-r--r-- 1 root root   2040 Dec  1 00:29 configtest.bat

-rw-r--r-- 1 root root 207125 Dec  1 00:29 commons-daemon-native.tar.gz

-rw-r--r-- 1 root root  25145 Dec  1 00:29 commons-daemon.jar

-rw-r--r-- 1 root root  15827 Dec  1 00:29 catalina.bat

-rw-r--r-- 1 root root  34630 Dec  1 00:29 bootstrap.jar

-rwxr-xr-x 1 root root   1908 Dec  1 00:29 version.sh

-rwxr-xr-x 1 root root   5495 Dec  1 00:29 tool-wrapper.sh

-rwxr-xr-x 1 root root   1904 Dec  1 00:29 startup.sh

-rwxr-xr-x 1 root root   1902 Dec  1 00:29 shutdown.sh

-rwxr-xr-x 1 root root   3680 Dec  1 00:29 setclasspath.sh

-rwxr-xr-x 1 root root   1965 Dec  1 00:29 digest.sh

-rwxr-xr-x 1 root root   8509 Dec  1 00:29 daemon.sh

-rwxr-xr-x 1 root root   1922 Dec  1 00:29 configtest.sh

-rwxr-xr-x 1 root root  23170 Dec  1 00:29 catalina.sh

-rw-r--r-- 1 root root   1647 Dec  1 00:30 catalina-tasks.xml

drwxr-xr-x 4 root root   4096 Mar  6 15:11 commons-daemon-1.1.0-native-src

[[email protected] bin]# cd commons-daemon-1.1.0-native-src

[[email protected] commons-daemon-1.1.0-native-src]# ls -lrt

total 32

-rw-rw-r-- 1 mysql mysql 11358 Feb 26  2005 LICENSE.txt

-rw-rw-r-- 1 mysql mysql   279 Nov 25  2011 README

-rw-rw-r-- 1 mysql mysql   175 Jul  8  2017 NOTICE.txt

-rw-rw-r-- 1 mysql mysql  1874 Nov  9 22:20 RELEASE-NOTES.txt

drwxrwxr-x 7 mysql mysql  4096 Nov 15 20:03 windows

drwxrwxr-x 5 mysql mysql  4096 Nov 15 20:03 unix

7.編譯 unix 下面的 configure

[[email protected] unix]# ./configure --with-java=/application/jdk

[[email protected] commons-daemon-1.1.0-native-src]# cd unix

[[email protected] unix]# ./configure --with-java=/application/jdk

*** Current host ***

checking build system type... x86_64-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking cached host system type... ok

*** C-Language compilation tools ***

checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking for ranlib... ranlib

checking for strip... strip

*** Host support ***

checking C flags dependant on host system type... ok

*** Java compilation tools ***

checking JAVA_HOME... /application/jdk

checking for JDK os include directory...  linux

gcc flags added

checking how to run the C preprocessor... gcc -E

checking for grep that handles long lines and -e... /usr/bin/grep

checking for egrep... /usr/bin/grep -E

checking for ANSI C header files... yes

checking for sys/types.h... yes

checking for sys/stat.h... yes

checking for stdlib.h... yes

checking for string.h... yes

checking for memory.h... yes

checking for strings.h... yes

checking for inttypes.h... yes

checking for stdint.h... yes

checking for unistd.h... yes

checking sys/capability.h usability... no

checking sys/capability.h presence... no

checking for sys/capability.h... no

configure: WARNING: cannot find headers for libcap

*** Writing output files ***

configure: creating ./config.status

config.status: creating Makefile

config.status: creating Makedefs

config.status: creating native/Makefile

*** All done ***

Now you can issue "make"

[[email protected] unix]# make

(cd native; make  all)

make[1]: Entering directory `/application/tomcat/bin/commons-daemon-1.1.0-native-src/unix/native'

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c jsvc-unix.c -o jsvc-unix.o

jsvc-unix.c: In function 鈥[01mrun_controller鈥

                                                jsvc-unix.c:1304:20: warning: assignment from incompatible pointer type [enabled by default]

     act.sa_handler = controller;

                    ^

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c arguments.c -o arguments.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c debug.c -o debug.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c dso-dlfcn.c -o dso-dlfcn.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c dso-dyld.c -o dso-dyld.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c help.c -o help.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c home.c -o home.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c java.c -o java.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c location.c -o location.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c replace.c -o replace.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c locks.c -o locks.o

gcc -g -O2 -DOS_LINUX -DDSO_DLFCN -DCPU=\"amd64\" -Wall -Wstrict-prototypes   -I/application/jdk/include -I/application/jdk/include/linux -c signals.c -o signals.o

ar cr libservice.a arguments.o debug.o dso-dlfcn.o dso-dyld.o help.o home.o java.o location.o replace.o locks.o signals.o

ranlib libservice.a

gcc   jsvc-unix.o libservice.a -ldl -lpthread -o ../jsvc

make[1]: Leaving directory `/application/tomcat/bin/commons-daemon-1.1.0-native-src/unix/native'

[[email protected] unix]#  ll jsvc

-rwxr-xr-x 1 root root 174304 Mar  6 15:12 jsvc

[[email protected]t unix]# cp jsvc ../../

[[email protected] unix]#

[email protected] commons-daemon-1.1.0-native-src]# cd ..

[[email protected] bin]# ls -lrt

total 1008

-rw-r--r-- 1 root root   2026 Dec  1 00:29 version.bat

-rw-r--r-- 1 root root   4586 Dec  1 00:29 tool-wrapper.bat

-rw-r--r-- 1 root root 405109 Dec  1 00:29 tomcat-native.tar.gz

-rw-r--r-- 1 root root  48302 Dec  1 00:29 tomcat-juli.jar

-rw-r--r-- 1 root root   2022 Dec  1 00:29 startup.bat

-rw-r--r-- 1 root root   2020 Dec  1 00:29 shutdown.bat

-rw-r--r-- 1 root root   3574 Dec  1 00:29 setclasspath.bat

-rw-r--r-- 1 root root   2091 Dec  1 00:29 digest.bat

-rw-r--r-- 1 root root   2040 Dec  1 00:29 configtest.bat

-rw-r--r-- 1 root root 207125 Dec  1 00:29 commons-daemon-native.tar.gz

-rw-r--r-- 1 root root  25145 Dec  1 00:29 commons-daemon.jar

-rw-r--r-- 1 root root  15827 Dec  1 00:29 catalina.bat

-rw-r--r-- 1 root root  34630 Dec  1 00:29 bootstrap.jar

-rwxr-xr-x 1 root root   1908 Dec  1 00:29 version.sh

-rwxr-xr-x 1 root root   5495 Dec  1 00:29 tool-wrapper.sh

-rwxr-xr-x 1 root root   1904 Dec  1 00:29 startup.sh

-rwxr-xr-x 1 root root   1902 Dec  1 00:29 shutdown.sh

-rwxr-xr-x 1 root root   3680 Dec  1 00:29 setclasspath.sh

-rwxr-xr-x 1 root root   1965 Dec  1 00:29 digest.sh

-rwxr-xr-x 1 root root   8509 Dec  1 00:29 daemon.sh

-rwxr-xr-x 1 root root   1922 Dec  1 00:29 configtest.sh

-rwxr-xr-x 1 root root  23170 Dec  1 00:29 catalina.sh

-rw-r--r-- 1 root root   1647 Dec  1 00:30 catalina-tasks.xml

drwxr-xr-x 4 root root   4096 Mar  6 15:11 commons-daemon-1.1.0-native-src

-rwxr-xr-x 1 root root 174304 Mar  6 15:12 jsvc

8.daemon.sh 設定:JAVA_HOME=/application/jdk

test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat

# Set JAVA_HOME to working JDK or JRE

JAVA_HOME=/application/jdk

# JAVA_HOME=/opt/jdk-1.6.0.22

# If not set we'll try to guess the JAVA_HOME

# from java binary if on the PATH

[[email protected] bin]# vi daemon.sh

#!/bin/sh

# Licensed to the Apache Software Foundation (ASF) under one or more

# contributor license agreements.  See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You under the Apache License, Version 2.0

# (the "License"); you may not use this file except in compliance with

# the License.  You may obtain a copy of the License at

#

#     http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

#

# -----------------------------------------------------------------------------

# Commons Daemon wrapper script.

# -----------------------------------------------------------------------------

#

# resolve links - $0 may be a softlink

ARG0="$0"

while [ -h "$ARG0" ]; do

  ls=`ls -ld "$ARG0"`

  link=`expr "$ls" : '.*-> \(.*\)$'`

  if expr "$link" : '/.*' > /dev/null; then

    ARG0="$link"

  else

    ARG0="`dirname $ARG0`/$link"

  fi

done

DIRNAME="`dirname $ARG0`"

PROGRAM="`basename $ARG0`"

while [ ".$1" != . ]

do

  case "$1" in

        continue

#!/bin/sh

# Licensed to the Apache Software Foundation (ASF) under one or more

# contributor license agreements.  See the NOTICE file distributed with

# this work for additional information regarding copyright ownership.

# The ASF licenses this file to You under the Apache License, Version 2.0

# (the "License"); you may not use this file except in compliance with

# the License.  You may obtain a copy of the License at

#

#     http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

#

# -----------------------------------------------------------------------------

# Commons Daemon wrapper script.

# -----------------------------------------------------------------------------

#

# resolve links - $0 may be a softlink

ARG0="$0"

while [ -h "$ARG0" ]; do

  ls=`ls -ld "$ARG0"`

  link=`expr "$ls" : '.*-> \(.*\)$'`

  if expr "$link" : '/.*' > /dev/null; then

    ARG0="$link"

  else

    ARG0="`dirname $ARG0`/$link"

  fi

done

DIRNAME="`dirname $ARG0`"

PROGRAM="`basename $ARG0`"

while [ ".$1" != . ]

do

  case "$1" in

# Commons Daemon wrapper script.

# -----------------------------------------------------------------------------

#

# resolve links - $0 may be a softlink

ARG0="$0"

while [ -h "$ARG0" ]; do

  ls=`ls -ld "$ARG0"`

  link=`expr "$ls" : '.*-> \(.*\)$'`

  if expr "$link" : '/.*' > /dev/null; then

    ARG0="$link"

  else

    ARG0="`dirname $ARG0`/$link"

  fi

done

DIRNAME="`dirname $ARG0`"

PROGRAM="`basename $ARG0`"

while [ ".$1" != . ]

do

  case "$1" in

    --java-home )

        JAVA_HOME="$2"

        shift; shift;

        continue

    ;;

    --catalina-home )

        CATALINA_HOME="$2"

        shift; shift;

        continue

    ;;

    --catalina-base )

        CATALINA_BASE="$2"

        shift; shift;

        continue

    ;;

    --catalina-pid )

        CATALINA_PID="$2"

        shift; shift;

        continue

    ;;

    --tomcat-user )

        TOMCAT_USER="$2"

        shift; shift;

        continue

    ;;

    --service-start-wait-time )

        SERVICE_START_WAIT_TIME="$2"

        shift; shift;

        continue

    ;;

    * )

        break

    ;;

  esac

done

# OS specific support (must be 'true' or 'false').

cygwin=false;

darwin=false;

case "`uname`" in

    CYGWIN*)

        cygwin=true

        ;;

    Darwin*)

        darwin=true

        ;;

esac

# Use the maximum available, or set MAX_FD != -1 to use that

test ".$MAX_FD" = . && MAX_FD="maximum"

# Setup parameters for running the jsvc

#

test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat

# Set JAVA_HOME to working JDK or JRE

# JAVA_HOME=/opt/jdk-1.6.0.22

# If not set we'll try to guess the JAVA_HOME

# from java binary if on the PATH

#

if [ -z "$JAVA_HOME" ]; then

    JAVA_BIN="`which java 2>/dev/null || type java 2>&1`"

    while [ -h "$JAVA_BIN" ]; do

        ls=`ls -ld "$JAVA_BIN"`

        link=`expr "$ls" : '.*-> \(.*\)$'`

        if expr "$link" : '/.*' > /dev/null; then

            JAVA_BIN="$link"

        else

            JAVA_BIN="`dirname $JAVA_BIN`/$link"

        fi

    done

    test -x "$JAVA_BIN" && JAVA_HOME="`dirname $JAVA_BIN`"

    test ".$JAVA_HOME" != . && JAVA_HOME=`cd "$JAVA_HOME/.." >/dev/null; pwd`

else

    JAVA_BIN="$JAVA_HOME/bin/java"

fi

# Only set CATALINA_HOME if not already set

test ".$CATALINA_HOME" = . && CATALINA_HOME=`cd "$DIRNAME/.." >/dev/null; pwd`

test ".$CATALINA_BASE" = . && CATALINA_BASE="$CATALINA_HOME"

test ".$CATALINA_MAIN" = . && CATALINA_MAIN=org.apache.catalina.startup.Bootstrap

# If not explicitly set, look for jsvc in CATALINA_BASE first then CATALINA_HOME

if [ -z "$JSVC" ]; then

    JSVC="$CATALINA_BASE/bin/jsvc"

    if [ ! -x "$JSVC" ]; then

        JSVC="$CATALINA_HOME/bin/jsvc"

    fi

fi

# Set the default service-start wait time if necessary

test ".$SERVICE_START_WAIT_TIME" = . && SERVICE_START_WAIT_TIME=10

# Ensure that any user defined CLASSPATH variables are not used on startup,

# but allow them to be specified in setenv.sh, in rare case when it is needed.

CLASSPATH=

JAVA_OPTS=

if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then

  . "$CATALINA_BASE/bin/setenv.sh"

elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then

  . "$CATALINA_HOME/bin/setenv.sh"

fi

# Add on extra jar files to CLASSPATH

test ".$CLASSPATH" != . && CLASSPATH="${CLASSPATH}:"

CLASSPATH="$CLASSPATH$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar"

test ".$CATALINA_OUT" = . && CATALINA_OUT="$CATALINA_BASE/logs/catalina-daemon.out"

test ".$CATALINA_TMP" = . && CATALINA_TMP="$CATALINA_BASE/temp"

# Add tomcat-juli.jar to classpath

# tomcat-juli.jar can be over-ridden per instance

if [ -r "$CATALINA_BASE/bin/tomcat-juli.jar" ] ; then

  CLASSPATH="$CLASSPATH:$CATALINA_BASE/bin/tomcat-juli.jar"

else

  CLASSPATH="$CLASSPATH:$CATALINA_HOME/bin/tomcat-juli.jar"

fi

# Set juli LogManager config file if it is present and an override has not been issued

if [ -z "$LOGGING_CONFIG" ]; then

  if [ -r "$CATALINA_BASE/conf/logging.properties" ]; then

    LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"

  else

    # Bugzilla 45585

    LOGGING_CONFIG="-Dnop"

  fi

fi

test ".$LOGGING_MANAGER" = . && LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"

JAVA_OPTS="$JAVA_OPTS $LOGGING_MANAGER"

# Set -pidfile

test ".$CATALINA_PID" = . && CATALINA_PID="$CATALINA_BASE/logs/catalina-daemon.pid"

# Increase the maximum file descriptors if we can

if [ "$cygwin" = "false" ]; then

    MAX_FD_LIMIT=`ulimit -H -n`

    if [ "$?" -eq 0 ]; then

        # Darwin does not allow RLIMIT_INFINITY on file soft limit

        if [ "$darwin" = "true" -a "$MAX_FD_LIMIT" = "unlimited" ]; then

            MAX_FD_LIMIT=`/usr/sbin/sysctl -n kern.maxfilesperproc`

        fi

        test ".$MAX_FD" = ".maximum" && MAX_FD="$MAX_FD_LIMIT"

        ulimit -n $MAX_FD

        if [ "$?" -ne 0 ]; then

            echo "$PROGRAM: Could not set maximum file descriptor limit: $MAX_FD"

        fi

    else

        echo "$PROGRAM: Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"

    fi

fi

# Java 9 no longer supports the java.endorsed.dirs

# system property. Only try to use it if

# JAVA_ENDORSED_DIRS was explicitly set

# or CATALINA_HOME/endorsed exists.

ENDORSED_PROP=ignore.endorsed.dirs

if [ -n "$JAVA_ENDORSED_DIRS" ]; then

    ENDORSED_PROP=java.endorsed.dirs

fi

if [ -d "$CATALINA_HOME/endorsed" ]; then

    ENDORSED_PROP=java.endorsed.dirs

fi

# ----- Execute The Requested Command -----------------------------------------

case "$1" in

    run     )

      shift

      "$JSVC" $* \

      $JSVC_OPTS \

      -java-home "$JAVA_HOME" \

      -pidfile "$CATALINA_PID" \

      -wait "$SERVICE_START_WAIT_TIME" \

      -nodetach \

      -outfile "&1" \

      -errfile "&2" \

      -classpath "$CLASSPATH" \

      "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \

      -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \

      -Dcatalina.base="$CATALINA_BASE" \

      -Dcatalina.home="$CATALINA_HOME" \

      -Djava.io.tmpdir="$CATALINA_TMP" \

      $CATALINA_MAIN

      exit $?

    ;;

    start   )

      "$JSVC" $JSVC_OPTS \

      -java-home "$JAVA_HOME" \

      -user $TOMCAT_USER \

      -pidfile "$CATALINA_PID" \

      -wait "$SERVICE_START_WAIT_TIME" \

      -outfile "$CATALINA_OUT" \

      -errfile "&1" \

      -classpath "$CLASSPATH" \

      "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \

      -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \

      -Dcatalina.base="$CATALINA_BASE" \

      -Dcatalina.home="$CATALINA_HOME" \

      -Djava.io.tmpdir="$CATALINA_TMP" \

      $CATALINA_MAIN

      exit $?

    ;;

    stop    )

      "$JSVC" $JSVC_OPTS \

      -stop \

      -pidfile "$CATALINA_PID" \

      -classpath "$CLASSPATH" \

      -D$ENDORSED_PROP="$JAVA_ENDORSED_DIRS" \

      -Dcatalina.base="$CATALINA_BASE" \

      -Dcatalina.home="$CATALINA_HOME" \

      -Djava.io.tmpdir="$CATALINA_TMP" \

      $CATALINA_MAIN

      exit $?

    ;;

    version  )

      "$JSVC" \

      -java-home "$JAVA_HOME" \

      -pidfile "$CATALINA_PID" \

      -classpath "$CLASSPATH" \

      -errfile "&2" \

      -version \

# Commons Daemon wrapper script.

# -----------------------------------------------------------------------------

#

# resolve links - $0 may be a softlink

ARG0="$0"

while [ -h "$ARG0" ]; do

  ls=`ls -ld "$ARG0"`

  link=`expr "$ls" : '.*-> \(.*\)$'`

  if expr "$link" : '/.*' > /dev/null; then

    ARG0="$link"

  else

    ARG0="`dirname $ARG0`/$link"

  fi

done

DIRNAME="`dirname $ARG0`"

PROGRAM="`basename $ARG0`"

while [ ".$1" != . ]

do

  case "$1" in

        continue

    ;;

        continue

    ;;

        continue

    ;;

        continue

    ;;

        shift; shift;

    ;;

  esac

done

# OS specific support (must be 'true' or 'false').

cygwin=false;

darwin=false;

case "`uname`" in

        ;;

        ;;

esac

# Use the maximum available, or set MAX_FD != -1 to use that

test ".$MAX_FD" = . && MAX_FD="maximum"

# Setup parameters for running the jsvc

#

test ".$TOMCAT_USER" = . && TOMCAT_USER=tomcat

# Set JAVA_HOME to working JDK or JRE

# JAVA_HOME=/opt/jdk-1.6.0.22

# If not set we'll try to guess the JAVA_HOME

# from java binary if on the PATH

#

if [ -z "$JAVA_HOME" ]; then

    JAVA_BIN="`which java 2>/dev/null || type java 2>&1`"

        fi

    done

    test -x "$JAVA_BIN" && JAVA_HOME="`dirname $JAVA_BIN`"

    test ".$JAVA_HOME" != . && JAVA_HOME=`cd "$JAVA_HOME/.." >/dev/null; pwd`

else

    JAVA_BIN="$JAVA_HOME/bin/java"

JAVA_HOME=/application/jdk

"daemon.sh" 275L, 8537C written

9.啟動tomcat

[[email protected] bin]# ./startup.sh

Using CATALINA_BASE:   /application/tomcat

Using CATALINA_HOME:   /application/tomcat

Using CATALINA_TMPDIR: /application/tomcat/temp

Using JRE_HOME:        /application/jdk

Using CLASSPATH:       /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar

Tomcat started.

[[email protected] bin]#

10.檢視Tomcat程序:

[[email protected] bin]# ps -ef|grep tomcat

root     27655     1 24 15:18 pts/3    00:00:02 /application/jdk/bin/java -Djava.util.logging.config.file=/application/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dignore.endorsed.dirs= -classpath /application/tomcat/bin/bootstrap.jar:/application/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/application/tomcat -Dcatalina.home=/application/tomcat -Djava.io.tmpdir=/application/tomcat/temp org.apache.catalina.startup.Bootstrap start

root     27701 26870  0 15:18 pts/3    00:00:00 grep --color=auto tomcat

相關推薦

阿里上裝JDKTomcat

[[email protected] install]# ls -lrt total 1280156 -rw-r--r-- 1 root root 472760320 Jan 20 16:09 mysql-5.7.21-1.el6.x86_64.rpm-bu

阿里輕量應用伺服器 怎麼控制怎麼上傳檔案怎麼安裝JDKTomcat完成JavaWeb的部署

你是否遇到過這些問題,自己的javaweb專案本地執行一切正常,但是一轉移到阿里伺服器之類的.就出現以下問題. 1 jsp無法解析java類  2 Only a type can be imported. 

阿里centos7.4安裝jdkTomcat的坑

1、阿里雲自帶jdk的坑 一開始,我直接用的是阿里雲自帶的jdk來安裝的,然後再在/etc/profile當中配置環境變數,按Esc後再按:wq儲存,立即將變動生效:source /etc/profile 輸入 java -version 是沒有問

Ubuntu Server 16.04.1 安裝配置jdkTomcat伺服器配置)

介紹 過程 介紹     這仍是雲伺服器配置的一篇,廢話就不再多說,工具putty的使用可以參考上一篇部落格安裝配置MySQL的開頭,這裡直接開始講安裝的過程。 過程     安裝jdk和Tomcat比安裝MySQL要麻煩一些,不過一步一步來也還好。

騰訊伺服器配置JDKTomcat環境

1.新增tomcat所需的JDK環境變數(百度jdk下載即可),並將以下變數新增進伺服器系統變數中 JAVA_HOME:C:\ProgramFiles\Java\jdk1.8.0_101(注:不同版本不同伺服器的路徑可能有所不同) CLASSPATH:.;%JAVA_HOM

如何在centos 7服務器上安裝jdktomcat以及部署java web項目

bin ava war zxvf 8.0 server fir sta 解壓 1、安裝jdk1.8版本   yum -y install java-1.8.0-openjdk.x86_64 2、查看是否安裝完成   java -version 3、安裝tomcat

Linux常用命令-jdkTomcat

ble jdk cat start tab 訪問 進程 wall exp 一、JDK的安裝和配置 1、下載jdk文件   去官方網站下載Linux 64位 jdk-8u131-linux-x64.tar.gz 2、使用Ftp工具上傳到/usr/local 下。  

jdktomcat安裝

jdk tomcatjdk安裝:jdk的下載地址可在google中直接搜索jdk,搜到的第一個鏈接地址應該就是oracle公司提供的jdk頁面,點擊進入官網頁面,選中接受協議後選擇要下載的軟件包即可。如下圖:點擊鏈接,進入下面界面。tar xf jdk-8u77-linux-x64.tar.gz mkdir

16.1-16.3 Tomcat介紹,安裝JDKTomcat

Tomcat JDK 16.1 Tomcat介紹16.2 安裝jdk16.3 安裝Tomcat擴展java容器比較 http://my.oschina.net/diedai/blog/271367 http://www.360doc.com/content/11/0618/21/16915_12

docker的安裝以及jdktomcat的環境配置

不依賴 apache 習慣 頁表 source cat 配置環境 源代碼 文件的上傳 準備工作:需要Linux kernel 3.8支持查看linux內核的版本:root@ubuntu-dev:~# cat /proc/version查看linux版本:root@ubunt

Tomcat介紹、安裝jdktomcat

TP htm etc 解析 code pre kit uil devel Tomcat介紹 Tomcat是Apache軟件基金會(Apache Software Foundation)的Jakarta項目中的一個核心項目,由Apache、Sun和其他一些公司及個人共同開發而

一鍵安裝java jdktomcat

pro chown lin mod 快速部署 版本 apache lba root 1、一鍵安裝java jdk,版本為jdk:1.8.0.172#################################一鍵快速安裝java jdk ################

CentOS安裝jdktomcat

openjdk dnf .gz 火墻 entos oot 下載 root tcp 1.查看是否已經安裝 java -version 2.卸載自帶的openjdk dnf remove java-1.7.0-openjdk 3.下載jdk安裝包 wget -c http://

(1) 部署JDKtomcat

hot tomcat8 輸入 root oot tomcat center onf ini Tomcat為java開發,需要先部署jdk環境 1、部署jdk mkdir /application/jdk-1.8.162 -p cd /application/jd

deepin下jdktomcat的安裝教程

不容易 可能 .net 容易 csdn rac ora source 結果 在deepin上安裝java是真的心累啊,照著網上的教程弄,結果一團糟。好不容易折騰成功了,記錄下來。 1.下載jdk   首先我們要知道,用sudo 類似命令下載的jdk,是open的jdk,

saltstack狀態管理 部署 jdk tomcat 並執行

首先,在 /srv/salt 目錄下 建立 base,prod,test目錄,分別代表 基礎環境,生產環境 和 測試環境。基礎環境 是存放 公共的狀態,例如 命令 的 審計,核心引數的修改 [[email protected] salt]# cd /srv/salt/ [[emai

阿里伺服器上部署tomcat,並進行訪問測試

    要求將一個專案部署到新買的阿里雲伺服器上。使用xshell遠端連線(連線使用的ip是例項的公網ip)。     在部署配置tomcat之前首先進行JDK的部署,先說明一下,我使用的CentOS7.4.     選擇JDK1.

linux的jdktomcat安裝

1.安裝jdk 1)  將下載好的jdk-8u181-linux-x64.tar.gz複製到linux虛擬機器裡 2)  解壓tar zxvf jdk-8u181-linux-x64.tar.gz 3)  配置環境變數,進入/etc資料夾下的profile檔案(這是配置

阿里輕量級伺服器NGINX部署Django專案 django安裝tinymce centos7安裝python3 以及tab補全功能 常用服務安裝部署

部署條件:         1.一臺阿里雲伺服器(本人的是CentOS系統的伺服器)         2.已經構建好的專案       &nbs

Linux下安裝配置JDKTomcat操作步驟

下面以JDK7和Tomcat7為例,介紹CentOS7.5下安裝配置JDK和Tomcat的操作步驟。 1、安裝JDK 1.1、檢視yum庫中都有哪些jdk版本 yum search java|grep jdk1.2、選擇指定的版本安裝 yum install java-1.7.0-openj