Installation Instructions
System Environment: centos-6.5
Installation Method: RPM Installation
Software: jdk-7-linux-x64.rpm
: http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html
Note: Rpm,gz file differences
The first to solve the Linux friends must be a special headache for software installation, the same is for Linux, but rpm, tar.gz, Deb package is still very different, this difference is likely to make your installation process can not go on. What format package should we download? Of course, it depends on the version of the Linux system you are using.
RPM packages can be installed directly on Red Hat Linux, SUSE, Fedora, but not in Ubuntu;
The Deb package should be a patent for Ubuntu, and in Ubuntu, double-click the Deb package to get into the automatic installation process;
The tar.gz package can be used in all Linux versions, but the installation process is also the most troublesome. To extract the first, then in the "terminal" with the CD command into the directory just extracted, and then find the installation link file installation.
*.tar.gz/*.tgz, *.bz2 form of binary package
Installation: Tar zxvf *.tar.gz or tar yxvf *.bz2
Uninstall: Delete manually
Note: Binary packages in *.tar.gz/*.bz2 form are packaged with the TAR tool, compressed with GZIP/BZIP2, and unpacked directly when installed. For only a single directory after decompression software, uninstall with the command "RM-RF software directory Name"; If the files are scattered in multiple directories, you must one by one manually delete (slightly troublesome), you want to know what files are installed to the system when extracting, you can use the command "tar ztvf *.tar.gz"/"tar YTVF *.bz2 "Get the list. The parameter z of TAR is called gzip decompression, X is unpacked, V is checksum, F is the display result, Y is called bzip2 decompression, and T is the list of files listing packages. For more parameters Please refer to man tar.
If you prefer the operation of the graphical interface, you can use KDE's Ark compression file management tool under X-window.
============================================
The distribution of the source code of the Linux software refers to the release form of all the program sources of the software, which requires the user to compile the executable binary code and install it, the advantage is that the configuration is flexible, can remove or retain certain functions/modules, adapt to a variety of hardware/operating system platform and compiling environment, the disadvantage is difficult , generally not suitable for beginners to use.
1, *.src.rpm form of source code package
Installation: Rpm-rebuild *.src.rpm
Cd/usr/src/dist/rpms
RPM-IVH *.rpm
Uninstall: Rpm-e Packgename
Description: The rpm--rebuild *.src.rpm command compiles the source code and generates a binary RPM package under/usr/src/dist/rpms, and then installs the binary package. Packgename as mentioned earlier.
2, *.tar.gz/*.tgz, *.bz2 form of source code package
Installation: Tar zxvf *.tar.gz or tar yxvf *.bz2 first unzip
Then go to the extracted directory:
./configure Configuration
Make compilation
Make install Installation
Uninstall: Make uninstall or delete manually
Note: It is recommended to read the documentation before extracting, to understand what the installation needs, if necessary, you need to change the compilation configuration. The source code of some packages can be uninstalled with the Make install command after compilation and installation, and if this feature is not provided, the uninstallation of the software must be manually removed. Since the software may be distributed across multiple directories in the system, it is often difficult to remove it cleanly, you should configure it before compiling, specifying that the software will be installed to the target path:./configure--prefix= directory name, so you can use "RM-RF Software directory Name" command to perform a clean and thorough uninstallation. Compared with other installation methods, it is most difficult for users to compile and install themselves, it is suitable for people who have some experience in Linux, and it is generally not recommended for beginners to use.
Check the JDK version that the system has installed and uninstall the open JDK
Download JDK
" Cookie:oraclelicense=accept-securebackup-cookie; " http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm
Inspection System Original Version
[Email protected] ~]# java-"1.6.0_24"1.11. 1) (rhel-1.45. 1.11. 1. el6-20.0-b12, mixed mode)
To view the JDK information further:
[Email protected] ~]# Rpm-qa | grep javatzdata-java-2012c-1. El6.noarchjava-1.6. 0-openjdk-1.6. 0.0-1.45. 1.11. 1
To uninstall OPENJDK, perform the following actions:
[Email protected] ~]# rpm-e--nodeps tzdata-java-2012c-1~]# rpm-e--nodeps java-1.6. 0-openjdk-1.6. 0.0-1.45. 1.11. 1
Installing the JDK
Upload the new jdk-7-linux-x64.rpm software to/usr/local/to perform the following actions:
[Email protected] local]# RPM-IVH jdk-7
Preparing ... ########################################### [100%] 1:jdk ########################################### [ 100%]unpacking JAR Files...rt.jar...jsse.jar...charsets.jar...tools.jar...localedata.jar...jfxrt.jar ... Plugin.jar...javaws.jar...deploy.jar ...
The JDK is installed by default in/usr/java.
Verifying the installation
Do the following to see if the information is OK:
-"1.7.0"1.7. 0-21.0
Congratulations, the installation is successful!
Configuring Environment variables
My machine does not configure environment variables to perform JAVAC, java–version operations after installing jdk-7-linux-x64.rpm, so I do not configure the JDK environment variable. But for the sake of future discomfort, here is still a record of how to configure, the operation is as follows:
Modify the System environment variable file
Append the following content to the file:
java_home=/usr/java/jdk1.7.0_79
Jre_home=/usr/java/jdk1.7.0_79/jre
Path= $PATH: $JAVA _home/bin: $JRE _home/bin
Classpath=: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib
Export Java_home jre_home PATH CLASSPATH
Make the changes effective
[[email protected] local]# source/etc/profile // make changes effective immediately [[email protected] local]# echo $ PATH //
View System Environment Status
[Email protected] ~]# echo $PATH/usr/local/cmake/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr /local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1. 7.0/bin:/usr/java/jdk1. 7.0
Tomcat installation
Software: apache-tomcat-8.0.0.rc3.tar.gz
: http://tomcat.apache.org/download-80.cgi
Installation Prerequisites
The system must have the configuration jdk6+ installed, please refer to: http://www.linuxidc.com/Linux/2014-10/108066.htm.
Installing Tomcat
Upload the apache-tomcat-8.0.0.rc3.tar.gz file to the/usr/local to do the following:
The code is as follows:
[Email protected] ~]# cd/usr/local
[[email protected] ~]# tar-zxv-f apache-tomcat-8.0.0.rc3.tar.gz//Decompression Pack
[[email protected] ~]# RM-RF apache-tomcat-8.0.0.rc3.tar.gz//Delete compressed package
[Email protected] ~]# MV APACHE-TOMCAT-8.0.0.RC3 Tomcat
Start Tomcat
Perform the following actions:
[[email protected] ~]#/usr/local/tomcat/bin/startup.sh//Start Tomcat
Using catalina_base:/usr/local/tomcat
Using Catalina_home:/usr/local/tomcat
Using Catalina_tmpdir:/usr/local/tomcat/temp
Using Jre_home:/usr/java/jdk1.7.0_45/jre
Using CLASSPATH:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
The above information indicates that the message has been successfully started.
Firewall Open 8080 Port
Add 8080 ports to the firewall configuration and do the following:
[Email protected] ~]/sbin/iptables-i input-p TCP--dport 8080-j ACCEPT #开启8080端口
[Email protected] ~]/etc/rc.d/init.d/iptables save #保存配置
[Email protected] ~]/etc/rc.d/init.d/iptables Restart #重启防火墙
Check Tomcat installation Run
See if Tomcat is working properly with the following address:
http://192.168.10.138:8080/
See the Tomcat system interface to show that the installation was successful!
Stop Tomcat
[[email protected] ~]#/usr/local/tomcat/bin/shutdown.sh//Stop Tomcat
Setting up the Tomcat startup service
# cd/etc/init.d# VI Tomcat
#!/bin/bash# chkconfig:2345 Ten -# Description:starts and Stops the Tomcat daemon. Catalina_home=/usr/local/tomcat/apache-tomcat-7.0. -Java_home=/usr/java/jdk1.7. 0_55tomcat_start= $CATALINA _home/bin/startup.sh tomcat_stop= $CATALINA _home/bin/shutdown.sh # source function library:/etc/rc.d/init.d/functions # Check that networking isUp . [ "${networking}"="No"] && exit0# Check forTomcat Scriptif[!-F $CATALINA _home/bin/catalina.sh]; Then Echo"Tomcat not valilable ..."exit fi Start () {echo-N"starting Tomcat:"Daemon $TOMCAT _start echo Touch/var/Lock/subsys/Tomcat} stop () {PS ax--width= +| Grep"[O]rg.apache.catalina.startup.bootstrap Start"| Awk'{printf $ "}' | WC | Awk'{print $}'>/tmp/Tomcat_process_count.txt Read line</tmp/Tomcat_process_count.txtif[$line-GT0 ]; Then Echo-N"Tomcat (PID"PS Ax--width= +| Grep"org.apache.catalina.startup.Bootstrap Start"| Awk'{printf $ "}'Echo-N") is running ..."Echo Echo-N $"shutting down Tomcat:"Daemon $TOMCAT _stop rm-F/var/Lock/subsys/Tomcat.pid EchoElseEcho"Tomcat is stopped"fi} restart () {Stop start} status () {PS ax--width= +| Grep"[O]rg.apache.catalina.startup.bootstrap Start"| Awk'{printf $ "}' | WC | Awk'{print $}'>/tmp/Tomcat_process_count.txt Read line</tmp/Tomcat_process_count.txtif[$line-GT0 ]; Then Echo-N"Tomcat (PID"PS Ax--width= +| Grep"org.apache.catalina.startup.Bootstrap Start"| Awk'{printf $ "}'Echo-N") is running ..."EchoElseEcho"Tomcat is stopped"fi} Case " $" inchstart) Start; stop) stop;; Restart) Stop Sleep3start;; status) status; *) echo"usage:tomcatd {Start|stop|restart|status}"Exit1ESAC Exit0
After saving exits, modify the file properties
#chmod a+x Tomcat
Set up service run
#chkconfig --add tomcat
Start:
#service tomcat start
Supplemental Encoding UTF-8 Settings:
<connector port="8080" usebodyencodingforuri="true" uriencoding= "UTF-8 " protocol="http/1.1 " connectiontimeout="20000" redirectport=" 8443" />
Reference:
Http://www.cnblogs.com/zhoulf/archive/2013/02/04/2891608.html
Http://www.linuxidc.com/Linux/2014-10/108066.htm
Http://www.linuxidc.com/Linux/2014-10/108065.htm
http://my.oschina.net/u/221951/blog/344061
CentOS-6.5 Installation Configuration JDK-7