- 浏览: 2539469 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
ANT build Debian Package
Create a Repo https://github.com/luohuazju/ant-debian-deploy
On my Virtual Machine
> ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
Host Machine
> ant -version
Apache Ant(TM) version 1.10.3 compiled on March 24 2018
Current nginx is installed on /usr/local/nginx-1.11.9
I add this nginx file to /etc/init.d to enable the nginx service
#!/bin/bash
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO
# An init.d script that works under Ubuntu 12.04 FFS
# load with sudo /usr/sbin/update-rc.d -f nginx defaults
# CHANGE ME.
PATH=/usr/local/nginx-1.11.9/sbin:$PATH
DAEMON=/usr/local/nginx-1.11.9/sbin/nginx
NAME=nginx
DESC=nginx-1.11.9
test -x $DAEMON || exit 0
set -e
function start {
echo -n "Starting $DESC: "
start-stop-daemon --make --start --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
}
function stop {
echo -n "Stopping $DESC: "
$DAEMON -s stop
echo "$NAME."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
Enable the permission
> sudo chmod a+x /etc/init.d/nginx
Then we can stop and start the nginx with our service command
> sudo service nginx stop
And then run this to enable the service command, it will add the service to the startup script
> sudo /usr/sbin/update-rc.d -f nginx defaults
Remove from the service
> sudo /usr/sbin/update-rc.d -f nginx remove
Debian Information
DEBIAN/control - basic information about the Service
DEBIAN/preinst - operations before installation, for example, stop the service first
DEBIAN/postinst - operations after installation, for example, start the service
Sample project is named as ant-debian-deploy.
The ANT task configuration build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="help" name="Sillycat Debian">
<property name="build.dir" value="build" />
<property name="sys.dir" value="${build.dir}/nginx/etc/init.d" />
<property name="debian.dir" value="${build.dir}/nginx/DEBIAN" />
<property name="app.dir" value="${build.dir}/nginx/usr/local" />
<property name="build.deb" value="${build.dir}/build-deb" />
<property name="package.name" value="nginx-1.11.9.deb" />
<property name="debian.src" value="${build.dir}/nginx" />
<property name="build.output.dir" value="dist" />
<property name="nginx.dist" value="install" />
<target name="clean">
<echo message="Cleaning dist, package and modules folders" />
<delete dir="${build.dir}" quiet="true" />
</target>
<target name="build" depends="clean">
<!-- SYSTEM -->
<copy todir="${sys.dir}">
<fileset dir="debian/sys" />
</copy>
<!-- DEBIAN -->
<copy todir="${debian.dir}">
<fileset dir="debian/DEBIAN" />
</copy>
<!-- Application -->
<mkdir dir="${app.dir}" />
<gunzip src="${nginx.dist}/nginx-1.11.9-bin.tar.gz" dest="${nginx.dist}"/>
<untar src="${nginx.dist}/nginx-1.11.9-bin.tar" dest="${app.dir}"/>
<!-- Permission -->
<chmod file="${debian.dir}/postinst" perm="775"/>
<chmod file="${debian.dir}/preinst" perm="775"/>
<chmod file="${app.dir}/nginx-1.11.9/sbin/nginx" perm="777"/>
<chmod file="${sys.dir}/nginx" perm="777"/>
</target>
<target name="package" description="Package .deb file" depends="build">
<mkdir dir="${build.deb}" />
<exec executable="fakeroot">
<arg value="dpkg" />
<arg value="-b" />
<arg value="${debian.src}" />
<arg value="${build.deb}/${package.name}" />
</exec>
</target>
<target name="release" description="Copy to dist" depends="package">
<delete dir="${build.output.dir}" />
<mkdir dir="${build.output.dir}" />
<echo message="Moving ${package.name} to ${build.output.dir}" />
<move file="${build.deb}/${package.name}" todir="${build.output.dir}" failonerror="true" />
</target>
<target name="help">
<echo message=" =============================" />
<echo message=" Usage: " />
<echo message=" ant clean removes all the generated resources and classes" />
<echo message=" ant dist creates a ready-to-be-packaged build folder" />
<echo message=" ant package creates a DIP installer package" />
<echo message="=============================" />
</target>
</project>
Here is the steps to run the commands
# ant-debian-deploy
first find nginx-1.11.9-bin.tar.gz in the install directory
ant release to build the deb package
sudo dpkg -i dist/nginx-1.11.9.deb
In the debian/sys/nginx, that is the script to put into /etc/init.d/
#!/bin/bash
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO
# An init.d script that works under Ubuntu 12.04 FFS
# load with sudo /usr/sbin/update-rc.d -f nginx defaults
# CHANGE ME.
PATH=/usr/local/nginx-1.11.9/sbin:$PATH
DAEMON=/usr/local/nginx-1.11.9/sbin/nginx
NAME=nginx
DESC=nginx-1.11.9
test -x $DAEMON || exit 0
set -e
function start {
echo -n "Starting $DESC: "
start-stop-daemon --make --start --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
}
function stop {
echo -n "Stopping $DESC: "
$DAEMON -s stop
echo "$NAME."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
In the debian/DEBIAN/control
Package: nginx
Version: 1.11.9
Section: web
Priority: optional
Architecture: all
Essential: no
Depends:
Pre-Depends:
Recommends: mozilla | netscape
Maintainer: Sillycat
Description: Sillycat Pure Nginx
In the debian/DEBIAN/postinst
#!/bin/sh
if [ -x "/etc/init.d/nginx" ]; then
update-rc.d nginx defaults >/dev/null
if [ -e /var/run/nginx.pid ]; then
echo "nginx is running, restarting...";
/etc/init.d/nginx restart
else
/etc/init.d/nginx start
fi
fi
In the debian/DEBIAN/preinst, it is empty right now.
References:
https://stackoverflow.com/questions/6583115/create-debian-package-using-apache-ant
https://blog.kghost.info/2011/02/11/%E4%BD%BF%E7%94%A8fakeroot%E6%A8%A1%E6%8B%9Froot%E6%9D%83%E9%99%90%E6%89%A7%E8%A1%8C%E7%A8%8B%E5%BA%8F/
https://gist.github.com/squarism/3400259
https://github.com/JasonGiedymin/nginx-init-ubuntu
Debian
https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.zh-cn.html
https://blog.csdn.net/sjin_1314/article/details/17394327
http://rocksaying.tw/archives/11239791.html
https://09jianfeng.github.io/2016/01/11/dpkg-deb%E6%89%93%E5%8C%85%E4%B8%80%E4%B8%AA%E5%85%B7%E6%9C%89root%E6%9D%83%E9%99%90%E7%9A%84App/
Create a Repo https://github.com/luohuazju/ant-debian-deploy
On my Virtual Machine
> ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
Host Machine
> ant -version
Apache Ant(TM) version 1.10.3 compiled on March 24 2018
Current nginx is installed on /usr/local/nginx-1.11.9
I add this nginx file to /etc/init.d to enable the nginx service
#!/bin/bash
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO
# An init.d script that works under Ubuntu 12.04 FFS
# load with sudo /usr/sbin/update-rc.d -f nginx defaults
# CHANGE ME.
PATH=/usr/local/nginx-1.11.9/sbin:$PATH
DAEMON=/usr/local/nginx-1.11.9/sbin/nginx
NAME=nginx
DESC=nginx-1.11.9
test -x $DAEMON || exit 0
set -e
function start {
echo -n "Starting $DESC: "
start-stop-daemon --make --start --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
}
function stop {
echo -n "Stopping $DESC: "
$DAEMON -s stop
echo "$NAME."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
Enable the permission
> sudo chmod a+x /etc/init.d/nginx
Then we can stop and start the nginx with our service command
> sudo service nginx stop
And then run this to enable the service command, it will add the service to the startup script
> sudo /usr/sbin/update-rc.d -f nginx defaults
Remove from the service
> sudo /usr/sbin/update-rc.d -f nginx remove
Debian Information
DEBIAN/control - basic information about the Service
DEBIAN/preinst - operations before installation, for example, stop the service first
DEBIAN/postinst - operations after installation, for example, start the service
Sample project is named as ant-debian-deploy.
The ANT task configuration build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="help" name="Sillycat Debian">
<property name="build.dir" value="build" />
<property name="sys.dir" value="${build.dir}/nginx/etc/init.d" />
<property name="debian.dir" value="${build.dir}/nginx/DEBIAN" />
<property name="app.dir" value="${build.dir}/nginx/usr/local" />
<property name="build.deb" value="${build.dir}/build-deb" />
<property name="package.name" value="nginx-1.11.9.deb" />
<property name="debian.src" value="${build.dir}/nginx" />
<property name="build.output.dir" value="dist" />
<property name="nginx.dist" value="install" />
<target name="clean">
<echo message="Cleaning dist, package and modules folders" />
<delete dir="${build.dir}" quiet="true" />
</target>
<target name="build" depends="clean">
<!-- SYSTEM -->
<copy todir="${sys.dir}">
<fileset dir="debian/sys" />
</copy>
<!-- DEBIAN -->
<copy todir="${debian.dir}">
<fileset dir="debian/DEBIAN" />
</copy>
<!-- Application -->
<mkdir dir="${app.dir}" />
<gunzip src="${nginx.dist}/nginx-1.11.9-bin.tar.gz" dest="${nginx.dist}"/>
<untar src="${nginx.dist}/nginx-1.11.9-bin.tar" dest="${app.dir}"/>
<!-- Permission -->
<chmod file="${debian.dir}/postinst" perm="775"/>
<chmod file="${debian.dir}/preinst" perm="775"/>
<chmod file="${app.dir}/nginx-1.11.9/sbin/nginx" perm="777"/>
<chmod file="${sys.dir}/nginx" perm="777"/>
</target>
<target name="package" description="Package .deb file" depends="build">
<mkdir dir="${build.deb}" />
<exec executable="fakeroot">
<arg value="dpkg" />
<arg value="-b" />
<arg value="${debian.src}" />
<arg value="${build.deb}/${package.name}" />
</exec>
</target>
<target name="release" description="Copy to dist" depends="package">
<delete dir="${build.output.dir}" />
<mkdir dir="${build.output.dir}" />
<echo message="Moving ${package.name} to ${build.output.dir}" />
<move file="${build.deb}/${package.name}" todir="${build.output.dir}" failonerror="true" />
</target>
<target name="help">
<echo message=" =============================" />
<echo message=" Usage: " />
<echo message=" ant clean removes all the generated resources and classes" />
<echo message=" ant dist creates a ready-to-be-packaged build folder" />
<echo message=" ant package creates a DIP installer package" />
<echo message="=============================" />
</target>
</project>
Here is the steps to run the commands
# ant-debian-deploy
first find nginx-1.11.9-bin.tar.gz in the install directory
ant release to build the deb package
sudo dpkg -i dist/nginx-1.11.9.deb
In the debian/sys/nginx, that is the script to put into /etc/init.d/
#!/bin/bash
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO
# An init.d script that works under Ubuntu 12.04 FFS
# load with sudo /usr/sbin/update-rc.d -f nginx defaults
# CHANGE ME.
PATH=/usr/local/nginx-1.11.9/sbin:$PATH
DAEMON=/usr/local/nginx-1.11.9/sbin/nginx
NAME=nginx
DESC=nginx-1.11.9
test -x $DAEMON || exit 0
set -e
function start {
echo -n "Starting $DESC: "
start-stop-daemon --make --start --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
}
function stop {
echo -n "Stopping $DESC: "
$DAEMON -s stop
echo "$NAME."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac
exit 0
In the debian/DEBIAN/control
Package: nginx
Version: 1.11.9
Section: web
Priority: optional
Architecture: all
Essential: no
Depends:
Pre-Depends:
Recommends: mozilla | netscape
Maintainer: Sillycat
Description: Sillycat Pure Nginx
In the debian/DEBIAN/postinst
#!/bin/sh
if [ -x "/etc/init.d/nginx" ]; then
update-rc.d nginx defaults >/dev/null
if [ -e /var/run/nginx.pid ]; then
echo "nginx is running, restarting...";
/etc/init.d/nginx restart
else
/etc/init.d/nginx start
fi
fi
In the debian/DEBIAN/preinst, it is empty right now.
References:
https://stackoverflow.com/questions/6583115/create-debian-package-using-apache-ant
https://blog.kghost.info/2011/02/11/%E4%BD%BF%E7%94%A8fakeroot%E6%A8%A1%E6%8B%9Froot%E6%9D%83%E9%99%90%E6%89%A7%E8%A1%8C%E7%A8%8B%E5%BA%8F/
https://gist.github.com/squarism/3400259
https://github.com/JasonGiedymin/nginx-init-ubuntu
Debian
https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.zh-cn.html
https://blog.csdn.net/sjin_1314/article/details/17394327
http://rocksaying.tw/archives/11239791.html
https://09jianfeng.github.io/2016/01/11/dpkg-deb%E6%89%93%E5%8C%85%E4%B8%80%E4%B8%AA%E5%85%B7%E6%9C%89root%E6%9D%83%E9%99%90%E7%9A%84App/
发表评论
-
Update Site will come soon
2021-06-02 04:10 1672I am still keep notes my tech n ... -
Stop Update Here
2020-04-28 09:00 310I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 465NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 361Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 363Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 328Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 419Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 428Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 364Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 444VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 376Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 464NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 413Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 330Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 242GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 443GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 320GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 306Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 310Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 284Serverless with NodeJS and Tenc ...
相关推荐
- 使用dpkg-buildpackage等工具进行打包。 5. **Debian包的安装与管理**:通过`dpkg`或`apt`等工具,Debian用户可以轻松安装、更新或删除软件包。 6. **Debian兼容的其他发行版**:许多基于Debian的Linux发行版如...
4. **构建包**:运行`debuild`或`dpkg-buildpackage`来构建软件包。 5. **签名包**:使用`debsign`对生成的包进行签名。 6. **上传**:将签名后的包上传到Debian的APT仓库或个人仓库。 理解并熟练使用Debian ...
JDK Development Kit 20.0.1 - Linux x64 Debian Package - jdk-20_linux-x64_bin
Debian Package Builder for Miniflux,正如标题所示,是一个专门用于构建Debian软件包的工具,使得Miniflux能方便地在Debian及其衍生系统(如Ubuntu)上安装和管理。这个工具通常由开发者或高级用户使用,它简化了...
**JDK 17.0.7 下载 - Linux - x64 Debian 包** Java Development Kit(JDK)是开发和运行Java应用程序所必需的软件包。JDK 17.0.7 是Java的一个重要版本,它包含了Java编译器、JVM(Java虚拟机)、Java库以及用于...
用法- name : Build Debian package uses : dawidd6/action-debian-package@v1 with : # Optional, relative to workspace directory source_directory : lolcat # Optional, relative to workspace directory ...
Debreate是一个实用工具,可帮助创建可安装的Debian软件包(.deb)。 该项目的目标是使基于DebianLinux发行版的开发更具吸引力,并具有易于打包应用程序,美术作品,媒体,主题等的界面。当前,它仅支持“二进制”...
使用dpkg-buildpackage时,开发者需要提供一个名为DEBIAN的控制文件夹,其中包含控制文件,用于定义包的名称、版本、依赖关系等信息。 Debian打包教程详细介绍了如何准备源码、配置Makefile、编写规则文件(rules)...
这个压缩包文件包含了三个不同版本的Debian操作系统镜像:debian.11.3、debian_bullseye和debian_buster。每个版本都有其独特的特性和改进,下面将详细讨论这些版本。 首先,我们来看`debian.11.3`,也被称为Debian...
标题中的"Debian Package Search-开源"指的是一个用于在Debian操作系统中搜索和查询软件包的工具,且它是开源的。这意味着源代码对公众开放,允许用户自由地使用、修改和分发。这个工具可能是一个桌面应用程序,采用...
- **APT**:Advanced Package Tool (APT) 是Debian及其衍生版本中最常用的软件包管理工具之一,提供了更为丰富的功能。 - **dselect**:这是一种更传统的软件包管理工具,仍然被一些用户所喜爱。 - **不停机系统升级...
这个系统主要由dpkg(Debian Package)和APT(Advanced Package Tool)组成。dpkg是基础层,负责处理单个软件包的安装、删除和查询,而APT则提供了图形化和命令行接口,用于从远程仓库自动下载和安装软件包。 **...
build GTK3.16 ,tested in debian 8 (64bit) os.
xfireworks:Debian软件包的xfireworks源码。使用gbp clone。 然后使用gbp buildpackage
- **1.4.2 包管理系统 APT**: Advanced Package Tool (APT) 是 Debian 及其衍生发行版中最常用的包管理工具,提供了高效便捷的软件包安装、升级和管理方式。 - **1.4.3 安全性**: Debian 对安全非常重视,有专门的...
4. Debian Policy Manual:指导开发者遵循Debian软件包规范的文档。 对于Linux开发者来说,安装build-essential是必备的步骤,因为大多数开源软件都需要通过源代码编译来安装,这就需要这些基本的构建工具。通过这...
《Debian系统管理员参考手册》是由Raphaël Hertzog和Roland Mas撰写的一本详细的手册,主要面向希望深入了解Debian系统的管理员和用户。Debian是一个基于Linux内核的操作系统,以其强大的社区支持、多平台兼容性和...
- **pbuilder和git-buildpackage**:使用这些高级工具可以更方便地构建软件包。 **7. 检查软件包中的错误:** 打包完成后,需要进行错误检查。 - **使用lintian**:这是一个检查软件包是否符合Debian政策的工具。 -...
风暴Debian包装 用于分布式实时计算系统的Debian打包。 这个项目的目标是提供一个灵活的工具来构建一个debian软件包,该软件包遵循debian标准并使用风暴发行版提供的默认配置。 打包的storm可以像在其他地方解压缩的...
GNOME Debian Package Manager(简称GDPM)是一款专为GNOME桌面环境设计的开源软件包管理器,它旨在简化Debian用户对系统软件包的操作。GDPM的出现是为了提供一种更加直观、用户友好的方式来替代传统的命令行工具,...