Tomcat high-performance and high-concurrency apr installation configuration on linxu

0. Prerequisites
① Please install and configure JDK and tomcat, and create a link file, so that
/usr/java/jdk

is equivalent to the root directory of JDK
/usr/local/tomcat
is equivalent to the root directory of tomcat.
② The development package of openssl has been installed, whether it is installed by source code or by using the package manager, the package manager can be used to install
yum install openssl-devel

1. Download preparation
In order to install apr support, you need to download apr-< version>.tar.gz and apr-util-<version>.tar.gz, the latest version is apr-1.5.2.tar.gz and apr-util-1.5.4.tar.gz, this is me The version of the minor installation.
Download address, use Aliyun's mirror, the access speed is very fast, or you can use other mirrors
http://http://mirrors.aliyun.com/apache/apr/apr-1.5.2.tar.gz
http://mirrors.aliyun.com/apache/apr/apr-util-1.5.4.tar.gz
or you can visit the official Apache download site, but it is not recommended, because it will increase the burden on the server, Apache also repeatedly emphasizes Don't download directly from them, (in fact, downloading from a mirror site is the same and faster)
http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
After downloading these two files, upload them to the
/usr/local/src
directory of the system for the next Prepare for compilation and installation.

2. The installation of apr
Unzip apr-1.5.2.tar.gz, get the folder apr-1.5.2, enter the folder, execute the following
command./configure
make
make install

The installation location can be specified, But I follow the default here. If you want to specify the installation location, please refer to the "README" file in the folder, which is described. At the same time, if the installation location is re-specified, the location mentioned later will be changed accordingly.
The default installation location is /usr/local/apr, you can check whether there is this directory in the file system, and the modification date of the files in the directory, etc., to confirm that the installation was successful.
You can also judge whether it is successful or not based on the output of the execution command at each step. If there is a problem, it must be solved in time and follow-up operations are carried out.

3. Install apr-util
Unzip apr-util-1.5.4.tar.gz, get the folder apr-util-1.5.4, enter the folder, and execute
./configure --with-apr=/usr in turn /local/apr
make
make install
The directory specified when configuring here is the directory of the previously installed apr. If the default path has been modified before, it should be modified accordingly.
This time the installation or installation is in the lib directory under the apr path, that is,
/usr/local/apr/lib
. You can enter the directory to view the file information and confirm whether it is successful. You can also judge whether it is successful or not based on the output of the execution command at each step. If there is a problem, it must be solved in time and follow-up operations are carried out.

4. Install tomcat-native
tomcat-native? what is it? Didn't you call download before?
Indeed, I was very confused when I first started searching on the Internet, but someone said, "It's just under the bin directory of the downloaded tomcat", I looked it up, and sure enough there is! !
Copy the tomcat-native.tar.gz file in the bin directory of our installed tomcat to
/usr/local/src
, and decompress it to get the directory tomcat-native-<version>-src, in this directory there are Related instructions, tell us how to build.
Enter the
jni/native
directory in the directory, the files in this directory are the files we need, and execute the following commands in
turn./configure --with-apr=/usr/local/apr --with-java-home= /usr/java/jdk
make
make install
Here, the apr directory should use the directory when the apr was installed earlier. If it is modified, please modify it accordingly. The java directory should use the jdk root directory. Revise.
After executing the above command, it will be in the directory
/usr/local/apr/lib
The corresponding files are generated in the file, and you can view the files to confirm that the installation is successful. You can also judge whether it is successful or not based on the output of the execution command at each step. If there is a problem, it must be solved in time and follow-up operations are carried out.

5. Check the installation as a whole.
Whether the installation is successful or not, just look at the installation directory. The output of the following command should be similar. If you go abroad, please check carefully
[root@CooVox-U100 apr]# pwd
/ usr/local/apr
[root@CooVox-U100 apr]# ls -l
total 16
drwxr-xr-x 2 root root 4096 May 22 10:51 bin
drwxr-xr-x 2 root root 4096 May 22 10:47 build- 1
drwxr-xr-x 3 root root 4096 May 22 10:47 include
drwxr-xr-x 3 root root 4096 May 22 11:44 lib
[root@CooVox-U100 apr]# cd lib/
[root@CooVox-U100 lib ]# ls -l
total 5164
-rw-r--r-- 1 root root 9278 May 22 10:47 apr.exp
-rw-r--r-- 1 root root 5272 May 22 10:51 aprutil.exp
-rw-r--r-- 1 root root  933930 May 22 10:47 libapr-1.a
-rwxr-xr-x 1 root root    972 May 22 10:47 libapr-1.la
lrwxrwxrwx 1 root root      17 May 22 10:47 libapr-1.so -> libapr-1.so.0.5.2
lrwxrwxrwx 1 root root      17 May 22 10:47 libapr-1.so.0 -> libapr-1.so.0.5.2
-rwxr-xr-x 1 root root  639267 May 22 10:47 libapr-1.so.0.5.2
-rw-r--r-- 1 root root  565304 May 22 10:51 libaprutil-1.a
-rwxr-xr-x 1 root root    1070 May 22 10:51 libaprutil-1.la
lrwxrwxrwx 1 root root      21 May 22 10:51 libaprutil-1.so -> libaprutil-1.so.0.5.4
lrwxrwxrwx 1 root root      21 May 22 10:51 libaprutil-1.so.0 -> libaprutil-1.so.0.5.4
-rwxr-xr-x 1 root root  416002 May 22 10:51 libaprutil-1.so.0.5.4
-rw-r--r-- 1 root root  372902 May 22 10:51 libexpat.a
-rwxr-xr-x 1 root root    928 May 22 10:51 libexpat.la
lrwxrwxrwx 1 root root      17 May 22 10:51 libexpat.so -> libexpat.so.0.5.0
lrwxrwxrwx 1 root root      17 May 22 10:51 libexpat.so.0 -> libexpat.so.0.5.0
-rwxr-xr-x 1 root root  329742 May 22 10:51 libexpat.so.0.5.0
-rw-r--r-- 1 root root 1136746 May 22 11:44 libtcnative-1.a
-rwxr-xr-x 1 root root    1055 May 22 11:44 libtcnative-1.la
lrwxrwxrwx 1 root root      23 May 22 11:44 libtcnative-1.so -> libtcnative-1.so.0.1.33
lrwxrwxrwx 1 root root      23 May 22 11:44 libtcnative-1.so.0 -> libtcnative-1.so.0.1.33
-rwxr-xr-x 1 root root  794996 May 22 11:44 libtcnative-1.so.0.1.33
drwxr-xr-x 2 root root 4096 May 22 11:44 pkgconfig

6. Configuration after
installation is required to enable apr.
Modify the file
/etc/profile
to find the end of the file, add #tomcat-apr export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib after
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME and then save the file. Finally, don't forget to make this configuration take effect, use the following command (you can also restart the machine) source /etc/profile 7. Result detection After performing the above steps, even if the installation is completed, but whether it is successful or not, the following is to verify. First delete all the running records of tomcat, then start tomcat, check the file catalina.out and look for this file carefully, in the middle part, if there is an output similar to this 22-May-2015 11:46:11.393 INFO [main] org.apache .catalina.core.AprLifecycleListener.lifecycleEvent













Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.5.2.
22-May-2015 11:46:11.393 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent
APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
22-May-2015 11:46:11.851 INFO [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL
OpenSSL successfully initialized (OpenSSL 0.9.8e- rhel5 01 Jul 2008)
means that the installation and configuration are successful; but if it is similar to this, (in fact, it is like this when it is not installed)
22-May-2015 14:05:57.427 INFO [main] org.apache. catalina.core.AprLifecycleListener.lifecycleEvent
The APR based Apache Tomcat Native library which allows optimal performance in production
environments was not found on the java.library.path: :/usr/java/packages/lib/i386:/lib:/usr/lib
indicating no success.
  



The error that may be reported:
configure: error: APR could not be located. Please use the --with-apr option.
Specify the parameters to compile:
./configure --with-apr=/usr/local/apr


the --with- apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.
The location of the specified path is incorrect. If you personally feel that there is no problem with the road, check your installed apr-1.5.2.tar .gz, apr-util-1.5.4.tar.gz are these two packages installed correctly, if not, please repeat the above steps again

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326448845&siteId=291194637