JAVA-服務部署配置

nginx jdk maven jenkins git tomcate nexus

nginx

下載源碼 wget http://nginx.org/download/nginx-1.10.2.tar.gz
解壓 tar -zxvf nginx-1.5.9.tar.gz
安裝PCRE庫 yum -y install pcre-devel
安裝OPENSSL yum -y install openssl-devel
配置安裝目錄 ./configure –prefix=/usr/local/nginx
(可選 去除多餘的頭部信息減小數據傳輸量 headers-more-nginx-module)

make 編譯
make install 安裝

nginx 目錄: /usr/local/nginx

jdk:

yum search java | grep ‘java-’
yum -y install java-1.8.0-openjdk*

alternatives –config java
alternatives –config javac

maven:

wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
yum install apache-maven

jenkins:

wget http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo -O /etc/yum.repos.d/jenkins.repo
rpm –import http://pkg.jenkins-ci.org/redhat-stable/jenkins-ci.org.key
yum install jenkins

java -jar jenkins.war -httpPort=9000 -logfile=/var/log/jenkins/jenkins.log

配置

workspace: ITEM_ROOTDIR/ITEM_FULLNAME
git: /usr/libexec/git-core/git
maven: /usr/share/maven

啓動腳本(/opt/service/open-api/start.sh)

#!/bin/sh
nohup java -jar /opt/service/open-api/carrental-api.jar &

服務(/etc/systemd/system/open-api.service)

[Unit]
Description= carrental open api
After=syslog.target

[Service]
Type=forking
ExecStart=/opt/service/open-api/start.sh
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target

複製配置 這裏不需要
給個tomcate實例

[Unit]
Description=Apache Tomcat Web Application Container for www
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre
PIDFile=/opt/tomcat-www/tomcat.pid
ExecStart=/opt/tomcat-www/bin/startup.sh
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

service system

$ systemctl enable open-api.service
$ systemctl start open-api
$ systemctl stop open-api.service
$ systemctl restart open-api.service
$ java -jar carrental-webapi.jar

git:

yum install git-core

tomcat:

yun install tomcat

systemctl start tomcat

maven私庫:

download https://support.sonatype.com/hc/en-us/articles/213464118-Download-Nexus-Repository-Manager-2

start ./bin/nexus

url: http://xxxxxxxxxxx:8288/nexus/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章