Using an IDE (Integrated Development Environment) has significant advantages when learning AI technology. IDEs provide powerful code editing features such as syntax highlighting, auto-completion, and code folding, which can greatly enhance programming efficiency. Additionally, IDEs typically integrate debuggers, making it easy to track and fix errors while developing AI models. More importantly, many IDEs support version control, which helps manage code repositories and collaborative development. At the same time, IDEs offer a rich array of plugins and extensions that can be customized and optimized for AI development needs. Therefore, using an IDE is one of the indispensable tools for learning AI technology, as it can help developers conduct AI project development and debugging more efficiently and conveniently.
Configuring an Integrated Development Environment (IDE) on a cloud server can be achieved in various ways, one popular method is to use remote development tools and server configurations to connect to the development environment on the cloud server through SSH from your local machine. Below is a detailed step-by-step guide to help you set up a remote development environment based on Visual Studio Code (VS Code).
Prerequisites
-
Cloud Server: You need a cloud server instance running Linux (e.g., AWS EC2, Google Cloud Compute Engine, Azure VM, etc.).
-
SSH Access: Ensure that you can access your cloud server via SSH.
-
VS Code: Install Visual Studio Code on your local machine.
Steps
1. Set Up the Cloud Server
-
Start the Cloud Server: Follow the documentation of your cloud service provider to start and configure your Linux instance.
-
Install Necessary Software:
Update the package list and install some basic development tools:
-
Install the Remote Development Extension:
-
Open VS Code, click the extension icon on the left (or use the shortcut
Ctrl+Shift+X
). -
Search for and install the “Remote Development” extension pack, which includes Remote – SSH, Remote – Containers, and Remote – WSL.
-
Set Up SSH Connection:
-
Press
Ctrl+Shift+P
to open the command palette, type and selectRemote-SSH: Connect to Host...
. -
If this is your first time using it, VS Code will prompt you to add a new SSH host configuration. Click
Add New SSH Host...
, then enter your cloud server’s SSH address, such asusername@your-server-ip
. -
VS Code will ask you to enter the SSH password or configure SSH keys for passwordless login (it is recommended to use SSH keys for enhanced security).
-
Connect to the Server:
-
Return to the command palette, select
Remote-SSH: Connect to Host...
again, and then choose the SSH configuration you just added. -
VS Code will open a new window prompting you to connect to the server and set up the remote environment.
-
Open a Folder on the Remote Server:
-
In the remote VS Code window, open the command palette and select
File: Open Folder...
, then choose the folder on your cloud server that you want to use as your workspace. -
Install Necessary VS Code Extensions:
-
In the remote VS Code window, you can install any VS Code extensions you need, which will run only on the remote server.
-
Edit Code: You can now edit files on the cloud server directly in VS Code.
-
Run and Debug: Configure the debugger based on the programming language you are using (e.g., Node.js debugger, Python debugger, etc.).
-
Use the Terminal: You can use VS Code’s built-in terminal to run commands and scripts, which will be executed on the remote server.
-
Create a Project Directory on the Cloud Server:
-
Open the terminal and run
node index.js
. -
Visit
http://your-server-ip:3000
in your browser, and you should see “Hello World!”.
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y build-essential git curl wget
Install the environment for Node.js, Python, or other programming languages you need (using Node.js as an example):
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Install Docker (if needed):
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo usermod -aG docker $USER
2. Configure VS Code for Remote Development
3. Development and Debugging
Example Code
Below is a simple Node.js project example that you can create and run on the cloud server following the above steps.
mkdir my-node-app
cd my-node-app
2.Initialize a New Node.js Project:
npm init -y
3.Install the Express Framework:
npm install express
4.
Create a Simple Server File index.js
:
const express = require('express');
const app = express();
const port = 3000;
app.get('/', (req, res) => { res.send('Hello World!');});
app.listen(port, () => { console.log(`Server is running at http://localhost:${port}`);});
5. Open this folder in VS Code and run:
Conclusion
By following the steps above, you can configure a remote Integrated Development Environment based on VS Code on a cloud server. This method not only provides powerful development tools and debugging capabilities but also allows you to leverage the computing resources of the cloud server for more efficient and scalable development work.
js
Click the “Read the Original” below to learn more about the Cloud Engineering Activities
For Chinese college students
Claim your rights immediately to start cloud practice
Thank you for your attention and support. Every bit of your reward will turn into a beam of light on the road of sharing knowledge. Thank you