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
华旅网络 |