标签:工作 set usr var build pad 下载 spec direct
yum install rpm-build -y
mkdir -pv ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
tomcat请自行下载
<!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> -->
CATALINA_HOME=/usr/local/tomcat JAVA_HOME=/usr/local/jdk CATALINA_PID=/usr/local/tomcat/var/tomcat.pid JAVA_OPTS="${JAVA_OPTS} -Duser.timezone=Asia/Shanghai -Dfile.encoding=utf-8 -server -XX:PermSize=512m -XX:MaxPermSize=512m -Xms4096m -Xmx4096m -Djava.awt.headless=true"
修改catalina.sh,搜索关键词 touch "$CATALINA_OUT"
org.apache.catalina.startup.Bootstrap "$@" start >> "$CATALINA_OUT" 2>&1 "&"
修改为
org.apache.catalina.startup.Bootstrap “$@” start 2>&1 \ | /usr/local/sbin/cronolog “$CATALINA_BASE”/logs/catalina.%Y-%m-%d.out >> /dev/null &
yum install -y cronlog
本次试验为centos7.3,顾准备systemd所需的单元文件
[Unit] Description=Tomcat After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/usr/local/tomcat/var/tomcat.pid ExecStart=/usr/local/tomcat-8.5.29/bin/startup.sh &>/dev/null ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
%define path_name usr/local %define name_ tomcat-8.5.29 Name: tomcat Version: 8.5.29 Release: 1%{?dist} Summary: tomcat Group: tomcat License: GPL URL: http://www.test.net Packager: tomcat Vendor: tomcat Source0: tomcat-8.5.29.tar.gz Source1: tomcat.service BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot %description tomcat %prep mkdir -pv %{buildroot}/%{path_name} %setup -q %install mkdir -pv $RPM_BUILD_ROOT/%{path_name}/%{name_}/var cp -rf * $RPM_BUILD_ROOT/%{path_name}/%{name_}/ %{__install} -p -D %{SOURCE1} %{buildroot}/usr/lib/systemd/system/tomcat.service %post ln -s $RPM_BUILD_ROOT/%{path_name}/%{name_}/ $RPM_BUILD_ROOT/%{path_name}/tomcat %postun rm -fr /%{path_name}/%{name_} rm -fr /%{path_name}/tomcat %files %defattr(-,root,root,-) %attr(0755,root,root) /usr/local/ %attr(0755,root,root) /usr/lib/systemd/system/tomcat.service %attr(0755,root,root) /usr/local/tomcat-8.5.29/var %changelog * Sat Oct 24 2015 yeho 1.15-1 - Initial version
标签:工作 set usr var build pad 下载 spec direct
原文地址:https://www.cnblogs.com/LC161616/p/9030643.html