openssh-9.8p1 交叉编译

源码下载: OpenSSH: for OpenBSD

http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz

tar xpf openssh-9.8p1.tar.gz

cd openssh-9.8p1

一、交叉编译器

export PATH=$PATH:/opt/toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin

export ARCH=arm

export CROSS_COMPILE=/opt/toolchain/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-

二、配置

依赖  openssl  和  zlib 

这两个需要先交叉编译通过 openssl  和 zlib 编译

下载 zlib   http://www.zlib.net/zlib-1.3.1.tar.gz

zlib 编译方法: 

export CROSS_PREFIX=arm-linux-gnueabihf-

./configure  --prefix=/workstation/zlib-1.3.1/build  --shared 
make
make install

./configure --host=arm --exec-prefix=/workstation/openssh-build --sysconfdir=/workstation/openssh-build/etc/ssh --disable-etc-default-login CC=arm-linux-gnueabihf-gcc --with-zlib=/workstation/openssh/zlib-1.3.1/build --with-ssl-dir=/workstation/openssl-build/  --disable-strip

三、编译

make 

make install

四、遇到的报错

1、make: *** [host-key] Error 127

把Makefile 里面的 ./ssh-keygen 改为 ssh-keygen

2、make: [check-config] Error 127 (ignored)

Makefile 里面的 install: $(CONFIGFILES) $(MANPAGES) $(TARGETS) install-files install-sysconf host-key check-config 去掉 check-config

五、拷贝到目标机

把文件 /workstation/openssh-build 里分别拷贝到 /etc/ssh   /usr/  目录

还需要创建一个 /var/empty 的 root 用户文件。

拷贝完后运行 sshd -V 查看版本

# sshd -V

OpenSSH_9.8p1, OpenSSL 3.2.1 30 Jan 2024

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值