簡體   English   中英

如何在 Linux 中運行 Visual Studio 代碼

[英]How to run visual studio code in linux

我是Linux操作系統的新手,我從微軟官網的visual studio code下載了rpm包。這是機器

CentOS Linux release 7.6.1810 (Core)

我運行了命令

rpm -qpi code-1.40.2-1574694258.el7.x86_64.rpm

Output of the command

Name        : code
Version     : 1.40.2
Release     : 1574694258.el7
Architecture: x86_64
Install Date: (not installed)
Group       : Development/Tools
Size        : 235084185
License     : Multiple, see https://code.visualstudio.com/license
Signature   : (none)
Source RPM  : code-1.40.2-1574694258.el7.src.rpm
Build Date  : Mon 25 Nov 2019 10:04:31 AM EST
Build Host  : 2114565cfb42
Relocations : (not relocatable)
Packager    : Visual Studio Code Team <vscode-linux@microsoft.com>
Vendor      : Microsoft Corporation
URL         : https://code.visualstudio.com/
Summary     : Code editing. Redefined.
Description :
Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.

現在我想在 Windows 機器上運行 Visual Studio 代碼。 我如何實現這一目標?

注意我只有到 linux 機器的 ssh 連接。

您應該從安裝軟件包開始。 您只是查詢了包,要安裝它,您必須(作為超級用戶)運行:

rpm --install code-1.40.2-1574694258.el7.x86_64.rpm

安裝完成后,您將能夠通過啟動以下命令來啟動該程序:

code

正如@Leon.fon 所指出的,如果您只有一個ssh連接,您將無法啟動 GUI,但導出您的顯示可能會起作用:

ssh -X ...

你不能通過 ssh 運行它,你需要在 Linux shell 之上有一些 GUI。 您只能使用命令行編輯器,例如; “納米”,“vim”等。

編輯:

替代方案您可以在本地機器上運行 VScode,並通過 ssh 將其連接到遠程機器。 https://code.visualstudio.com/docs/remote/ssh

VSCode 是一個基於 gui 的工具。 如果您只有 ssh 訪問權限,您可以嘗試通過x11 forwarding運行它,或設置VNC 連接以遠程控制另一台機器。 但是正如 Leon.fon 提到的 ssh 通常是基於命令行的。

如果您想通過 ssh 運行基於 gui 的工具,則需要傳遞-X (大寫)參數以啟用 X11 轉發,
ssh -X remoteHostIP
請參閱以下http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/ssh.1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM