CentOS Configuration Java Runtime Environment

Source: Internet
Author: User
Tags java web docker ps docker run

centos_ Configuration _docker

centos_6.5

1, centos_6.5 before installing Docker-io need to uninstall the Docker package (not downloaded can be omitted)

$ sudo yum-y remove Docker

2. centos_6.5 need to first install and enable Epel source before installing Docker

$ yum Install Epel-release

3. Install Docker-io Package

$ sudo yum install Docker-io

4. Is 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/Mirror Id/bin/bash

7, download tomcat, JDK (at this time has entered the container to enter the container opt directory $ cd/opt/) 8, the download of Tomcat, JDK into the/root/software/directory (MV command, so that the compression package in the system in the image of the corresponding folder also exists) 9. Unzip the downloaded Tomcat, JDK (if extract invalid $ yum install tar download unpacking)

$ 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. bashrc File $ vi ~/.BASHRC

Add in File

Export JAVA_HOME=/OPT/JDK7

Export path= $PATH: $JAVA _home

Use commands to make environment variables effective

$ source ~/.BASHRC

Write 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 permissions

$ chmod u+x/root/run.sh

Exit Container $ exit

11. View the containers in operation

$ docker Ps-a

12. Create a Java Web Image

Container ID liyunke/javaweb:0.1 on top of Docker commit

13. Start the Java Web container

View all mirrors $ docker images

Start the image you just created

$ docker run-d-P 58080:8080--name javaweb liyunke/javaweb:0.1/root/run.sh

Visit the Tomcat home page (Port 58080)

Centos_7

1.$ yum Install libdevmapper*-y 2 , JoinDocker the 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 , Installing Docker

$ yum Install Docker-engine

4. Start Docker

$ service Docker start

CentOS Configuration Java Runtime Environment

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.