当前位置:计算机技术 - 【最新】ubuntu(openEuler欧拉)安装openjdk22,tomcat11,nginx


【最新】ubuntu(openEuler欧拉)安装openjdk22,tomcat11,nginx
原创:netnorth 阅读次数:1080 日期:2024-07-17

1、openjdk.org下载 openjdk22 tar.gz

不用jre

#vim /etc/profile

export JAVA_HOME=/usr/java/jdk

export JRE_HOME=$JAVA_HOME

export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib

export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

#source /etc/profile

2、tomcat11

tomcat.apache.org 下载tar.gz

不用 #vim /usr/local/tomcat/bin/setenv.sh

#vim /usr/loacal/tomcat/bin/catalina.sh

在 # OS specific support.  $var _must_ be set to either true or false. 添加

JAVA_HOME=/usr/java/jdk

JRE_HOME=$JAVA_HOME

#vim /lib/systemd/system/tomcat.service #ubuntu 18.04下

#vim /usr/lib/systemd/system/tomcat.service #ubuntu 22.04及以上

[Unit]

Description=Tomcat 11 Web Application Container

After=network.target

[Service]

Type=forking

Environment=JAVA_HOME=/usr/java/jdk

Environment=CATALINA_PID=/usr/local/tomcat/temp/tomcat.pid

Environment=CATALINA_HOME=/usr/local/tomcat

Environment=CATALINA_BASE=/usr/local/tomcat

Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'

Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/usr/local/tomcat/bin/startup.sh

#ExecStop=/usr/local/tomcat/bin/shutdown.sh

ExecReload=/bin/kill -s HUP $MAINPID

ExecStop=/bin/kill -s QUIT $MAINPID

#User=tomcat #可不要

#Group=tomcat #可不要

UMask=0007

RestartSec=10

Restart=always

[Install]

WantedBy=multi-user.target

#cd /lib/systemd/system/tomcat.service

#cd /usr/lib/systemd/system/tomcat.service

#chmod 754 tomcat.service

#systemctl daemon-reload #根据需要执行18.04需要执行

#systemctl enable tomcat.service

#systemctl start tomcat.service

3、nginx

----------------------------------------------

ubuntu22.04安装依赖(nginx 的 ssl pcre等)

1.首先使用dpkg命令查看自己需要的软件是否安装。

例如查看zlib是否安装:


dpkg -l | grep zlib

2.解决依赖包openssl安装,命令:

sudo apt-get install openssl libssl-dev

3.解决依赖包pcre安装,命令:

sudo apt-get install libpcre3 libpcre3-dev

4.解决依赖包zlib安装,命令:

sudo apt-get install zlib1g-dev 

.....................安装pcre..................

#wget https://sourceforge.net/projects/pcre/files/pcre/8.35/pcre-8.45.tar.gz

#tar -zxvf pcre-8.45.tar.gz

#cd pcre-8.45

#./configure  --prefix=/usr/local/pcre-8.45

#make && make install

-----------------------------------------------

#wget http://nginx.org/download/nginx-1.26.1.tar.gz && tar -zxvf nginx-1.26.1.tar.gz && cd nginx-1.26.1 && ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_realip_module --with-pcre && make && make install

--with-pcre 使用系统pcre
 --with-pcre=/root/downloads/pcre-8.45 应该为源码的路径

#vim /usr/lib/systemd/system/nginx.service

#vim /lib/systemd/system/nginx.service #ubuntu 18.04

--------------------------------------

[Unit]

Description=nginx - high performance web server

After=network.target remote-fs.target nss-lookup.target


[Service]

Type=forking

ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

ExecReload=/usr/local/nginx/sbin/nginx -s reload

ExecStop=/usr/local/nginx/sbin/nginx -s stop


[Install]

WantedBy=multi-user.target

---------------------------------------------

#cd /usr/lib/systemd/system/

# cd /lib/systemd/system/

#chmod 754 nginx.service && systemctl enable nginx.service && systemctl start nginx.service


公司概况
华旅网络是一家致力于软件开发、网络设计的互联网公司...
公司业务:软件开发,网站设计,企业CI设计,旅游、美食、交友互动平台......
友情链接

华旅网络官网(Official Website): h.91city.com h.c.91city.com 282509570.c.91city.com
©2017 华旅网络 版权所有 苏ICP备12078118号