nginx和dpkg实现带依赖的deb包源发布和安装

本文介绍了在Ubuntu系统中通过编译安装Nginx服务器的步骤,包括安装依赖、配置、生成Debian安装包以及发布软件源。还涉及了如何创建和验证服务器配置,以及客户端下载和安装Debian包的过程。
摘要由CSDN通过智能技术生成

精简安装方式。

a. 安装配置nginx服务器,/usr/local/nginx -t/-s stop

按照该发布地址和文章Ubantu安装Nginx详细教程_sudo: nginx:找不到命令-CSDN博客

在命令行执行命令安装nginx

sudo useradd -s /sbin/nologin www -M
sudo apt update
# 通过以下命令安装编译器和调试器
sudo apt install build-essential
sudo apt-get install manpages-dev
gcc --version
# 安装依赖
sudo apt install openssl libssl-dev -y
sudo apt install libpcre3 libpcre3-dev -y
sudo apt install zlib1g-dev -y
sudo apt -y install make

cd /usr/local/src
sudo wget https://nginx.org/download/nginx-1.22.1.tar.gz
sudo tar -zxf nginx-1.22.1.tar.gz
cd /usr/local/src/nginx-1.22.1
sudo ./configure --prefix=/usr/local/nginx/ --user=www --group=www --with-http_stub_status_module --with-http_ssl_module

sudo make
sudo make install

sudo vim /etc/profile
export PATH=$PATH:/usr/local/nginx/sbin/

# 刷新
sudo source /etc/profile

 配置nginx提供包发布地址 /usr/local/nginx/conf/nginx.conf

$ whereis nginx

 

$ cd  /usr/local/nginx /usr/local/nginx/sbin/nginx

$ sudo ./nginx -t

$ sudo vi  /usr/local/nginx//conf/nginx.conf

# 新建软件存放的目录
# mkdir /mirrors/{windows,ubuntu,centos}
# mkdir /mirrors/ubuntu/22.04

# 修改nginx配置文件
# 把该目录暴露出去,以列表的形式显示
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       9009;
        server_name  172.19.21.49;
        root /mirrors/;    # 此处直接指定到simple的父级目录,这样我们可以使用http://example.com/simple来作为源的链接
        location / {
            # root   /mirrors/;
            autoindex on;
            autoindex_exact_size off;    #显示文件的大小
            autoindex_localtime on;    #显示文件时间
            # limit_rate_after 5m; #5分钟后下载速度限制为200k
            # limit_rate 200k;
            #index  index.html index.htm;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

# 重启nginx
#nginx -s stop
#nginx

# 登录前台查看

b. 生成和安装Debian安装包,dpkg-deb --build ../XXX ./  / dpkg -i XXX.deb

按照以下目录结构和文章ubuntun制作deb安装包_ubuntu 22.04 制作 deb 包-CSDN博客

./myapp-1.0/DEBIAN/postinsst file

#!/bin/sh
set -e
echo "Installing My Krusader Application..."
cp ./krusader /usr/bin/
echo "Done."
exit 0

 ./myapp-1.0/DEBIAN/control file

Package: myapp-1.0
Version: 1.0
Section: misc
Priority: optional
Standards-Version: 3.9.2
Architecture: amd64
Depends: extra-cmake-modules, qtcreator, qtbase5-dev, qt5-qmake, libkf5archive-dev, libkf5bookmarks-dev, libkf5codecs-dev, libkf5completion-dev, libkf5coreaddons-dev, libkf5config-dev, libkf5doctools-dev, libkf5i18n-dev, libkf5iconthemes-dev, libkf5itemviews-dev, libkf5kio-dev, libkf5notifications-dev, libkf5parts-dev, libkf5solid-dev, libkf5textwidgets-dev, libkf5wallet-dev, libkf5widgetsaddons-dev, libkf5windowsystem-dev, libkf5xmlgui-dev, libkf5guiaddons-dev, libkf5crash-dev, libqt5x11extras5-dev, libmount-dev, libxslt1-dev, qttools5-dev, libqt5svg5-dev, libkf5syntaxhighlighting-dev, libkf5dnssd-dev, cmake, g++, liburing-dev, zlib1g-dev, zlib1g, bzip2, openssl, libmbedtls-dev, libgcrypt20-dev, libssl-dev
Maintainer: EJ <emilin.hao@email.com>
Description: Krusader File Management GUI
 long description and info
 .
 second paragraph

注意其中的Depends域的添加。 

生成目录结构途中我已经做出来的myapp-1.0_1.0_1.0_amd64.deb

c. 发布镜像软件源安装, sudo apt-get update / sudp apt-get install XXX

$ cp ./myapp-1.0_1.0_1.0_amd64.deb /mirrors/ubuntu/22.04/

d. ​确认服务器配置 sudo curl http://172.19.21.49, sudo vi /usr/local/nginx/conf/nginx.conf

e.客户端下载deb文件并安装

$ sudo dpkg -i myapp1.0_1.0_amd64.deb # Install with dependencies set up in control file

$ sudo apt-get install -f # install dependencies in need as listed

$ krusader # 执行安装的软件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Emilin Amy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值