0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
[root@Test tools]# wget http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-linux-x64.tar.gz [root@Test tools]# wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.35/bin/apache-tomcat-8.0.35.tar.gz [root@Test tools]# tar zxf jdk-8u92-linux-x64.tar.gz [root@Test tools]# mv jdk1.8.0_92/ /byrd/service/ [root@Test tools]# ln -s /byrd/service/jdk1.8.0_92/ /usr/local/jdk [root@Test tools]# export JAVA_HOME=/usr/local/jdk [root@Test tools]# export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH [root@Test tools]# export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar [root@Test tools]# tar zxf apache-tomcat-8.0.35.tar.gz [root@Test tools]# mv apache-tomcat-8.0.35 /byrd/service/ [root@Test tools]# ln -s /byrd/service/apache-tomcat-8.0.35 /usr/local/tomcat [root@Test tools]# export TOMCAT_HOME=/usr/local/tomcat [root@Test tools]# wget http://ftp.yz.yamagata-u.ac.jp/pub/misc/jenkins/war-stable/1.651.2/jenkins.war [root@Test ~]# /usr/local/tomcat/bin/startup.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/local/jdk Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar [root@Test ~]# tail -f /usr/local/tomcat/logs/catalina.out [root@Test ~]# grep -v "^$" /usr/local/tomcat/conf/tomcat-users.xml |tail -4 <role rolename="admin-gui"/> <role rolename="manager-gui"/> <user username="admin" password="admin" roles=" admin-gui , manager-gui "/> </tomcat-users> [root@Test tools]# mv jenkins.war /usr/local/tomcat/webapps/ [root@Test tools]# ll /usr/local/tomcat/webapps/ drwxr-xr-x. 9 root root 4096 Jun 13 21:00 jenkins -rw-r--r--. 1 root root 64673620 Jun 13 20:02 jenkins.war 排错 [root@Test tools]# jps -lvm 1955 org.apache.catalina.startup.Bootstrap start -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp 2181 sun.tools.jps.Jps -lvm -Denv.class.path=.:/usr/local/jdk/lib:/usr/local/jdk/jre/lib:/usr/local/jdk/lib/tools.jar -Dapplication.home=/byrd/service/jdk1.8.0_92 -Xms8m [root@Test tools]# jstack 1955 >> /tmp/java.txt [root@Test tools]# top -H -p 1955 PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2079 root 20 0 2160m 289m 15m S 0.3 60.0 0:00.07 java 1955 root 20 0 2160m 289m 15m S 0.0 60.0 0:00.18 java 2067 root 20 0 2160m 289m 15m S 0.0 60.0 0:01.82 java 2068 root 20 0 2160m 289m 15m S 0.0 60.0 0:04.77 java 2069 root 20 0 2160m 289m 15m S 0.0 60.0 0:00.02 java 2070 root 20 0 2160m 289m 15m S 0.0 60.0 0:00.03 java [root@Test tools]# echo "obase=16;2087"|bc 827 "http-nio-8080-ClientPoller-0" #21 daemon prio=5 os_prio=0 tid=0x00007fde91232800 nid=0x827 runnable [0x00007fde6a16d000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method) |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
#!/bin/bash # Author:Byrd # Version:1.0 # Site:note.t4x.org # Contact:root#t4x.org Tools_Dir=/byrd/tools Insta_Dir=/byrd/service Redis_Down=http://download.redis.io/releases/redis-3.2.0.tar.gz Redis_Conf=/usr/local/redis Retu_Code=0 [ -d $Tools_Dir ] || mkdir $Tools_Dir -p [ -d $Insta_Dir ] || mkdir $Insta_Dir yum install gcc gcc-c++ vim wget tcl tcl-devel -y cd ${Tools_Dir} if [ -d /usr/local/redis/etc ];then echo "Redis Installed" exit 0 fi if [ -f `basename $Redis_Down` ]; then tar zxf `basename $Redis_Down` cd redis-3.2.0 make MALLOC=jemalloc if [ $Retu_Code -eq 0 ];then make PREFIX=${Insta_Dir}/redis-3.2.0 install ln -s ${Insta_Dir}/redis-3.2.0 /usr/local/redis mkdir /usr/local/redis/{etc,cache} cp redis.conf /usr/local/redis/etc sysctl vm.overcommit_memory=1 echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf echo 1024 >/proc/sys/net/core/somaxconn cd $Redis_Conf/etc cp redis.conf redis.conf.$(date +%F) sed -i "s#daemonize no#daemonize yes#g" redis.conf sed -i 's#logfile ""#logfile "/var/log/redis.log"#g' redis.conf sed -i 's#dir ./#dir /usr/local/redis/cache#g' redis.conf sed -i "s#appendonly no#appendonly yes#g" redis.conf else echo "Redis Install Error,Please Chenk" exit 1 fi else wget http://download.redis.io/releases/redis-3.2.0.tar.gz tar zxf `basename $Redis_Down` cd redis-3.2.0 make MALLOC=jemalloc if [ $Retu_Code -eq 0 ];then make PREFIX=${Insta_Dir}/redis-3.2.0 install ln -s ${Insta_Dir}/redis-3.2.0 /usr/local/redis mkdir /usr/local/redis/{etc,cache} cp redis.conf /usr/local/redis/etc sysctl vm.overcommit_memory=1 echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf echo 1024 >/proc/sys/net/core/somaxconn cd $Redis_Conf/etc cp redis.conf redis.conf.$(date +%F) sed -i "s#daemonize no#daemonize yes#g" redis.conf sed -i 's#logfile ""#logfile "/var/log/redis.log"#g' redis.conf sed -i 's#dir ./#dir /usr/local/redis/cache#g' redis.conf sed -i "s#appendonly no#appendonly yes#g" redis.conf else echo "Redis Install Error,Please Chenk" exit 1 fi fi if [ `netstat -tunlp | grep 6379 | wc -l` -eq 0 ]; then $Redis_Conf/bin/redis-server $Redis_Conf/etc/redis.conf sleep 3 echo "/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf" >>/etc/rc.local if [ `netstat -tunlp | grep 6379 | wc -l` -eq 1 ]; then echo "Redis Running" else echo "plases chk /var/log/redis.log,redis config err maybe" exit 1 fi fi |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
#!/bin/bash # Author:Byrd # Version:1.0 # Site:note.t4x.org # Contact:root#t4x.org Tools_Dir=/byrd/tools Insta_Dir=/byrd/service Jave_Down=http://111111114tfg.oss-cn-hangzhou.aliyuncs.com/jdk-7u79-linux-x64.tar.gz Tomcat_Down=http://mirrors.cnnic.cn/apache/tomcat/tomcat-8/v8.0.35/bin/apache-tomcat-8.0.35.tar.gz Redis_Conf=/usr/local/redis Retu_Code=0 [ -d $Tools_Dir ] || mkdir $Tools_Dir -p [ -d $Insta_Dir ] || mkdir $Insta_Dir yum install gcc gcc-c++ vim wget tcl tcl-devel -y cd ${Tools_Dir} if [ -f `basename $Jave_Down` ]; then tar zxf jdk-7u79-linux-x64.tar.gz Retu_Code=$? if [ $Retu_Code -ne 0 ]; then echo "please chk /byrd/tools/jdk-7u79-linux-x64.tar.gz exists" exit 1 fi if [ ! -d $Insta_Dir/jdk1.7.0_79 ]; then mv jdk1.7.0_79 $Insta_Dir else break fi if [ ! -d /usr/local/java ]; then ln -s $Insta_Dir/jdk1.7.0_79 /usr/local/java else echo "/usr/local/jave dir exits," break fi export JAVA_HOME=/usr/local/java export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar echo "export JAVA_HOME=/usr/local/java" >>/etc/profile echo "export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH" >>/etc/profile echo "export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar" >>/etc/profile echo "jave installed successful" else wget $Jave_Down tar zxf jdk-7u79-linux-x64.tar.gz Retu_Code=$? if [ $Retu_Code -ne 0 ]; then echo "please chk /byrd/tools/jdk-7u79-linux-x64.tar.gz exists" exit 1 fi if [ ! -d $Insta_Dir/jdk1.7.0_79 ]; then mv jdk1.7.0_79 $Insta_Dir else break fi if [ ! -L /usr/local/java ]; then ln -s $Insta_Dir/jdk1.7.0_79 /usr/local/java else echo "/usr/local/jave dir exits," break fi export JAVA_HOME=/usr/local/java export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar echo "export JAVA_HOME=/usr/local/java" >>/etc/profile echo "export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH" >>/etc/profile echo "export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar" >>/etc/profile echo "jave installed successful" fi if [ -f `basename $Tomcat_Down` ]; then tar zxf apache-tomcat-8.0.35.tar.gz Retu_Code=$? if [ $Retu_Code -ne 0 ]; then echo "please chk /byrd/tools/apache-tomcat-8.0.35.tar.gz exists" exit 1 fi if [ ! -d $Insta_Dir/apache-tomcat-8.0.35 ]; then mv apache-tomcat-8.0.35 $Insta_Dir else echo "apache-tomcat-8.0.35 is exits" break fi if [ ! -L /usr/local/tomcat ]; then ln -s $Insta_Dir/apache-tomcat-8.0.35 /usr/local/tomcat else echo "/usr/local/tomcat is exits" break fi echo "export TOMCAT_HOME=/usr/local/tomcat" >>/etc/profile else wget $Tomcat_Down tar zxf apache-tomcat-8.0.35.tar.gz Retu_Code=$? if [ $Retu_Code -ne 0 ]; then echo "please chk /byrd/tools/apache-tomcat-8.0.35.tar.gz exists" exit 1 fi if [ ! -d $Insta_Dir/apache-tomcat-8.0.35 ]; then mv apache-tomcat-8.0.35 $Insta_Dir else echo "apache-tomcat-8.0.35 is exits" break fi if [ ! -L /usr/local/tomcat ]; then ln -s $Insta_Dir/apache-tomcat-8.0.35 /usr/local/tomcat else echo "/usr/local/tomcat is exits" break fi echo "export TOMCAT_HOME=/usr/local/tomcat" >>/etc/profile fi if [ `netstat -tunlp | grep 8080 | wc -l` -eq 1 ]; then echo "tomcat running" else source /etc/profile /usr/local/tomcat/bin/startup.sh sleep 3 if [ `netstat -tunlp | grep 8080 | wc -l` -eq 1 ]; then echo "tomcat running" else echo "tomcat not running,pls chk config" exit 1 fi fi |
0 1 2 3 |
[root@hehe admin]# vim /usr/local/tomcat/conf/tomcat-users.xml #不要用 <role rolename="manager-gui" /> <role rolename="admin-gui" /> <user username="tomcat" password="admin" roles="manager-gui,admin-gui"/> |
0 1 2 3 4 5 6 7 8 9 |
[root@Test ~]# vim /usr/local/tomcat/conf/server.xml <Server port="8005" shutdown="SHUTDOWN"> #8000-8999 [root@Test ~]# mv /usr/local/tomcat/conf/tomcat-users.xml /tmp/ [root@Test ~]# mv /usr/local/tomcat/webapps /tmp/web [root@Test ~]# vim /usr/local/tomcat/conf/web.xml <init-param> <param-name>listings</param-name> <param-value>false</param-value> </init-param> |
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!