Detailed steps for installing the java development environment in CentOS

Source: Internet
Author: User
Tags dba gz file zip centos iptables tomcat sqlplus firewall

To install the java development environment in CentOS, follow these steps:

1. Install jdk

1. Check whether the built-in JDK of Linux is installed

Java? Version

If openjdk appears, you 'd better uninstall openjdk first and install the jdk of sun.

2. View jdk information

Rpm-qa | grep java

3. Uninstall OpenJDK and perform the following operations:

Rpm-e -- nodeps tzdata-java-2012c-1.el6.noarch
Rpm-e -- nodeps java-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64

4. Create a java installation directory

Mkdir/usr/java

5. Decompress and install the downloaded jdk

Tar-zxvf jdk-7u71-linux-i586.tar.gz

6. Add java environment variables to the profile file.

Vi/etc/profile

Export JAVA_HOME =/usr/java/jdk1.7.0 _ 71
Export CLASSPATH =.: % JAVA_HOME %/lib/dt. jar: % JAVA_HOME %/lib/tools. jar
Export PATH = $ PATH: $ JAVA_HOME/bin

7. Make the file take effect immediately

Source/etc/profile // or reboot

8. Check whether the installation is successful.

Java-version

II. Install Tomcat

1. Upload The downloaded atat.tar.gz file to/var/local (you can select the path as needed) and decompress it.

Tar-zxvf apache-tomcat-7.0.57.tar.gz

2. Move the uploaded tomcat file to a directory and change its name.

Mv apache-tomcat-7.0.57/
Mv apache-tomcat-7.0.57 tomcat7

3. Start tomcat

./Startup. sh

Access tomcat's default address directly after startup
4. Disable the firewall when the access fails.

Service iptables stop

5. Set auto-start upon startup

Method 1: Add tomcat and java_home environment variables under/etc/rs. local.

Vi/etc/rs. local

JAVA_HOME =/usr/java/jdk1.7.0 _ 71
Export JAVA_HOME
/Tomcat7/bin/startup. sh

It should be noted that rc. local is executed before/etc/profile, so the JAVA environment variable is not available. Therefore, add the code JAVA_HOME before startup. sh.

III. Install oracle

Official installation guide for https://docs.oracle.com/cd/E11882_01/install.112/e24323/toc.htm#i1011296

1. Hardware requirements (this is not the focus. Check the official website)
2. Software Requirements
2.1 View dependency packages

Rpm-q binutils compat-libcap1 compat-libstdc ++-33-3.2.3 gcc-c ++ glibc-devel ksh libgcc libstdc ++-devel libaio-devel make sysstat

In addition to the packages mentioned on the official website, the following packages are missing during installation:

UnixODBC-2.2.11

UnixODBC-devel-2.2.11

Elfutils-libelf-devel-0.97

Pdksh-5.2.14

2.2 Use yum to install the required packages

Yum-y install binutils compat-libcap1 compat-libstdc ++-33-3.2.3 gcc-c ++ glibc-devel ksh libgcc libstdc ++-devel libaio-devel make sysstat

2.3 install libXp

This Library must be installed. Otherwise, a java Exception occurs during Oracle installation.

Yum-y install libXp

3. Environment configuration

3.1 disable firewall and SELinux

Chkconfig iptables off

# Vi/etc/selinux/config
SELINUX = disabled

Then restart.

3.2 modify the machine name (generally equal by default)

The hostname in/etc/sysconfig/network must be consistent with that in/etc/hosts.

3.3 create Users and Groups

The username and group created here will help you directly select when installing oracle. Otherwise, no users or groups are installed.

Create Group oinstall

Groupadd oinstall

Create Group dba

Groupadd dba

Add oracle users to oinstall and dba groups

Useradd-g oinstall-G dba oracle

Test whether the oracle account has been created

Id oracle

Create a new oracle password

Passwd oracle

3.4 create an Oracle installation folder and a data storage folder

Mkdir-p/opt/oracle/
Mkdir-p/opt/oracle/oraInventory
Chown-R oracle: oinstall/opt/oracle
Chmod-R 775/opt/oracle

3.5 configure system kernel parameters

Vi/etc/sysctl. conf

Add the following parameters:

Fs. aio-max-nr = 1048576
Fs. file-max = 6815744
Kernel. shmmni = 4096
Kernel. sem = 250 32000 100 128
Net. ipv4.ip _ local_port_range = 9000 65500
Net. core. rmem_default = 262144
Net. core. rmem_max = 4194304
Net. core. wmem_default = 262144
Net. core. wmem_max = 1048576

Enable the change just made

# Sysctl-p

3.6 modify the number of processes and the maximum number of sessions

Edit/etc/security/limits. conf

Vi/etc/security/limits. conf

Oracle soft nproc 2047
Hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536

3.7 set the association information and run the following command to modify the association file/etc/pam. d/login.

Vi/etc/pam. d/login

Join:

Session required/lib/security/pam_limits.so
Session required pam_limits.so

3.8 modify the parameters of the system startup environment and run the following command to modify the parameters file of the system startup environment:

Vi/etc/profile

Add the following after pathmunge:

If [$ USER = "oracle"]; then
If [$ SHELL = "/bin/ksh"]; then
Ulimit-p 16384
Ulimit-n 65536
Else
Ulimit-u 16384-n 65536
Fi
Fi

3.9 switch users and configure oracle User Environment variables

Vi. bash_profile
ORACLE_BASE =/opt/oracle
ORACLE_HOME = $ ORACLE_BASE/product/11.2.0/dbhome_1/bin/(different versions of oracle installation directories may be different. Here is 11.2.0)
ORACLE_SID = SIMS (database instance, defined by yourself)
LD_LIBRARY_PATH = $ ORACLE_HOME/lib
PATH = $ PATH: $ ORACLE_HOME/bin: $ HOME/bin
 
Export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH

// The installation folder $ ORACLE_HOME is not recommended on the official website. However, we recommend that you set up the installation folder here because the dbca, netca, and other commands cannot be found.

Make settings take effect

Source/home/oracle/. bash_profile

3.10 installation

Put the downloaded oracle file under/opt/oracle

Su-oracle
$ Cd/opt/oracle
$ Unzip linux.11gR2_database_1of2.zip
$ Unzip linux.11gr2_databasesilicate f2.zip

3.11 solve Chinese garbled characters before installation

If echo $ LANG is not in English, set

Export

3.12 switch to graphical interface for installation

If the installation is remote, you need to install remote software. Otherwise, you cannot enter the graphical installation interface;
You do not need to install centos directly on the server.

Cd/opt/oracle/databse
$./RunInstaller

Notes:

In the first step, you can choose not to write the email address. The installation method is the single database installation method. Only the software body is installed, and no database or listener is set up. Therefore, you need to create a database and configure the listener after the installation.

Note: I think a lot of information on the internet is to create a database first and then configure the listener. I don't know how to do this, but when I'm actually doing this,

You cannot create a database first. You must configure a listener first!

4. After the installation is complete, the oracle user logs on

4.1 Configuration listening:

Netca

Step by step.

4.2 create a database:

Dbca

Remember to select Chinese for the character set.

(If ORACLE_HOME is not specified, these commands cannot be used. You can check your current ORACLE_HOME, that is, echo $ ORACLE_HOME)

4.3 test whether installation is successful

View the listening status:

Lsnrctl status

Database connection:

Sqlplus/as sysdba
Conn system/123456 @ SIMS (here I changed the password of all users to 123456 when creating the database)

At this point, the Oracle 11g database under CentOS6 is successfully installed.

4. Start ORACLE on CentOS6

1. Manually start the database

Log on with an Oracle User

$ Lsnrctl start
$ Sqlplus/as sysdba
SQL> startup

Then you can operate the database.

2. Automatically start the database

2.1 root user login

Modify oratab

# Vi/etc/oratab
SIMS:/opt/oracle/product/11.2.0/dbhome_1: Y (change N to Y)
Esc: wq!

Save

2.2 modify dbstart and dbshut

# Vi/opt/oracle/11.2.0/bin/dbstart
ORACLE_HOME_LISTNER = $ ORACLE_HOME (originally $1)
Esc: wq!

# Vi/opt/oracle/11.2.0/bin/dbshut
ORACLE_HOME_LISTNER = $ ORACLE_HOME (originally $1)
Esc: wq!

2.3 add content to rc. local

# Vi/etc/rc. d/rc. local

Add the following content to the file

Su oracle-lc "/opt/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
Su oracle-lc "/opt/oracle/product/11.2.0/dbhome_1/bin/dbstart"

Esc: wq!

After the above steps, we have installed the java environment.

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.