Centos6.5 build java development environment configuration details

  • 2020-05-14 05:53:37
  • OfStack

1. Install jdk

1. Check to see if JDK, which comes with Linux, is installed


java  � version 

If openjdk appears, it is best to uninstall openjdk and install jdk from sun.

2. View jdk information


rpm -qa|grep java 

3. Uninstall OpenJDK and do the following:


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 new java installation directory


mkdir /usr/java 

5. Unzip and install the previously downloaded jdk


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

6. Add the java environment variable 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. Give immediate effect to the document


source /etc/profile  // or reboot 

8. Check whether the installation is successful


java -version 

2. Install Tomcat

1. Upload the downloaded tomcat.tar.gz to /var/local (you can choose your own path) and unzip it


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

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


mv apache-tomcat-7.0.57 / 
mv apache-tomcat-7.0.57 tomcat7 

3. Start tomcat


rpm -qa|grep java 
0

After starting direct access to the tomcat default address

4. Close the firewall when it is not accessible


service iptables stop 

5. Set the boot to start

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 

A little note here, rc.local executes before /etc/profile, so you won't get an JAVA environment variable, so add the code JAVA_HOME before startup.sh

3. Install oracle

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

Refer to the article: / / www. ofstack. com article / 47076. htm

1. Hardware requirements (this is not the point, see the official website)

2. Software requirements

2.1 view the dependency package


rpm -qa|grep java 
3

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

unixODBC-2.2.11

unixODBC-devel-2.2.11

elfutils-libelf-devel-0.97

pdksh-5.2.14

2.2 install the required packages in yum mode


rpm -qa|grep java 
4

2.3 installation libXp

This Library, this 1 must be installed, otherwise when installing Oracle, Java Exception will appear.


rpm -qa|grep java 
5

3. Environment configuration

3.1 close the firewall and disable SELinux


rpm -qa|grep java 
6

rpm -qa|grep java 
7

Then reboot.

3.2 modify the machine name (1 is equivalent by default)

Here, hostname in /etc/sysconfig/ hosts is going to correspond to 1 in /etc/hosts, so if 1 corresponds, you don't have to modify it

3.3 establish users and groups

The user names and groups set up here will be selected directly for you when installing oracle. Otherwise there will be no users or groups installed.

Create group oinstall


rpm -qa|grep java 
8

Create a group dba


rpm -qa|grep java 
9

Add new oracle users and add them to the oinstall and dba groups


useradd -g oinstall -G dba oracle 

Test whether the oracle account has been set up


id oracle 

Create a new password for oracle


passwd oracle 

3.4 create the Oracle installation folder and the 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 the 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 you just made


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 
6

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

Edit/etc security/limits conf


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 
7

3.7 set up the correlation information, execute the following command, modify the associated files/etc/pam d/login


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 
8

Add:


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 
9

3.8 modify the system startup environment parameters. Execute the following command to modify the system startup environment parameters file


vi /etc/ profile 

Add after pathmunge:


mkdir /usr/java 
1

3.9 switch users and configure oracle user environment variable


mkdir /usr/java 
2

// the official website suggests not setting up the installation folder, i.e. $ORACLE_HOME, but I suggest setting it up here, because if not, the following commands dbca and netca cannot be found

Enable Settings


mkdir /usr/java 
3

3.10 installation

Put the downloaded oracle file under /opt/oracle


mkdir /usr/java 
4

3.11 solve the Chinese garbled code before installation

echo $LANG, if not in English, will be set as follows for the time being


mkdir /usr/java 
5

3.12 switch to graphical interface installation

If it is remote, you need to install the remote software, otherwise you cannot enter the graphical installation interface.

This is not necessary if you are operating directly on the server, so when installing centos, you need to select the desktop installation


mkdir /usr/java 
6

Note the following:

Step 1 email can not write; The installation method I selected is single database installation, which only installs the software body, without setting up the database and monitoring, so it is necessary to create the database and configure monitoring after installation.

So notice 1 here, I've seen a lot of stuff on the Internet that you create a database and then you configure the monitor, and I don't know how you do that, but when I actually do it,

First create the database is not created, 1 must first configure monitoring!

4 after the installation is complete, the oracle user logs in

4.1 configuration monitoring:


mkdir /usr/java 
7

One step at a time

4.2 database creation:


mkdir /usr/java 
8

Note that the character set 1 block is in Chinese

(if ORACLE_HOME is not specified, you can't use these commands, so you can look at your current ORACLE_HOME, echo $ORACLE_HOME)

4.3 test whether the installation was successful

Check the listening status:


lsnrctl status 

Database connection:


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

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

4. CentOS6 starts ORACLE

1. Start the database manually

Log in with the Oracle user


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

Then you can manipulate the database

2. Start the database automatically

2.1 root user login

Modify oratab


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

save

2.2 modify dbstart dbshut


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

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

2.3 add content to rc.local


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

Add the following to the file


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

And we're done!

5. Other
Linux update source: https: / / lug ustc. edu. cn wiki/mirrors/help/centos
1. Enter the yum source configuration directory as root


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

2. Backup the system's own yum source


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

3. Download the corresponding version of hkust yum source, in the add/etc/yum repos. d /

Can also be wget http: / / centos ustc. edu. cn/Centos - Base. repo personal feeling bad (though this method to determine the source version)

4. After the source is updated, the cache is generated for the operation to take effect immediately


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

5. Start updating


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 
0

Install the Chinese input method

1. Install as root


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 
1

2. Set to add the input method you just installed to the input method list

Click system - > preferences-- > Input Method. Then click "Enable input method feature ", tick" enable input method feature ", and select "Use IBus(recommended)", and click "preferred input method".

Click "Input Method Preferences", click the input method TAB, select Chinese, select pinyin in the list (of course, you can choose other input methods), click "add", and add the selected input method to the list of input methods

3.reboot

finished! Have fun!


Related articles: