freqtrade-实战 9- 置 Vultr VPS 并远程连接 VSCode SSH

一、说明

今天,将学习如何在 Vultr 上设置 VPS 并使用 Visual Studio Code 的 SSH 功能连接到它。

https://www.vultr.com/?ref=9676075-9J 开始

Here’s what we’ll cover: 以下是我们将介绍的内容:

Signing up for Vultr – including how to get free credits to try the platform.
注册 Vultr – 包括如何获得免费积分以试用该平台。

Essential account setup – we’ll go through the steps you need to take before creating your VPS.
基本帐户设置 – 我们将介绍您在创建 VPS 之前需要采取的步骤。

Deploying your VPS – how to set it up to host your freqtrade trading bot.
部署您的 VPS – 如何设置它以托管您的 freqtrade 交易机器人。

Connecting to your VPS – using Visual Studio Code's SSH plugin to access your server easily.
连接到您的 VPS – 使用 Visual Studio Code 的 SSH 插件轻松访问您的服务器。

二、Vultr服务器配置

开始注册 [vultr](从 https://www.vultr.com) 云服务:
file

添加服务器:
file

配置要求:
2C 2G RAM 20G Storage;

虚拟机配置:

  • CPU 选择 Shared CPU,性价比高;
  • 服务器地区选择日本 Tokyo,离Binance 近,访问速度更快;
  • 操作系统 Ubuntu 24.04 LTS
  • 配置选择,2C 4G 80G

file

部署的服务:
file

三、VSCODE 远程连接

在 VScode 软件添加 remote - SSH 插件:
file

然后在搜索栏输入 > remote-shh 命令,选择添加 连接到 HOST

ssh root@ 202.182.102.74 -A

file

四、SSH KEY 登录

Today, I’m going to show you how to secure your VPS in just a few minutes using SSH key login. Forget the hassle of password logins – let’s make your server safer and easier with SSH keys!
今天,我将向您展示如何使用 SSH 密钥登录在短短几分钟内保护您的 VPS。忘记密码登录的麻烦 - 让我们使用 SSH 密钥让您的服务器更安全、更轻松!We’re going to follow six easy steps: creating an SSH key, adding it to your VPS, setting up login options, and making some final security changes. Let’s get started!
我们将遵循六个简单的步骤:创建 SSH 密钥,将其添加到您的 VPS,设置登录选项,并进行一些最终的安全更改。让我们开始吧!

在本地电脑生成 ssh-key ,然后上传 id_rsa.pub 到 /home/ubuntu/.ssh/authorized_keys 下:

(base) ➜  .ssh pwd
/Users/kaiyi/.ssh
(base) ➜  .ssh ls -l
total 64
-rw-r--r--  1 kaiyi  staff    58 Jun  9 00:13 config
-rw-------  1 kaiyi  staff   411 Jul 24  2022 id_ed25519
-rw-r--r--  1 kaiyi  staff    98 Jul 24  2022 id_ed25519.pub
-rw-------  1 kaiyi  staff  2602 Oct 16  2022 id_rsa
-rw-r--r--  1 kaiyi  staff   569 Oct 16  2022 id_rsa.pub
-rw-------  1 kaiyi  staff  4780 Jun  9 00:13 known_hosts
-rw-------  1 kaiyi  staff  4036 Jun  9 00:13 known_hosts.old
(base) ➜  .ssh 

file

然后设置 ubuntu 用户密码:

root@AwesomeStrategy-Freqtrade:/# passwd ubuntu
New password: Gao****@********
Retype new password: 
passwd: password updated successfully
root@AwesomeStrategy-Freqtrade:/# 

然后再修改本地 的config文件:

Host 202.182.102.74
  HostName 202.182.102.74
  User root

Host 202.182.102.74-ubuntu
  HostName 202.182.102.74
  User ubuntu
  Identityfile "/Users/kaiyi/.ssh/id_rsa"

然后再 vscode 配置 ubuntu 连接,这次选择 .ssh/config 文件后,不需要输入密码就可登录了。

file


相关文章:
07 Setup Your Vultr VPS in Minutes and Connect with VSCode SSH Remotely!

为者常成,行者常至