1. Installing the JDK
If you have previously installed the JDK, you want to reinstall the following command to uninstall it, install JDK1.8:
Check First:
Rpm-qa|grep JDK
And then uninstall it with the following command
Rpm-e --nodeps java-1. 7. 0-openjdk-headless-1. 7. 0. 111-2. 6. 7. 2. el7_2.x86_64 (Note that the name of the nodeps behind this is through the above command query out, find a few unloading several)
To install the JDK, there are 2 ways to download:
①: Can be directly to the official website download http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html (here is the rpm 64-bit), Download it and copy it to the directory you want to store in CentOS.
②: Directly in CentOS, create a directory store to download the JDK and then download it via command (more than 100 megabytes, a bit slow ...). ):
http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
When you are finished downloading, install:
RPM-IVH jdk-8u131-linux-x64.rpm
After installation, java-version to see if the installation was successful.
Then configure the environment variable to open the/etc/profile file
Vi/etc/profile
Then press I to enter edit mode and add the following configuration at the end of the file:
Java_home=/usr/java/jdk1. 8 . 0_131 # (note: See for yourself which directory your JDK is installed in) jre_home=/usr/java/jdk1. 8 . 0_131/jreclasspath=.: $JAVA _home/lib/dt. jar:$JAVA _home/lib/tools. jar: $JRE _home/libpath= $JAVA _home/ Bin: $PATHexport PATH java_home CLASSPATH
Finally press ESC and enter
: Wq
Exit Save
Execute the following command to make the environment variable configuration effective
Source/etc/profile
Finally, verify that the configuration is successful by following the command
echo $JAVA _homeecho $CLASSPATHecho $PATH
2. Install Tomcat:
Download tomcat (find a directory to store)
wget apache-tomcat-7. 0. + http://mirrors.hust.edu.cn/apache/tomcat/tomcat-7/v7. 0. /bin/apache-tomcat-7. 0. tar.gz.
Decompression can
TAR-ZXVF apache-tomcat-7. 0. +
Launch Tomcat, go to unzip directory/apache-tomcat-7.0.78/bin, execute
./startup.sh
Then you can access it through the browser.
http://Service IP address 8080
If you want to modify the default port, then you can modify tomcat to extract the Server.xml file in the directory/apache-tomcat-7.0.78/conf
VI Server.xml
Then find the middle section configuration, as below, change port 8080 to what you want.
<connector port="8080" protocol="http/1.1" connectiontimeout="20000" redirectport="8443 " />
Exit, save, restart Tomcat,ok
If you are accessing the Tomcat server, there are similar problems that cannot be connected to the server,
Then, first confirm that Tomcat is started, and you will see the following when you start Tomcat
[[Email protected]7bin]#./startup.sh Usingcatalina_base:/work/apps/apache-tomcat-7.0. +UsingCatalina_home:/work/apps/apache-tomcat-7.0. +UsingCatalina_tmpdir:/work/apps/apache-tomcat-7.0. +/tempusingJre_home:/usr/java/jdk1.8. 0_131usingCLASSPATH:/work/apps/apache-tomcat-7.0. +/bin/bootstrap.jar:/work/apps/apache-tomcat-7.0. +/bin/tomcat-juli.jartomcat started.
If you determine that the startup is successful, then it is possible that the server did not develop port 8080, then open port access by the following method;
3. Open Access Service port
You can test whether a port can be accessed by using the following command
. 211. . 4 8080
If the following information appears, the port is not open to access
. 211. . 4 ... telnet: . 211. . 4 : Connection refused telnet: Unable to connect to remote host
Open access to the service port by using the following method
Vi/etc/sysconfig/iptables
Can add a row or copy existing port information, modify the port
3306 8080-j ACCEPT
Then save exit, restart Port service
Service Iptables Restart
Perform the above Telnet command again to check it out.
4. Install MySQL
This is still read by others, I think the writing is very good
Links: http://blog.csdn.net/xyang81/article/details/51759200
Deploying the Java Development environment under Centos7.2