#!/bin/bash
# 安装依赖项
echo "Installing dependencies..."
apt-get update
apt-get install -y git build-essential libssl-dev zlib1g-dev libpam0g-dev autoconf
# 定义仓库的克隆 URL 和本地目录名
REPO_URL="https://github.com/openssh/openssh-portable.git"
REPO_DIR="openssh-portable"
# 检查目录是否存在,如果存在则删除
if [ -d "$REPO_DIR" ]; then
echo "Removing existing repository directory..."
rm -rf "$REPO_DIR"
fi
# 克隆 OpenSSH 仓库
echo "Cloning OpenSSH repository..."
git clone "$REPO_URL"
# 进入仓库目录
cd "$REPO_DIR"
# 检查是否需要从 git 克隆的,需要生成 configure 脚本
if [ ! -f "configure" ]; then
echo "Generating configure script..."
autoreconf
fi
# 配置 OpenSSH
echo "Configuring OpenSSH build..."
./configure
# 编译并安装OpenSSH
echo "Building and Installing OpenSSH..."
make && make install
# 验证安装
echo "Verifying installation..."
ssh -V
本站文章除注明转载/出处外,均为博主 spooking 原创或翻译,转载前请务必署名。