当前位置: 首页 > wzjs >正文

网站建设的学习嘉兴做网络推广的公司

网站建设的学习,嘉兴做网络推广的公司,网站费用多少钱一年,东莞运营推广网站建设费用构建RPM包主要需要 打包工具 (rpmbuild)源代码压缩包 (xxx.tar.gz)编译所需的依赖包spec脚本 文章目录 打包工具源代码包spec文件rsync.specopenssh.spec修改specopenssh-9.9p2 额外的源码包openssh.spec 依赖包rsyncopensshOpen…

构建RPM包主要需要

  1. 打包工具 (rpmbuild)
  2. 源代码压缩包 (xxx.tar.gz)
  3. 编译所需的依赖包
  4. spec脚本

文章目录

    • 打包工具
    • 源代码包
    • spec文件
      • rsync.spec
      • openssh.spec
      • 修改spec
        • openssh-9.9p2
    • 额外的源码包
      • openssh.spec
    • 依赖包
      • rsync
      • openssh
      • OpenSSL
    • 打包
      • openssh
      • rsync
    • 测试
      • openssh
      • rsync

打包工具

rpm-build 构建RPM包;
rpmdevtools 在 /root/ 目录下创建 RPM 构建的标准目录结构

yum -y install rpm-build rpmdevtools
rpmdev-setuptree 

源代码包

通常是一个压缩包,可以去软件官网、Github或开源站点下载,例如:
rsync (https://rsync.samba.org/)
在这里插入图片描述
OpenSSH (https://www.openssh.com/)
在这里插入图片描述

spec文件

这个文件用于指定源代码、依赖项、构建步骤、安装路径等,指导 rpmbuild 工具生成最终的 RPM 包。
一般可以在源代码压缩包中找到这个文件,例如:

rsync.spec

tar tf rsync-3.4.1.tar.gz *.spec
rsync-3.4.1/packaging/lsb/rsync.spec

如果没有也可以到Github仓库里搜索spec,例如:
在这里插入图片描述

openssh.spec

还可以在旧版本的.src.rpm安装包中找到,例如:

rpm -Uvh openssh-8.0p1-10.el8.src.rpm 2> /dev/null && ls -hl /root/rpmbuild/SPECS/
Updating / installing...1:openssh-8.0p1-10.el8             ################################# [100%]
total 112K
-rw-r--r-- 1 root root 111K Jul 13  2021 openssh.spec

修改spec

官方提供的打包配置,可能不符合实际环境,需要修改配置增加功能,例如:

openssh-9.9p2

高版本的openssh默认取消了对部分密钥算法的支持,如ssh-rsa;
同时在最新的spec文件中,对centos7及以下版本默认配置–without-openssl,导致没有openssl支持;
缺少ssh-copy-id命令等。可能会产生各种问题,例如:
缺少id_rsa认证

debug1: Skipping ssh-rsa key /root/.ssh/id_rsa - corresponding algorithm not supported by server

缺少其他认证方式

# ssh -Q key
ssh-ed25519
ssh-ed25519-cert-v01@openssh.com
sk-ssh-ed25519@openssh.com
sk-ssh-ed25519-cert-v01@openssh.com# ssh -Q kex
curve25519-sha256
curve25519-sha256@libssh.org
sntrup761x25519-sha512
sntrup761x25519-sha512@openssh.com
mlkem768x25519-sha256

在 CentOS 7 上打包使openssh支持ssl,分为以下两步:

  • 修改openssh.spec文件,添加openssl以启用其他加密算法(需要了解spec文件语法)
  • 编译openssl前,需安装依赖包,参照本文中 依赖包 > OpenSSL
# 以官方openssh-9.9p2的脚本为例
# 删除这部分
# %global without_openssl 0
# build without openssl where 1.1.1 is not available
# %if %{defined fedora} && 0%{?fedora} <= 28
# %global without_openssl 1
# %endif
# %if %{defined rhel} && 0%{?rhel} <= 7
# %global without_openssl 1
# %endif# 静态库设置为1
# Do we want to link against a static libcrypto? (1=yes 0=no)
%global static_libcrypto 1# 增加Source2 openssl源码(需要将 openssl-3.1.4.tar.gz 放在 /root/rpmbuild/SOURCES/ 下)
# 也可以手动单独编译openssl
Source0: https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz
Source1: http://www.jmknoble.net/software/x11-ssh-askpass/x11-ssh-askpass-%{aversion}.tar.gz
Source2: https://www.openssl.org/source/openssl-3.1.4.tar.gz# 编译openssl shared 参数生成共享库(.so 文件) zlib 参数使用 zlib 来压缩数据
mkdir -p %{_sourcedir}/openssl
tar xfz %{SOURCE2} --strip-components=1 -C %{_sourcedir}/openssl
pushd %{_sourcedir}/openssl
./config shared zlib -fPIC
make %{?_smp_mflags}
popd# 设置openssl编译路径变量
%define openssl_dir %{_sourcedir}/openssl# Add OpenSSL library 全局库路径
export LD_LIBRARY_PATH="%{openssl_dir}"# 设置openssh编译参数 增加 --with-ssl-dir
%configure \--sysconfdir=%{_sysconfdir}/ssh \--libexecdir=%{_libexecdir}/openssh \--datadir=%{_datadir}/openssh \--with-default-path=/usr/local/bin:/bin:/usr/bin \--with-superuser-path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin \--with-privsep-path=%{_var}/empty/sshd \--mandir=%{_mandir} \--with-mantype=man \--disable-strip \--with-ssl-dir="%{openssl_dir}" \
# 必须删掉这三行 configure模块下有"\"为拼合命令,不能有意外字符,比如"#"
# %if %{without_openssl}
#     --without-openssl \
# %endif# 打包openssl静态库 需要在这一行添加 -lpthread 参数
perl -pi -e "s|-lcrypto|%{openssl_dir}/libcrypto.a -lpthread|g" Makefile

额外的源码包

项目构建过程中可能需要额外的源文件,需要将源码包放到 /root/rpmbuild/SOURCES/ 下,在spec文件中可以看到,例如:

openssh.spec

# 编译openssh需要 openssh-%{version}.tar.gz 和 x11-ssh-askpass-%{aversion}.tar.gz 两个源码包
cat rpmbuild/SPECS/openssh.spec | grep Source
Source0: https://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-%{version}.tar.gz
Source1: http://www.jmknoble.net/software/x11-ssh-askpass/x11-ssh-askpass-3.1.4.tar.gz# 源码包版本号
cat rpmbuild/SPECS/openssh.spec | grep "global ver"
%global ver 9.9p2
cat rpmbuild/SPECS/openssh.spec | grep "global aversion"
%global aversion 1.2.4.1

依赖包

打包过程一般是编译生成二进制文件,然后将文件打包为rpm格式,所以需要准备编译所需的环境。
对于C语言系列项目,除了必要的gcc、make、imake工具,还有项目所需的依赖包,通常会在INSTALL.md文件中列有清单,例如:

rsync

cat rsync-3.4.1/INSTALL.md  | grep -A 11 CentOS-  For CentOS (use EPEL for python3-pip):>     sudo yum -y install epel-release>     sudo yum -y install gcc g++ gawk autoconf automake python3-pip>     sudo yum -y install acl libacl-devel>     sudo yum -y install attr libattr-devel>     sudo yum -y install xxhash-devel>     sudo yum -y install libzstd-devel>     sudo yum -y install lz4-devel>     sudo yum -y install openssl-devel>     python3 -mpip install --user commonmark

也有例外情况,如openssh源码文件中没有INSTALL.md

openssh

可以查看openssh.spec中的构建需求(BuildRequires)

# cat rpmbuild/SPECS/openssh.spec | grep ^BuildRequires
BuildRequires: perl
BuildRequires: openssl-devel >= 1.1.1
BuildRequires: /bin/login
BuildRequires: glibc-devel, pam
BuildRequires: /usr/include/X11/Xlib.h
BuildRequires: libXt-devel
BuildRequires: imake
BuildRequires: gtk2-devel
BuildRequires: pkgconfig
BuildRequires: krb5-devel
BuildRequires: krb5-libs

也可以直接进行打包,观察依赖报错再来安装,例如:

# rpmbuild -ba rpmbuild/SPECS/openssh.spec 
error: Failed build dependencies:/usr/include/X11/Xlib.h is needed by openssh-9.9p2-1.el7.x86_64libXt-devel is needed by openssh-9.9p2-1.el7.x86_64imake is needed by openssh-9.9p2-1.el7.x86_64gtk2-devel is needed by openssh-9.9p2-1.el7.x86_64krb5-devel is needed by openssh-9.9p2-1.el7.x86_64

OpenSSL

查看源码包中的INSTALL.md文件,其中详细说明了各个系统的依赖情况
在这里插入图片描述

打包

rpmbuild命令会编译源码后生成 .src.rpm 和 .rpm 文件,常用的打包命令如下:

openssh

# 打包时设置 static_openssl 变量为1 代表打包后的 rpm 包自带openssl静态库,不依赖系统openssl版本
rpmbuild -ba rpmbuild/SPECS/openssh.spec --define "static_openssl 1"

rsync

# 默认打包命令
rpmbuild -ba rpmbuild/SPECS/rsync.spec

测试

openssh

# ssh -V
OpenSSH_9.9p2, OpenSSL 3.0.16 11 Feb 2025
# sshd -V
OpenSSH_9.9p2, OpenSSL 3.0.16 11 Feb 2025# sh -Q key
ssh-ed25519
ssh-ed25519-cert-v01@openssh.com
sk-ssh-ed25519@openssh.com
sk-ssh-ed25519-cert-v01@openssh.com
ecdsa-sha2-nistp256
ecdsa-sha2-nistp256-cert-v01@openssh.com
ecdsa-sha2-nistp384
ecdsa-sha2-nistp384-cert-v01@openssh.com
ecdsa-sha2-nistp521
ecdsa-sha2-nistp521-cert-v01@openssh.com
sk-ecdsa-sha2-nistp256@openssh.com
sk-ecdsa-sha2-nistp256-cert-v01@openssh.com
ssh-rsa
ssh-rsa-cert-v01@openssh.com# ssh -Q kex
diffie-hellman-group1-sha1
diffie-hellman-group14-sha1
diffie-hellman-group14-sha256
diffie-hellman-group16-sha512
diffie-hellman-group18-sha512
diffie-hellman-group-exchange-sha1
diffie-hellman-group-exchange-sha256
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
curve25519-sha256
curve25519-sha256@libssh.org
sntrup761x25519-sha512
sntrup761x25519-sha512@openssh.com
mlkem768x25519-sha256

rsync

[root@c839f9ec6557 ~]# rsync --version
rsync  version 3.4.1  protocol version 32
Copyright (C) 1996-2025 by Andrew Tridgell, Wayne Davison, and others.
Web site: https://rsync.samba.org/
Capabilities:64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,socketpairs, symlinks, symtimes, hardlinks, hardlink-specials,hardlink-symlinks, IPv6, atimes, batchfiles, inplace, append, ACLs,xattrs, optional secluded-args, iconv, prealloc, stop-at, no crtimes
Optimizations:no SIMD-roll, no asm-roll, openssl-crypto, no asm-MD5
Checksum list:xxh128 xxh3 xxh64 (xxhash) md5 md4 sha1 none
Compress list:zstd lz4 zlibx zlib none
Daemon auth list:sha512 sha256 sha1 md5 md4rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

文章转载自:

http://ER6bNOYJ.hxxkk.cn
http://9bkMuYHB.hxxkk.cn
http://E5dVSxV0.hxxkk.cn
http://b9lr4Pep.hxxkk.cn
http://30QDvUML.hxxkk.cn
http://t3r3ou8y.hxxkk.cn
http://tGs68J9H.hxxkk.cn
http://rxhqgW0J.hxxkk.cn
http://d8BqwRsj.hxxkk.cn
http://6epfhjdW.hxxkk.cn
http://glsTsL3Z.hxxkk.cn
http://45AqKXd3.hxxkk.cn
http://mKshEO8u.hxxkk.cn
http://iAmmBRwJ.hxxkk.cn
http://44TE2dAp.hxxkk.cn
http://itpMja0V.hxxkk.cn
http://Cio2MCwF.hxxkk.cn
http://szeCAATe.hxxkk.cn
http://RJ1YONvg.hxxkk.cn
http://WMhkb55C.hxxkk.cn
http://roeCAy8e.hxxkk.cn
http://yJ70NoiW.hxxkk.cn
http://h84GkGgh.hxxkk.cn
http://ayZNfLAC.hxxkk.cn
http://xl3zwnZs.hxxkk.cn
http://jlnkH68V.hxxkk.cn
http://69qOlaux.hxxkk.cn
http://lDmEQeZ0.hxxkk.cn
http://hTOIZRIJ.hxxkk.cn
http://790PsxCc.hxxkk.cn
http://www.dtcms.com/wzjs/638071.html

相关文章:

  • 网站上线盈利网站推广的优化
  • 网站建设服务标准化程序员做个网站要多少钱呢
  • 深圳php网站开发免费购物网站程序
  • 网站建设验收报告范本网站标签页在哪里设置
  • 做外贸要自己建网站吗网站建设要多少费用
  • 深圳市罗湖区住房和建设局网站wordpress右侧
  • 我做动作你来猜的网站安庆跨境电商建站哪家好
  • WordPress站内链接设置wordpress如何设置邮箱验证码
  • 制作网站软件wordpress高并发
  • 开发网站的基本过程襄阳seo公司
  • 相册特效手机网站文件管理
  • 网站建设和邮箱的关联做听书网站怎么做
  • 徐州网站开发要多少钱wordpress打印代码
  • 制作动画网站模板wordpress搬家 打开404
  • 网站设计的要素做医疗设备的网站
  • 国展网站建设php语言网站开发公司北京
  • 传媒公司营销网站谷歌seo推广
  • 自己做网站卖阀门网站如何免费做SEO优化
  • 在哪里有人做网站长春网站快照优化公司
  • 网站地图 htmlapp开发制作在哪儿
  • FLASK做wiki网站高密 网站建设
  • 自己做的网站如何用手机去查看海南 网站制作
  • 杭州网站推广营销怎么做电影网站app
  • 网站 例学校的网站的代码模板
  • 佛山网站建设定制wordpress图片主题中文版
  • 太原网站制作小程序天津做宠物饲料的网站
  • 国外大气网站欣赏学校网站注重服务平台建设
  • 怎么建设手机网站微商货源网站大全
  • 各种网站的区别wordpress 站外 链接
  • 中国做出口的网站平台怎样建设和维护网站