diff --git a/content/post/openssh-upgrade.md b/content/post/openssh-upgrade.md index 290698d..4843497 100644 --- a/content/post/openssh-upgrade.md +++ b/content/post/openssh-upgrade.md @@ -11,7 +11,7 @@ categories: ["os"] - [openssh 源码包](https://www.openssh.com/portable.html) - [openssl 源码包](https://www.openssl.org/source/) -## 不带 openssl +## 不带 openssl(不推荐) ### 编译 openssh - 下载 openssh 源码包,解压 ```bash @@ -21,7 +21,7 @@ categories: ["os"] # 版本信息在 version.h ``` -- 编译安装 openssl +- 编译安装 openssh ```bash mkdir /opt/openssh ./configure --prefix=/opt/openssh --without-openssl @@ -55,8 +55,8 @@ categories: ["os"] PidFile /var/run/openssh.pid ``` -### 启动 openssh -- 创建 /etc/systemd/system/openssh.service,内容如下 +### 创建 systemd 启动文件 +- 创建 /opt/openssh/openssh.service,内容如下 ``` [Unit] Description=OpenSSH server daemon @@ -74,11 +74,11 @@ categories: ["os"] WantedBy=multi-user.target ``` -- 启动 openssh,并设置开机自动启动 - ```bash - systemctl daemon-reload - systemctl start openssh - systemctl enable openssh +### 打包 +- 进入 /opt 目录下,打包 openssh 目录 + ``` + cd /opt + tar zcf /tmp/openssh-9.8p1-without-openssl.tgz openssh/ ``` ## 带 openssl @@ -136,8 +136,8 @@ categories: ["os"] PidFile /var/run/openssh.pid ``` -### 启动 openssh -- 创建 /etc/systemd/system/openssh.service,内容如下 +### 创建 systemd 启动文件 +- 创建 /opt/openssh/openssh.service,内容如下 ``` [Unit] Description=OpenSSH server daemon @@ -156,6 +156,24 @@ categories: ["os"] WantedBy=multi-user.target ``` +### 打包 +- 进入 /opt 目录下,打包 openssl 和 openssh 目录 + ```bash + cd /opt + tar zcf /tmp/openssh-9.8p1-with-openssl.tgz openssl/ openssh/ + ``` + +## 部署 +- 上传部署包到目标服务器中,解压 + ```bash + tar zxf openssh-9.8p1-with-openssl.tgz -C /opt/ + ``` + +- 复制 systemd 启动文件 + ```bash + cp /opt/openssh/openssh.service /etc/systemd/system/ + ``` + - 启动 openssh,并设置开机自动启动 ```bash systemctl daemon-reload