Entroduction
Working with remote Linux environments is a common requirement for modern development teams. This guide explains how to configure IntelliJ IDEA for remote server development using SSH, and demonstrates how to establish connections through network boundaries using tunneling software. The appproach allows compilation, building, debugging, and execution to occur on the remote server while the local IDE functions as a lightweight client. This configuration was tested with IntelliJ IDEA 2023.2. Earlier versions may lack full remote development support. ### Prerequisites: Verify SSH Service
Before proceeding, confirm that the SSH daemon is operational on your target Linux server. Execute the following command to check the service status: ``` sudo systemctl status sshd
The output should display "active (running)" indicating the SSH service is available and accepting connections on the default port 22. ### Local Connection Verification
Begin by verifying connectivity within your local network. This step ensures basic connectivity works before introducing external network considerations. Launch IntelliJ IDEA and select the SSH connection option from the main interface. Create a new project configuraton and enter the following details: - Username: Your SSH login username
- Host: The server's local IP address
- Port: 22 (SSH default)
Click the connection button to initiate the session. When prompted, enter the password for the SSH user. The IDE will then request selection of a working directory on the server. For this demonstration, a directory at `/usr/local/javaProject` was pre-created to contain project files. After authenticating a second time when prompted, the IDE will establish a connection and load the remote development environment. This confirms that local network connectivity is functional. You may close this session after verification, as the following sections address establishing connections across network boundaries. ### Installing Tunneling Software on Linux
To enable connections from networks outside your local environment without requiring a public IP address, a tunneling solution is required. This example uses a tool that creates secure tunnels exposing local services to the internet. Execute the following commands to install the tunneling software: ```
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
Enable the service to start automatically on system boot: ``` sudo systemctl enable cpolar
Launch the service immediately: ```
sudo systemctl start cpolar
Once installation completes, access the web management interface by navigating to http://<server-ip>:9200 from any browser. Create an account or log in to access the configuration dashboard. ### Creating a Public Tunnel
From the web management interface, navigate to the tunnel management section and create a new tunnel with these parameters: - Name: A descriptive identifier (unique within your account)
- Protocol: TCP
- Local Address: 22 (standard SSH port)
- Port Type: Temporary random TCP port
- Region: China (or nearest selected region)
After creation, the interface displays an online tunnel list containing the generated public TCP address and port. Note these credentials for use in the next section. This address enables connections from any network with internet access. ### Establishing Remote Connection
Return to IntelliJ IDEA and create a new SSH connection configuration. Instead of the local IP address used previously, enter the public tunnel address and corresponding port number obtained from the tunnel list. Upon clicking connect, the IDE establishes a new session through the tunnel. Authenticate with the server password when prompted, then select the project directory. The remote development environment loads successfully, demonstrating that location-independent development is now achievable. ### Configuring Persistent Connection Addresses
The temporary tunnel address changes every 24 hours. For stable, production-like access, configure a reserved static address. Note: Static address reservation requires upgrading to a professional subscription tier. To reserve a static address, log into the tunneling service website and navigate to the address reservation section. Select the following options: - Region: China VIP Top
- Description: Custom label for identification
Confirm the reservation to generate a permanent TCP address. Copy this address for the next step. Return to the tunnel management interface, locate your existing TCP tunnel, and access its edit configuration. Modify the tunnel settings: - Port Type: Change to Fixed TCP Port
- Reserved TCP Address: Paste the statically reserved address
Save the updated configuration. The online tunnel list now displays the permanent public address, eliminating the need for daily configuration updates. ### Verifying Static Address Connection
Create a new SSH connection in IntelliJ IDEA using the reserved static address and its assigned port. Upon connection attempt, a dialog提示 appear—confirm to proceed. Enter the SSH password when prompted, select the project directory, and initiate the connection. After secondary authentication, the remote development environment loads successfully using the permanent address. The configuration is now complete and ready for regular use.