CentOS7 Installing the Java Environment

Source: Internet
Author: User

Java Environment

The company recently need to build a Java environment, so confused I had to get into countless heap of technical documents, but experienced countless failures to find a good document is how important, but the self-writing is not, time is limited, are according to the predecessors step by step realization, trample the pit countless, will eventually achieve, The document is now collocated in its own garden for the classic

Version used: cenos7,tomcat1.7,jdk1.8,oracle11gx64

Installed directory:/home/java

1 Configuring the JDK

Files can be downloaded from the Oracle website, downloaded LinuxX64. tar.gz, and uploaded to the server

To install the JDK:

1.1. Clean up the environment

Rpm–qa | grep java

1.2. Delete existing Files

RPM-E--nodeps java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64

RPM-E--nodeps java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64

RPM-E--nodeps java-1.7.0-openjdk-1.7.0.141-2.6.10.5.el7.x86_64

RPM-E--nodeps java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.5.el7.x86_64

RPM-E--nodeps Javapackages-tools-3.4.1-11.el7.noarch

RPM-E--nodeps Tzdata-java-2017b-1.el7.noarch

RPM-E--nodeps Python-javapackages-3.4.1-11.el7.noarch

Rpm-qa | grep java

1.3, decompression is installed

Configure Environment Files Vim/etc/profile

Export JAVA_HOME=/HOME/JAVA/JDK8

Export path= $JAVA _home/bin: $PATH

Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

Export Java_home PATH CLASSPATH

startup file:./etc/profile or Source/etc/profile .

Java-version A cannot restore segment prot after reloc:permission denied this error

Workaround: Under root user, modify the/etc/selinux/config file and change the selinux=enforcing to selinux=disabled.

Go to JDK folder under bin chmod 777 Java

Then, save the shutdown and restart the machine on it.

View version: Java–version

2 Configuring Tomcat

File

Http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.86/bin/apache-tomcat-7.0.86.tar.gz

2.1. Download the file

wget Address

2.2. Unzip the file

TAR–ZXVF apache-tomcat-7.0.86.tar.gz

2.3. Renaming

MV Apache-tomcat-7.0.86.tar.gz tomcat1.7

2.4. Modify the port

Vim/home/java/tomcat1.7/conf/server.xml//Modify into a company open port

I configured here to 10002

http://202.100.197.216:10002/ //Access successful

4 Redis Installation

4.1. System environment and release notes

Redis version Select Current official version redis-4.0.9

4.2. Download the Redis installation package online

wget http://download.redis.io/releases/redis-4.0.9.tar.gz

4.3. Go to the directory and do a make compilation

CD redis-3.2.8

Make MALLOC=LIBC

$ make

Note:after the make command finishes compiling, 6 executables are generated in the SRC directory, respectively

Redis-server, Redis-cli, Redis-benchmark, redis-check-aof, Redis-check-rdb, Redis-sentinel.

New version Redis-check-dump changed to Redis-check-rdb

4.1. Redis Installation Configuration

Install Redis, and perform the make install. Copies the 6 executable files generated by make compilation to the/usr/local/bin directory;

Make install

CD src && make install

MAKE[1]: Enter directory "/HOME/LZH/REDIS-3.2.8/SRC"

Hint:it ' s a good idea to run ' make test ';)

Install Install

Install Install

Install Install

Install Install

Install Install

MAKE[1]: Leave directory "/HOME/LZH/REDIS-3.2.8/SRC"

4.2. Generating Redis data

4.2.1, execute./utils/install_server.sh after configuring Redis configuration, Redis can boot with the system! During the execution will let you choose the port, file name and so on, I choose the default!

4.2.2, view boot list

Chkconfig--list

Note: This output shows only the SysV service and does not contain the native SYSTEMD service. SysV configuration data may be overwritten by native SYSTEMD configuration.

If you would like to list the SYSTEMD service, please do ' systemctl list-unit-files '.

To view services enabled for a specific target, perform

' Systemctl list-dependencies [target] '.

Netconsole 0: Off 1: Off 2: Off 3: Off 4: off 5: off 6: Off

Network 0: Off 1: Off 2: Open 3: Open 4: Open 5: Open 6: Off

redis_6379 0: Off 1: Off 2: Open 3: Open 4: Open 5: Open 6: Off

4.2.3, Redis service view, open, close

Viewing the Redis process with the Ps-ef|grep redis command

Ps-ef|grep Redis

Root 12831 1 0 10:21? 00:00:01/usr/local/bin/redis-server 127.0.0.1:6379

Root 13100 4090 0 10:29 pts/0 00:00:00 grep--color=auto Redis

Turn off Redis service operation via/etc/init.d/redis_6379 Stop command, also available through (Service redis_6379 stop)

Enable Redis service operation via/etc/init.d/redis_6379 Start command, also available via (Service redis_6379 start)

You can also start with the Redis-server command.

$ src/redis-server

V. Redis Test

Redis-cli

127.0.0.1:6379> FLUSHDB--Clears the currently selected database

Ok

127.0.0.1:6379> Set TestKey 2

Ok

127.0.0.1:6379> Get TestKey

"2"

Both Tomcat and Redis are configured successfully to configure the association between the two

The first step:

Put the Tomcat support Redis package into the Lib folder of the Tomcat installation directory

Step Two:

Close the Tomcat service and enter the Conf directory

Vim Context.xml

Add in context

<valve classname= "Com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve"/>

<manager classname= "Com.orangefunction.tomcat.redissessions.RedisSessionManager"

Host= "127.0.0.1"

Port= "6379"

database= "0"

Maxinactiveinterval= "/>"

Step Three:

Start the Tomcat service, Access Tomcat success is configured successfully, if not successful, multiple visits several times, and then carefully read to see which step appears disclosed, the document is only for reference practical problems actually solved

3 Oracle Installation

3.1. Install VIM Editor

Yum Install Vim–y

3.2, install unzip decompression device

Yum Install Unzip–y

3.3. Install dependent packages

Yum-y Install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh Libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++- Devel*.devel libxi libxi*.i686 libxtst libxtst*.i686 make Sysstat unixODBC unixodbc*.i686 unixodbc-devel unixODBC-devel* . i686

3.4, check whether there are 31

Rpm-q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ Libstdc++-devel libxi libxtst make Sysstat UnixODBC unixodbc-devel

3.5. Add installation users and Groups

GROUPADD-G 501 Oinstall

GROUPADD-G 502 DBA

GROUPADD-G 601 Asmadmin

GROUPADD-G 602 ASMDBA

GROUPADD-G 603 Asmoper

Useradd-u 1101-g oinstall-g dba Oracle

ID Oracle

3.6. Adding kernel parameters

Vim/etc/sysctl.conf

FS.AIO-MAX-NR = 1048576

Fs.file-max = 6815744

Kernel.shmall = 2097152

Kernel.shmmax = 48719476736

Kernel.shmmni = 4096

Kernel.sem = 250 32000 200 200

Net.ipv4.ip_local_port_range = 9000 65500

Net.core.rmem_default = 262144

Net.core.wmem_default = 262144

Net.core.wmem_max = 1048586

Net.core.rmem_max = 4194304

3.7. View Kernel parameters

/sbin/sysctl-p

3.8, modify the user's limit file

Vim/etc/security/limits.conf

Oracle Soft Nproc 2047

Oracle Hard Nproc 16384

Oracle Soft Nofile 1024

Oracle Hard Nofile 65536

3.9. Modify the Vim/etc/pam.d/login file

Vim/etc/pam.d/login

Session required/lib64/security/pam_limits.so

Session Required Pam_limits.so

3.10. Turn off SELinux

Vim/etc/selinux/config

Set selinux=disabled

3.11. Turn off the firewall

Service Iptables Stop

Systemctl Stop Firewalld

Systemctl Disable FIREWALLD

3.12. Create directories and set file permissions

Mkdir-p/home/java/oracle/product/11.2.0

Mkdir/home/java/oracle/oradata

Mkdir/home/java/inventory

Mkdir/home/java/oracle/fast_recovery_area

Chown-r oracle:oinstall/home/java/oracle

Chmod-r 775/home/java/oracle

3.13. Unzip the file

Mkdir-p/home/java/oracle/oracledir

Cd/home/java/oracle/oracledir

Unzip Linux.x64_11gR2_database_1of2.zip && Unzip Linux.x64_11gR2_database_2of2.zip

14, Su Oracle. Vim. Bash_profile

Oracle_base=/home/java/oracle

Oracle_home= $ORACLE _base/product/11.2.0

Oracle_sid=orcl

Path= $PATH: $ORACLE _home/bin

Export Oracle_base oracle_home oracle_sid PATH

Make the file effective

source. bash_profile

3.15. Configuring Oracle Environment Variables

Vim/etc/profile

Add the following content

if [$USER = "Oracle"]; Then

if [$SHELL = "/bin/ksh"]; Then

Ulimit-p 16384

Ulimit-n 65536

Else

Ulimit-u 16384-n 65536

Fi

Umask 022

Fi

3.16. Edit the silent installation response file

Cd/home/oracle

Cp-r/home/java/oracle/oraclesetup/home/javabase/response/.

CD response/

Vim DB_INSTALL.RSP

Modify the following

Oracle.install.option=install_db_swonly

Oracle_hostname=centos

Unix_group_name=oinstall

Inventory_location=/home/java/oracle/inventory

Selected_languages=en,zh_cn

oracle_home=/home/java/oracle/product/11.2.0

Oracle_base=/home/java/oracle

Oracle.install.db.installedition=ee

Oracle.install.db.dba_group=dba

Oracle.install.db.oper_group=dba

Oracle.install.db.config.starterdb.type=general_purpose

Oracle.install.db.config.starterdb.globaldbname=zkz.orcl

Oracle.install.db.config.starterdb.sid=orcl

oracle.install.db.config.starterdb.password.all=123456

Decline_security_updates=true

3.17. Installation

cd/home/java/oracle/oracledir/home/javabase/

./runinstaller-silent-responsefile/home/oracle/response/db_install.rsp-ignoreprereq

View Logs

Configuring monitoring

Netca/silent/responsefile/home/oracle/response/netca.rsp

Run the previous sentence after

Generate Listener.ora files under/home/java/oracle/product/11.2.0/netword/admin

Modify the Listener file

Sid_list_listener =

(Sid_list =

(Sid_desc =

(Sid_name = ORCL)

(Oracle_home =/home/java/oracle/product/11.2.0)

(Global_dbname = ORCL)

)

)

LISTENER =

(Description_list =

(DESCRIPTION =

(Address_list =

(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.1.50) (PORT = 1521))

)

)

)

3.18. Create an instance (test data)

Vi/home/oracle/response/dbca.rsp

Gdbname = "Orcl.zkz"

SID = "ORCL"

Syspassword = "123456"

Systempassword = "123456"

CHARACTERSET = "ZHS16GBK"

nationalcharacterset= "Al16utf16"

Save Exit Input:

Dbca-silent-responsefile/home/oracle/response/dbca.rsp

3.19. Start monitoring

Lsnrctl stop

Lsnrctl start

Sqlplus/nolog

Conn/as SYSDBA

Connect Sys/sys as Sysdba

Shutdown normal

Startup Mount

ALTER DATABASE open;

CentOS7 Installing 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.