Setting Up a Linux Development Environment on a Cloud Server

There are three primary approaches to setting up a Linux environment:

Method Description
Dual Boot Installing Linux directly on physical hardware alongside another OS. This is generally not recommended due to poor desktop usability.
Virtual Machine Running Linux inside software like VMWare. This can be problematic due to software bugs and environment instability.
Cloud Server Renting a instance from providers like Alibaba Cloud, Tencent Cloud, or Huawei Cloud. This is the preferred method as it avoids local configuration issues and allows public internet access for deployed applications.

Provisioning a Cloud Instance

Using Tencent Cloud as an example (the process is similar for other providers):

  1. Navigate to the official provider website (e.g., https://cloud.tencent.com/).
  2. Select Lighthouse (Lightweight Application Server) or ECS.
  3. Choose a cost-effective configuration. Huawei Cloud often offers lower prices, but the steps below apply to Tencent Cloud.
  4. Configuration Settings:
    • Region: Select the location closest to you.
    • Image: Select CentOS 7.6.
  5. Once purchased, access the console. Note the Public IP Address highlighted in the interface.
  6. Security: Click Reset Password to set a strong root password. A complex password is crucial to prevent unauthorized access.

Essential Connection Details

Ensure you have the following three pieces of information ready:

Credential Value
Public IP The external IP address of your instance
Username root (default administrator)
Password The strong password you just set

Connecting via SSH Client

Download a terminal emulator like XShell (look for the Free for Home/School version).

  1. Open XShell and click New to create a session.
  2. Name: Enter any identifier (e.g., "MyCentOS").
  3. Host: Enter the Public IP of your cloud server.
  4. Click Connect. When prompted, enter the username (root) and the password.
  5. Successful login will display a shell prompt (e.g., [root@hostname ~]#).

Writing a Simple C Program

With the environment ready, verify functionality by compiling a basic C script.

1. Create the source file Use touch to generate an empty file.

touch demo.c

2. Edit the file Open the file using the vi editor.

vi demo.c
  • Press i to enter Insert Mode.
  • Write your code:
#include <stdio.h>

int main() {
    printf("Environment setup successful!\n");
    return 0;
}
  • Press ESC to exit Insert Mode.
  • Type :wq and hit Enter to write (save) and quit.

3. Inspect the file Use cat to display the contents of the file to verify.

cat demo.c

4. Compile the code Use gcc to compile. The -o flag specifies the name of the output executable (otherwise it defaults to a.out).

gcc demo.c -o output_bin

5. Execute the program Run the generated binary using the relative path.

./output_bin

Tags: Linux Cloud Server centos ssh c programming

Posted on Fri, 15 May 2026 17:27:26 +0000 by walter8111