Configure the java Runtime Environment for CentOS and centosjava

Source: Internet
Author: User
Tags docker ps

Configure the java Runtime Environment for CentOS and centosjava
CentOS _ configuration_docker

CentOS_6.5

1. CentOS_6.5 uninstall the docker package before installing docker-io (you can omit it if you have not downloaded it)

$ Sudo yum-y remove docker

2. CentOS_6.5 install and enable the EPEL source before installing docker.

$ Yum install epel-release

3. Install the docker-io package

$ Sudo yum install docker-io

4. Are you trying to connect to a TLS-enableed daemon with out TLS?

$ Service docker start

$ Yum-y install device-mapper-libs (-d Error)

5. Download The centos Image

$ Docker pull daocloud. io/library/centos: 7.1.15037.1.1503: Pulling from daocloud. io/library/centos

6. Start the container (Mount)

$ Docker run-I-t-v/root/software/:/mnt/software/image ID/bin/bash

7. Download Tomcat and jdk (enter the container's opt directory $ cd/opt /) 8. Put the downloaded Tomcat and jdk in the/root/software/directory (the mv command also exists in the corresponding folder of the compressed package in the image) 9. decompress the downloaded Tomcat and jdk (if unzipping is invalid, download the decompressed package $ yum install tar)

$ Tar-zxf/mnt/software/apache-tomcat-7.0.69.tar.gz-C.

Rename $ mv apache-tomcat-7.0.69/tomcat7/

$ Tar-zxf/mnt/software/jdk-7u79-linux-x64.tar.gz-C.

Rename $ mv jdk1.7 _ 79/jdk7/

10. Configure Environment Variables

Edit the. bashrc File $ vi ~ /. Bashrc

Add

Export JAVA_HOME =/opt/jdk7

Export PATH = $ PATH: $ JAVA_HOME

Use commands to make environment variables take effect

$ Source ~ /. Bashrc

Write the run script $ vi/root/run. sh.

The script content is as follows:

#! /Bin/bash

Source ~ /. Bashrc

Sh/opt/tomcat/bin/catalina. sh run

Add script execution permission

$ Chmod u + x/root/run. sh

Exit container $ exit

11. View running containers

$ Docker ps-

12. Create a Java Web image

$ Container ID liyunke/javaweb: 0.1 on docker commit

13. Start a Java Web Container

View All images $ docker images

Start the created image

$ Docker run-d-p 58080: 8080 -- name javaweb liyunke/javaweb: 0.1/root/run. sh

Visit the tomcat homepage (Port 58080)

 

 

 

 

 

CentOS_7

1,$ Yum install libdevmapper *-y 2 , JoinDocker Installation Source:

$ Vim/etc/yum. repos. d/docker. repo

[Dockerrepo]

Name = Docker Repository

Baseurl = https://yum.dockerproject.org/repo/main/centos/?releasever/

Enabled = 1

Gpgcheck = 1

Gpgkey = https://yum.dockerproject.org/gpg

3 , Install docker

$ Yum install docker-engine

4, Start docker

$ Service docker start

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.