Build Java Runtime Environment under Linux CentOS

Source: Internet
Author: User

Reprint Please specify source: http://blog.csdn.net/l1028386804/article/details/45704569
First, install the JDK

1. Enter the USR directory

Cd/usr

2. Create the Java installation directory in the USR directory

mkdir Java

3. Copy the Jdk-6u24-linux-i586.bin to the Java directory

cp/home/itcast/desktop/jdk-6u24-linux-i586.bin/usr/java/

4. Installing the JDK

Cd/usr/java

./jdk-6u24-linux-i586.bin

5. Installation completed for him to create a link to save the directory length

Ln-s/usr/java/jdk1.6.0_24//USR/JDK

6. Edit the configuration file

Vim/etc/profile

Add the following content:

Java_home=/usr/jdk

Classpath= $JAVA _home/lib/

Path= $PATH: $JAVA _home/bin

Export PATH java_home CLASSPATH

8. Restart the machine or source/etc/profile

sudo shutdown-r now

9. View installation Status

Java-version

Java Version "1.6.0_24"

Java (TM) SE Runtime Environment (BUILD1.6.0_24-B07)

Java HotSpot (TM) Client VM (build 19.1-b02,mixed mode, sharing)

Ii. installation of Tomcat

TAR-ZXVF apache-tomcat-6.0.29.tar.gz-c/opt (unzip to/OPT)

Ln-s/opt/apache-tomcat-6.0.29//opt/tomcat (build link file)

Start Tomcat

cd/opt/tomcat/bin/

./startup.sh (Note: Dots represent the current directory)

If you don't start, try

-I switch to root user and restart

./startup.sh

Test http://127.0.0.1:8080/

Third, uninstall and install MySQL

1. Uninstall MySQL

Linux uninstall MySQL

Uninstall MySQL

1. Find out if MySQL was previously installed

Command: Rpm-qa|grep-i MySQL

You can see two of the MySQL packages:

mysql-4.1.12-3.rhel4.1

mysqlclient10-3.23.58-4.rhel4.1

2. Delete MySQL

Delete command: RPM-E--nodeps package Name

(Rpm-ev mysql-4.1.12-3.rhel4.1)

3, delete the old version of MySQL development header files and libraries

Command: Rm-fr/usr/lib/mysql

Rm-fr/usr/include/mysql

Note: The data and/etc/my.cnf in/var/lib/mysql after uninstallation are not deleted, if determined, then manually deleted

Rm-f/etc/my.cnf

Rm-fr/var/lib/mysql

2. Install MySQL

(1) Uninstall MySQL rpm-e mysql//normal delete mode [[email protected] ~] #rpm-e--nodeps mysql//brute force Delete mode, if you use the above command to delete, prompted to have other dependent files, then use this command to To remove them forcefully.

(2): Installation of MySQL via Yum

1) Yum list| grep mysql: command to view the downloadable version of the MySQL database available on Yum:

2) Yum install-ymysql-server mysql mysql-deve installation

3) Rpm-qimysql-server View the version of the mysql-server you just installed

4) servicemysqld start: Start our MySQL service.

5) servicemysqld Restart restart MySQL

6) Chkconfig mysqld on set MySQL boot from start

7) mysqladmin-u root password ' root ': Use this command to set the root account password to root

Error: Error : 1130-host ... isnot allowed to connect to this MYSQL server

It may be that your account is not allowed to log on remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host", from "localhost" to "%"

Mysql-u root-pvmwaremysql>use MySQL;

Mysql>update User Set host = '% ' Whereuser = ' root ';

Mysql>select host, user from user;

Iv. Opening specific Linux ports

More/etc/sysconfig/iptables

# Firewall Configuration Written Bysystem-config-firewall

# Manual Customization of this file is notrecommended.

*filter

: INPUT ACCEPT [0:0]

: FORWARD ACCEPT [0:0]

: OUTPUT ACCEPT [0:0]

-A input-m state--state established,related-j ACCEPT

-A input-p icmp-j ACCEPT

-A input-i lo-j ACCEPT

-A input-m state--state new-m tcp-p tcp--dport 22-j ACCEPT

-A input-m state--state new-m tcp-p tcp--dport 80-j ACCEPT

-A input-m state--state new-m tcp-p tcp--dport 8080-j ACCEPT

-A input-m state--state new-m tcp-p tcp--dport 3306-j ACCEPT

-A input-m state--state new-m tcp-p tcp--dport 8009-j ACCEPT

-A input-m state--state new-m tcp-p tcp--dport 8081-j ACCEPT

-A input-m state--state new-m tcp-p tcp--dport 3690-j ACCEPT

-A input-j REJECT--reject-with icmp-host-prohibited

-A forward-j REJECT--reject-with icmp-host-prohibited

COMMIT

[Email protected] home]#/etc/init.d/iptablesrestart

Iptables: Clear Firewall rule: [OK]

Iptables: Set the chain to policy accept:filter [OK]

Iptables: Uninstalling module: [OK]

Iptables: Apply firewall rule: [OK]

Build Java Runtime Environment under Linux CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.