update
This commit is contained in:
parent
91e9d0bb7d
commit
63ff416daf
@ -11,7 +11,7 @@ categories: ["os"]
|
|||||||
- [openssh 源码包](https://www.openssh.com/portable.html)
|
- [openssh 源码包](https://www.openssh.com/portable.html)
|
||||||
- [openssl 源码包](https://www.openssl.org/source/)
|
- [openssl 源码包](https://www.openssl.org/source/)
|
||||||
|
|
||||||
## 不带 openssl
|
## 不带 openssl(不推荐)
|
||||||
### 编译 openssh
|
### 编译 openssh
|
||||||
- 下载 openssh 源码包,解压
|
- 下载 openssh 源码包,解压
|
||||||
```bash
|
```bash
|
||||||
@ -21,7 +21,7 @@ categories: ["os"]
|
|||||||
# 版本信息在 version.h
|
# 版本信息在 version.h
|
||||||
```
|
```
|
||||||
|
|
||||||
- 编译安装 openssl
|
- 编译安装 openssh
|
||||||
```bash
|
```bash
|
||||||
mkdir /opt/openssh
|
mkdir /opt/openssh
|
||||||
./configure --prefix=/opt/openssh --without-openssl
|
./configure --prefix=/opt/openssh --without-openssl
|
||||||
@ -55,8 +55,8 @@ categories: ["os"]
|
|||||||
PidFile /var/run/openssh.pid
|
PidFile /var/run/openssh.pid
|
||||||
```
|
```
|
||||||
|
|
||||||
### 启动 openssh
|
### 创建 systemd 启动文件
|
||||||
- 创建 /etc/systemd/system/openssh.service,内容如下
|
- 创建 /opt/openssh/openssh.service,内容如下
|
||||||
```
|
```
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=OpenSSH server daemon
|
Description=OpenSSH server daemon
|
||||||
@ -74,11 +74,11 @@ categories: ["os"]
|
|||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
```
|
```
|
||||||
|
|
||||||
- 启动 openssh,并设置开机自动启动
|
### 打包
|
||||||
```bash
|
- 进入 /opt 目录下,打包 openssh 目录
|
||||||
systemctl daemon-reload
|
```
|
||||||
systemctl start openssh
|
cd /opt
|
||||||
systemctl enable openssh
|
tar zcf /tmp/openssh-9.8p1-without-openssl.tgz openssh/
|
||||||
```
|
```
|
||||||
|
|
||||||
## 带 openssl
|
## 带 openssl
|
||||||
@ -136,8 +136,8 @@ categories: ["os"]
|
|||||||
PidFile /var/run/openssh.pid
|
PidFile /var/run/openssh.pid
|
||||||
```
|
```
|
||||||
|
|
||||||
### 启动 openssh
|
### 创建 systemd 启动文件
|
||||||
- 创建 /etc/systemd/system/openssh.service,内容如下
|
- 创建 /opt/openssh/openssh.service,内容如下
|
||||||
```
|
```
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=OpenSSH server daemon
|
Description=OpenSSH server daemon
|
||||||
@ -156,6 +156,24 @@ categories: ["os"]
|
|||||||
WantedBy=multi-user.target
|
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,并设置开机自动启动
|
- 启动 openssh,并设置开机自动启动
|
||||||
```bash
|
```bash
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
Loading…
x
Reference in New Issue
Block a user