搭建lnmt环境

文章目录

      • tomcat项目部署
        • java环境安装
        • tomcat部署
      • 发布jenkins

nginx安装
mysql安装

tomcat项目部署

java环境安装

[root@localhost ~]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
.....安装过程略

//查看安装的版本
[root@localhost ~]# java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)

tomcat部署

//下载tomcat
[root@localhost ~]# wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.29/bin/apache-tomcat-9.0.29.tar.gz


//创建安装目录,解压软件到目录
[root@localhost ~]# mkdir /opt/tomcat
[root@localhost ~]# tar xf apache-tomcat-9.0.29.tar.gz -C /opt/tomcat/


//进入安装目录
[root@localhost ~]# cd /opt/tomcat/
[root@localhost tomcat]# ls
apache-tomcat-9.0.29


//创建软链接
[root@localhost tomcat]# ln -sv /opt/tomcat/apache-tomcat-9.0.29/ /opt/tomcat/tomcat
"/opt/tomcat/tomcat" -> "/opt/tomcat/apache-tomcat-9.0.29/"
[root@localhost tomcat]# ls
apache-tomcat-9.0.29  tomcat
[root@localhost tomcat]# cd tomcat/
[root@localhost tomcat]# ls
bin  BUILDING.txt  conf  CONTRIBUTING.md  lib  LICENSE  logs  NOTICE  README.md  RELEASE-NOTES  RUNNING.txt  temp  webapps  work


//创建测试网页
[root@localhost tomcat]# cd webapps/
[root@localhost webapps]# ls
docs  examples  host-manager  manager  ROOT
[root@localhost webapps]# mkdir test
[root@localhost webapps]# vim index.jsp
[root@localhost webapps]# cat test/index.jsp 


        test page


        <%
            out.println("Hellow World");
        %>


[root@localhost webapps]# mv index.jsp /opt/tomcat/tomcat/webapps/test/


//重启tomcat
[root@localhost test]# /opt/tomcat/tomcat/bin/catalina.sh stop
[root@localhost test]# /opt/tomcat/tomcat/bin/catalina.sh start


//配置nginx反向代理
[root@localhost ~]# vim /opt/nginx/conf/nginx.conf
    #gzip  on;
    upstream test {
    server 192.168.26.156:8080;
    }

    server {
        listen       80;
        server_name  www.tomcattest.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
        proxy_pass http://test;
        }

        #error_page  404              /404.html;



//重启nginx
[root@localhost ~]# nginx -s stop
[root@localhost ~]# nginx
[root@localhost ~]# ss -tanl
State       Recv-Q Send-Q                                       Local Address:Port                                                      Peer Address:Port              
LISTEN      0      128                                                      *:80                                                                   *:*                  
LISTEN      0      128                                                      *:22                                                                   *:*                  
LISTEN      0      100                                              127.0.0.1:25                                                                   *:*                  
LISTEN      0      100                                                     :::8080                                                                :::*                  
LISTEN      0      128                                                     :::22                                                                  :::*                  
LISTEN      0      100                                                    ::1:25                                                                  :::*                  
LISTEN      0      1                                         ::ffff:127.0.0.1:8005                                                                :::*                  
LISTEN      0      100                                                     :::8009                                                                :::*                  
LISTEN      0      80                                                      :::3306                                                                :::*                  

搭建lnmt环境_第1张图片
搭建lnmt环境_第2张图片

发布jenkins

//下载jenkins
[root@localhost ~]# wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
[root@localhost ~]# ls
anaconda-ks.cfg  apache-tomcat-9.0.29.tar.gz  jenkins.war


//将jenkins拷贝到tomcat安装目录下的webapps
[root@localhost ~]# cd /opt/tomcat/tomcat/webapps
[root@localhost webapps]# cp /root/jenkins.war ./
[root@localhost webapps]# ls                //拷贝过来后会自动解压安装包
docs  examples  host-manager  jenkins  jenkins.war  manager  ROOT  test

搭建lnmt环境_第3张图片

你可能感兴趣的:(Linux系统)