如何在CentOS 7上设置代码服务器Cloud IDE平台

介绍 (Introduction)

With developer tools moving to the cloud, creation and adoption of cloud IDE (Integrated Development Environment) platforms is growing. Cloud IDEs allow for real-time collaboration between developer teams to work in a unified development environment that minimizes incompatibilities and enhances productivity. Accessible through web browsers, cloud IDEs are available from every type of modern device.

随着开发人员工具转移到云中,云IDE(集成开发环境)平台的创建和采用正在增长。 云IDE允许开发人员团队之间进行实时协作,以在统一的开发环境中工作,从而最大程度地减少不兼容性并提高生产力。 可以通过Web浏览器访问,各种类型的现代设备都可以使用云IDE。

code-server is Microsoft Visual Studio Code running on a remote server and accessible directly from your browser. Visual Studio Code is a modern code editor with integrated Git support, a code debugger, smart autocompletion, and customizable and extensible features. This means that you can use various devices running different operating systems, and always have a consistent development environment on hand.

代码服务器是运行在远程服务器上的Microsoft Visual Studio Code ,可直接从浏览器访问。 Visual Studio Code是具有集成Git支持,代码调试器,智能自动完成功能以及可自定义和可扩展功能的现代代码编辑器。 这意味着您可以使用运行不同操作系统的各种设备,并且始终拥有一致的开发环境。

In this tutorial, you will set up the code-server cloud IDE platform on your CentOS 7 machine and expose it at your domain, secured with free Let’s Encrypt TLS certificates. In the end, you’ll have Microsoft Visual Studio Code running on your CentOS 7 server, available at your domain and protected with a password.

在本教程中,您将在CentOS 7计算机上设置代码服务器云IDE平台,并在您的域中公开它,并使用免费的Let's Encrypt TLS证书进行保护。 最后,您将在CentOS 7服务器上运行Microsoft Visual Studio Code,该代码在您的域中可用并受密码保护。

先决条件 (Prerequisites)

  • A server running CentOS 7 with at least 2GB RAM, root access, and a sudo, non-root account. You can set this up by following this initial server setup guide.

    运行CentOS 7的服务器,至少具有2GB RAM,root用户访问权限和sudo非root用户帐户。 您可以按照本初始服务器安装指南进行设置

  • Nginx installed on your server. For a guide on how to do this, see How To Install Nginx on CentOS 7.

    Nginx安装在您的服务器上。 有关如何执行此操作的指南,请参阅如何在CentOS 7上安装Nginx

  • A fully registered domain name to host code-server, pointed to your server. This tutorial will use code-server.your-domain throughout. You can purchase a domain name on Namecheap, get one for free on Freenom, or use the domain registrar of your choice. For DigitalOcean, you can follow this introduction to DigitalOcean DNS for details on how to add them.

    托管代码服务器的完整注册域名,指向您的服务器。 本教程将使用code-server. your-domain code-server. your-domain整个code-server. your-domain 。 你可以购买一个域名Namecheap ,免费获得一个在Freenom ,或使用你选择的域名注册商。 对于DigitalOcean,您可以按照DigitalOcean DNS简介进行操作,以获取有关如何添加它们的详细信息。

第1步-安装代码服务器 (Step 1 — Installing code-server)

In this section, you will set up code-server on your server. This entails downloading the latest version and creating a systemd service that will keep code-server always running in the background. You’ll also specify a restart policy for the service, so that code-server stays available after possible crashes or reboots.

在本节中,您将在服务器上设置代码服务器。 这需要下载最新版本并创建一个systemd服务,该服务将使代码服务器始终在后台运行。 您还将为服务指定重启策略,以便在可能的崩溃或重启后代码服务器保持可用。

You’ll store all data pertaining to code-server in a folder named ~/code-server. Create it by running the following command:

您会将与代码服务器有关的所有数据存储在名为~/code-server的文件夹中。 通过运行以下命令来创建它:

  • mkdir ~/code-server

    mkdir〜/代码服务器

Navigate to it:

导航到它:

  • cd ~/code-server

    cd〜/代码服务器

You’ll need to head over to the Github releases page of code-server and pick the latest Linux build (the file will contain ‘linux’ in its name). At the time of writing, the latest version was 3.2.0. Download it using curl by running the following command:

您需要转到代码服务器的Github版本页面,并选择最新的Linux版本(该文件的名称中将包含“ linux”)。 在撰写本文时,最新版本为3.2.0 。 通过运行以下命令使用curl下载它:

  • curl -LO https://github.com/cdr/code-server/releases/download/3.2.0/code-server-3.2.0-linux-x86_64.tar.gz

    curl -LO https://github.com/cdr/code-server/releases/download/ 3.2.0 / code-server-3.2.0-linux-x86_64.tar.gz

Then, unpack the archive by running:

然后,通过运行以下命令解压缩归档文件:

  • tar -xzvf code-server-3.2.0-linux-x86_64.tar.gz

    tar -xzvf 代码服务器-3.2.0-linux-x86_64.tar.gz

You’ll get a folder named exactly as the original file you downloaded, which contains the code-server source code. Copy it to /usr/lib/code-server so you’ll be able to access it system wide by running the following command:

您将获得一个与下载的原始文件完全相同的文件夹,其中包含代码服务器源代码。 将其复制到/usr/lib/code-server以便您可以通过运行以下命令在系统范围内访问它:

  • sudo cp -r code-server-3.2.0-linux-x86_64 /usr/lib/code-server

    sudo cp -r 代码服务器-3.2.0-linux-x86_64 / usr / lib /代码服务器

Then, create a symbolic link at /usr/bin/code-server, pointing to the code-server executable:

然后,在/usr/bin/code-server处创建一个符号链接,指向代码服务器可执行文件:

  • sudo ln -s /usr/lib/code-server/code-server /usr/bin/code-server

    sudo ln -s / usr / lib /代码服务器/代码服务器/ usr / bin /代码服务器

Next, create a folder for code-server, where it will store user data:

接下来,为代码服务器创建一个文件夹,它将在其中存储用户数据:

  • sudo mkdir /var/lib/code-server

    须藤mkdir / var / lib /代码服务器

Now that you’ve downloaded code-server and made it available system-wide, you will create a systemd service to keep code-server running in the background at all times.

现在,您已经下载了代码服务器并使其在整个系统范围内可用,您将创建一个systemd服务,以使代码服务器始终保持在后台运行。

You’ll store the service configuration in a file named code-server.service, in the /usr/lib/systemd/system directory, where systemd stores its services. Create it using the vi editor:

您将服务配置存储在/usr/lib/systemd/system目录中名为code-server.service的文件中, /usr/lib/systemd/system在其中存储其服务。 使用vi编辑器创建它:

  • sudo vi /usr/lib/systemd/system/code-server.service

    须藤vi /usr/lib/systemd/system/code-server.service

Add the following lines:

添加以下行:

/lib/systemd/system/code-server.service
/lib/systemd/system/code-server.service
[Unit]
Description=code-server
After=nginx.service

[Service]
Type=simple
Environment=PASSWORD=your_password
ExecStart=/usr/bin/code-server --bind-addr 127.0.0.1:8080 --user-data-dir /var/lib/code-server --auth password
Restart=always

[Install]
WantedBy=multi-user.target

Here you first specify the description of the service. Then, you state that the nginx service must be started before this one. After the [Unit] section, you define the type of the service (simple means that the process should be simply run) and provide the command that will be executed.

在这里,您首先指定服务的描述。 然后,您声明必须先启动nginx服务。 在[Unit]部分之后,您可以定义服务的类型( simple意味着应该简单地运行该进程)并提供将要执行的命令。

You also specify that the global code-server executable should be started with a few arguments specific to code-server. --bind-addr 127.0.0.1:8080 binds it to localhost at port 8080, so it’s only directly accessible from inside of your server. --user-data-dir /var/lib/code-server sets its user data directory, and --auth password specifies that it should authenticate visitors with a password, specified in the PASSWORD environment variable declared on the line above it.

您还指定应使用一些特定于代码服务器的参数来启动全局代码服务器可执行文件。 --bind-addr 127.0.0.1:8080将其绑定到端口8080上的localhost ,因此只能从服务器内部直接访问它。 --user-data-dir /var/lib/code-server设置其用户数据目录,而--auth password指定它应使用密码(在其上方的行中声明的PASSWORD环境变量中指定)对访问者进行身份验证。

Remember to replace your_password with your desired password, then save and close the file.

请记住用所需的密码替换your_password ,然后保存并关闭文件。

The next line tells systemd to restart code-server in all malfunction events (for example, when it crashes or the process is killed). The [Install] section orders systemd to start this service when it becomes possible to log in to your server.

下一行告诉systemd在所有故障事件中重新启动代码服务器(例如,当它崩溃或进程被杀死时)。 [Install]部分命令systemd在有可能登录到服务器时启动此服务。

Start the code-server service by running the following command:

通过运行以下命令来启动代码服务器服务:

  • sudo systemctl start code-server

    sudo systemctl启动代码服务器

Check that it’s started correctly by observing its status:

通过观察其状态来检查它是否已正确启动:

  • sudo systemctl status code-server

    sudo systemctl状态码服务器

You’ll see output similar to:

您将看到类似于以下内容的输出:


   
   
Output
● code-server.service - code-server Loaded: loaded (/usr/lib/systemd/system/code-server.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2020-05-13 19:57:27 UTC; 5s ago Main PID: 10608 (node) CGroup: /system.slice/code-server.service ├─10608 /usr/lib/code-server/node /usr/lib/code-server/out/node/entry.js --bind-addr 127.0.0.1:8080 --user-data-dir /var/lib/code-server --auth... └─10622 /usr/lib/code-server/node /usr/lib/code-server/out/node/entry.js --bind-addr 127.0.0.1:8080 --user-data-dir /var/lib/code-server --auth... May 13 19:57:27 code-server-update-centos systemd[1]: Started code-server. May 13 19:57:27 code-server-update-centos code-server[10608]: info code-server 3.2.0 fd36a99a4c78669970ebc4eb05768293b657716f May 13 19:57:27 code-server-update-centos code-server[10608]: info HTTP server listening on http://127.0.0.1:8080 May 13 19:57:27 code-server-update-centos code-server[10608]: info - Using custom password for authentication May 13 19:57:27 code-server-update-centos code-server[10608]: info - Not serving HTTPS May 13 19:57:27 code-server-update-centos code-server[10608]: info Automatic updates are enabled

To make code-server start automatically after a server reboot, enable its service by running the following command:

要使代码服务器在服务器重启后自动启动,请通过运行以下命令来启用其服务:

  • sudo systemctl enable code-server

    sudo systemctl启用代码服务器

In this step, you’ve downloaded code-server and made it available globally. Then, you’ve created a systemd service for it and enabled it, so code-server will start at every server boot. Next, you’ll expose it at your domain by configuring Nginx to serve as a reverse proxy between the visitor and code-server.

在此步骤中,您已经下载了代码服务器并使其在全球范围内可用。 然后,您已经为其创建了systemd服务并启用了该服务,因此代码服务器将在每次服务器启动时启动。 接下来,您将通过配置Nginx充当访问者和代码服务器之间的反向代理,在您的域中公开它。

第2步-在您的域中公开代码服务器 (Step 2 — Exposing code-server at Your Domain)

In this section, you will configure Nginx as a reverse proxy for code-server.

在本节中,您将Nginx配置为代码服务器的反向代理。

As you have learned in the Nginx prerequisite step, its site configuration files are stored under /etc/nginx/conf.d and will automatically be loaded when Nginx starts.

正如您在Nginx必备步骤中所了解的那样,其站点配置文件存储在/etc/nginx/conf.d下,并在Nginx启动时自动加载。

You’ll store the configuration for exposing code-server at your domain in a file named code-server.conf, under /etc/nginx/conf.d. Start off by creating it using your editor:

您将在域中将代码服务器公开的配置存储在/etc/nginx/conf.d下名为code-server.conf的文件中。 首先使用编辑器创建它:

  • sudo vi /etc/nginx/conf.d/code-server.conf

    须藤vi /etc/nginx/conf.d/code-server.conf

Add the following lines:

添加以下行:

/etc/nginx/conf.d/code-server.conf
/etc/nginx/conf.d/code-server.conf
server {
    listen 80;
    listen [::]:80;

    server_name code-server.your-domain;

    location / {
        proxy_pass http://localhost:8080/;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
    }
}

Replace code-server.your-domain with your desired domain, then save and close the file.

替换code-server. your-domain code-server. your-domain和所需的域,然后保存并关闭文件。

In this file, you define that Nginx should listen to HTTP port 80. Then, you specify a server_name that tells Nginx for which domain to accept requests and apply this particular configuration.

在此文件中,您定义Nginx应该侦听HTTP端口80 。 然后,您指定一个server_name ,该名称告诉Nginx哪个域接受请求并应用此特定配置。

In the next block, for the root location (/), you specify that requests should be passed back and forth to code-server running at localhost:8080. The next three lines (starting with proxy_set_header) order Nginx to carry over some HTTP request headers that are needed for correct functioning of WebSockets, which code-server extensively uses.

在下一个块中,对于根位置( / ),您指定应将请求来回传递给运行在localhost:8080代码服务器。 接下来的三行(以proxy_set_header开头)命令Nginx继承一些HTTP请求标头,这些标头是WebSockets正确运行所必需的,WebSockets被代码服务器广泛使用。

To test the validity of the configuration, run the following command:

要测试配置的有效性,请运行以下命令:

  • sudo nginx -t

    须藤Nginx -t

You’ll see the following output:

您将看到以下输出:


   
   
Output
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

For the configuration to take effect, you’ll need to restart Nginx:

为了使配置生效,您需要重新启动Nginx:

  • sudo systemctl restart nginx

    sudo systemctl重启nginx

CentOS 7 comes with SELinux turned on, with a strict ruleset, which by default does not permit Nginx to connect to local TCP sockets. Nginx needs to do in order to serve as a reverse proxy for code-server. Run the following command to relax the rule permanently:

CentOS 7带有SELinux,并具有严格的规则集,默认情况下该规则集不允许Nginx连接到本地TCP套接字。 Nginx需要做为代码服务器的反向代理。 运行以下命令以永久放宽该规则:

  • sudo setsebool httpd_can_network_connect 1 -P

    须藤setsebool httpd_can_network_connect 1 -P

Then, in your browser, navigate to the domain you used for code-server. You will see the code-server login prompt.

然后,在浏览器中,导航到用于代码服务器的域。 您将看到代码服务器登录提示。

code-server is asking you for your password. Enter the one you set in the previous step and press Enter IDE. You’ll now enter code-server and immediately see its editor GUI.

代码服务器要求您输入密码。 输入您在上一步中设置的那个,然后按Enter IDE 。 现在,您将输入代码服务器,并立即看到其编辑器GUI。

You now have your code-server installation accessible at your domain. In the next step, you’ll secure it by applying a free Let’s Encrypt TLS certificate.

现在,您可以在域中访问代码服务器安装。 在下一步中,您将通过应用免费的Let's Encrypt TLS证书来保护它。

步骤3 —保护您的域 (Step 3 — Securing Your Domain)

In this section, you will secure your domain using a Let’s Encrypt TLS certificate, which you’ll provision using Certbot.

在本节中,您将使用Let's Encrypt TLS证书保护您的域,该证书将使用Certbot进行设置。

To install the latest version of Certbot and its Nginx plugin, run the following command:

要安装最新版本的Certbot及其Nginx插件,请运行以下命令:

  • sudo yum install certbot python2-certbot-nginx -y

    sudo yum安装certbot python2-certbot-nginx -y

To request certificates for your domain, run the following command:

要为您的域请求证书,请运行以下命令:

  • sudo certbot --nginx -d code-server.your-domain

    sudo certbot --nginx -d代码服务器 您的网域

In this command, you run certbot to request certificates for your domain—you pass the domain name with the -d parameter. The --nginx flag tells it to automatically change Nginx site configuration to support HTTPS. Remember to replace code-server.your-domain with your domain name.

在此命令中,您运行certbot来请求您的域的证书-您通过-d参数传递域名。 --nginx标志告诉它自动更改Nginx站点配置以支持HTTPS。 记住要替换code-server. your-domain code-server. your-domain和您的域名。

If this is your first time running Certbot, you’ll be asked to provide an email address for urgent notices and to accept the EFF’s Terms of Service. Certbot will then request certificates for your domain from Let’s Encrypt. It will then ask you if you’d like to redirect all HTTP traffic to HTTPS:

如果这是您首次运行Certbot,则系统将要求您提供电子邮件地址以发出紧急通知并接受EFF的服务条款。 然后,Certbot将从Let's Encrypt请求您的域的证书。 然后它将询问您是否要将所有HTTP通信重定向到HTTPS:


   
   
Output
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel):

It is recommended to select the second option in order to maximize security. After you input your selection, press ENTER.

建议选择第二个选项,以最大程度地提高安全性。 输入选择后,按ENTER

The output will be similar to this:

输出将类似于以下内容:


   
   
Output
IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/code-server.your-domain/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/code-server.your-domain/privkey.pem Your cert will expire on ... To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le

This means that Certbot has successfully generated TLS certificates and applied them to the Nginx configuration for your domain. You can now reload your code-server domain in your browser and observe a padlock to the left of the site address, which means that your connection is properly secured.

这意味着Certbot已成功生成TLS证书并将其应用于您域的Nginx配置。 现在,您可以在浏览器中重新加载代码服务器域,并观察站点地址左侧的挂锁,这意味着您的连接已得到正确保护。

Now you’ll make Certbot automatically renew the certificates before they expire. To run the renewal check daily, you’ll use cron, a standard system service for running periodic jobs. You direct cron by opening and editing a file called a crontab:

现在,您将使Certbot在证书过期之前自动对其进行续订。 要每天运行续签检查,您将使用cron (一种用于运行定期作业的标准系统服务)。 您可以通过打开和编辑一个名为crontab的文件来定向cron

  • sudo crontab -e

    须藤crontab -e

This command will open the default crontab, which is currently an empty text file. Add the following line, then save and close it:

此命令将打开默认的crontab ,当前它是一个空文本文件。 添加以下行,然后保存并关闭它:

crontab
crontab
. . .
15 3 * * * /usr/bin/certbot renew --quiet

15 3 * * * will run the following command at 3:15 am every day—you can adapt this to any time.

15 3 * * *每天凌晨3:15运行以下命令-您可以随时对其进行调整。

The renew command for Certbot will check all certificates installed on the system and update any that are set to expire in less than thirty days. --quiet tells Certbot not to output information or wait for user input.

Certbot的renew命令将检查系统上安装的所有证书,并更新所有设置为在三十天内过期的证书。 --quiet告诉Certbot不要输出信息或不等待用户输入。

cron will now run this command daily. All installed certificates will be automatically renewed and reloaded when they have thirty days or less before they expire.

cron现在将每天运行此命令。 所有已安装的证书在过期前三十天或更短的时间内将自动更新并重新加载。

Now that you have code-server accessible at your domain through a secured Nginx reverse proxy, you’re ready to review the user interface of code-server.

既然您已经可以通过安全的Nginx反向代理在您的域中访问代码服务器,那么您就可以准备检查代码服务器的用户界面。

步骤4 —使用代码服务器界面 (Step 4 — Using the code-server Interface)

In this section, you’ll use some of the features of the code-server interface. Since code-server is Visual Studio Code running in the cloud, it has the same interface as the standalone desktop edition.

在本节中,您将使用代码服务器界面的某些功能。 由于代码服务器是在云中运行的Visual Studio Code,因此它具有与独立台式机版本相同的界面。

On the left-hand side of the IDE, there is a vertical row of six buttons opening the most commonly used features in a side panel known as the Activity Bar.

在IDE的左侧,垂直排成一行的六个按钮在侧面板(称为活动栏)中打开最常用的功能。

This bar is customizable so you can move these views to a different order or remove them from the bar. By default, the first button opens the general menu in a dropdown, while the second view opens the Explorer panel that provides tree-like navigation of the project’s structure. You can manage your folders and files here—creating, deleting, moving, and renaming them as necessary. The next view provides access to a search and replace functionality.

该栏是可自定义的,因此您可以将这些视图移动到其他顺序或从栏中删除它们。 默认情况下,第一个按钮在下拉菜单中打开常规菜单,而第二个视图打开“资源管理器”面板,该面板提供项目结构的树状导航。 您可以在此处管理文件夹和文件-根据需要创建,删除,移动和重命名它们。 下一个视图提供对搜索和替换功能的访问。

Following this, in the default order, is your view of the source control systems, like Git. Visual Studio code also supports other source control providers and you can find further instructions for source control work flows with the editor in this documentation.

接下来,以默认顺序查看源代码管理系统,例如Git 。 Visual Studio代码还支持其他源代码管理提供程序,您可以在本文档中使用编辑器找到有关源代码管理工作流程的更多说明。

The debugger option on the Activity Bar provides all the common actions for debugging in the panel. Visual Studio Code comes with built-in support for the Node.js runtime debugger and any language that transpiles to Javascript. For other languages you can install extensions for the required debugger. You can save debugging configurations in the launch.json file.

活动栏上的调试器选项提供了面板中所有常见的调试操作。 Visual Studio Code内置支持Node.js运行时调试器以及任何可转换为Javascript的语言。 对于其他语言,您可以安装所需调试器的扩展 。 您可以将调试配置保存在launch.json文件中。

The final view in the Activity Bar provides a menu to access available extensions on the Marketplace.

活动栏中的最终视图提供了一个菜单,用于访问市场上可用的扩展。

The central part of the GUI is your editor, which you can separate by tabs for your code editing. You can change your editing view to a grid system or to side-by-side files.

GUI的中央部分是您的编辑器,您可以通过选项卡将其分开以进行代码编辑。 您可以将编辑视图更改为网格系统或并排文件。

After creating a new file through the File menu, an empty file will open in a new tab, and once saved, the file’s name will be viewable in the Explorer side panel. Creating folders can be done by right clicking on the Explorer sidebar and clicking on New Folder. You can expand a folder by clicking on its name as well as dragging and dropping files and folders to upper parts of the hierarchy to move them to a new location.

通过“ 文件”菜单创建新文件后,一个空文件将在新选项卡中打开,保存后,该文件的名称将在“资源管理器”侧面板中可见。 右键单击“资源管理器”侧栏,然后单击“ 新建文件夹”,即可完成创建文件夹的操作 。 您可以通过以下方式展开文件夹:单击文件夹的名称,然后将文件和文件夹拖放到层次结构的上部,以将其移动到新位置。

You can gain access to a terminal by entering CTRL+SHIFT+`, or by clicking on Terminal in the upper menu dropdown, and selecting New Terminal. The terminal will open in a lower panel and its working directory will be set to the project’s workspace, which contains the files and folders shown in the Explorer side panel.

您可以通过输入访问终端CTRL+SHIFT+`或通过单击码头上的菜单下拉菜单,并选择新航站楼 。 终端将在下面的面板中打开,其工作目录将设置为项目的工作区,其中包含“资源管理器”侧面板中显示的文件和文件夹。

You’ve explored a high-level overview of the code-server interface and reviewed some of the most commonly used features.

您已经浏览了代码服务器界面的高级概述,并回顾了一些最常用的功能。

结论 (Conclusion)

You now have code-server, a versatile cloud IDE, installed on your CentOS 7 server, exposed at your domain and secured using Let’s Encrypt certificates. You can now work on projects individually, as well as in a team-collaboration setting. Running a cloud IDE frees resources on your local machine and allows you to scale the resources when needed. For further information, see the Visual Studio Code documentation for additional features and detailed instructions on other components of code-server.

现在,您已经在CentOS 7服务器上安装了代码服务器(一种通用的云IDE),该服务器暴露在您的域中并使用Let's Encrypt证书进行保护。 现在,您可以单独进行项目,也可以在团队协作中进行工作。 运行云IDE会释放本地计算机上的资源,并允许您在需要时扩展资源。 有关更多信息,请参见Visual Studio代码文档以获取其他功能以及有关代码服务器其他组件的详细说明。

If you would like to run code-server on your DigitalOcean Kubernetes cluster check out our tutorial on How To Set Up the code-server Cloud IDE Platform on DigitalOcean Kubernetes.

如果您想在DigitalOcean Kubernetes集群上运行代码服务器,请查看有关如何在DigitalOcean Kubernetes上设置代码服务器Cloud IDE平台的教程

翻译自: https://www.digitalocean.com/community/tutorials/how-to-set-up-the-code-server-cloud-ide-platform-on-centos-7

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS 7上部署邮件服务器,你可以选择使用Postfix作为SMTP服务器和Dovecot作为IMAP/POP3服务器的组合。以下是一个基本的步骤指南: 1. 安装必要的软件包: ``` sudo yum install epel-release sudo yum install postfix dovecot ``` 2. 配置Postfix: - 编辑Postfix主配置文件`/etc/postfix/main.cf`并进行以下配置更改: ``` myhostname = your-domain.com # 设置你的域名 mydomain = your-domain.com myorigin = $mydomain inet_interfaces = all mydestination = localhost.$mydomain, localhost, $myhostname relay_domains = $mydestination ``` - 保存并关闭文件后,重新加载Postfix配置: ``` sudo systemctl reload postfix ``` 3. 配置Dovecot: - 编辑Dovecot主配置文件`/etc/dovecot/dovecot.conf`并进行以下配置更改: ``` disable_plaintext_auth = no mail_location = maildir:~/Maildir auth_mechanisms = plain login ``` - 在同一个文件中找到并编辑`protocols`部分,确保IMAP和POP3协议已启用: ``` protocols = imap pop3 ``` - 保存并关闭文件后,重新加载Dovecot配置: ``` sudo systemctl reload dovecot ``` 4. 配置防火墙规则: - 如果你使用CentOS 7上的Firewalld作为防火墙管理工具,请运行以下命令开放SMTP和IMAP/POP3端口: ``` sudo firewall-cmd --add-service=smtp --permanent sudo firewall-cmd --add-service=imap --permanent sudo firewall-cmd --add-service=pop3 --permanent sudo firewall-cmd --reload ``` 5. 设置邮箱账户: - 创建系统用户并设置密码: ``` sudo useradd -m username # 替换为你的用户名 sudo passwd username # 替换为你的用户名 ``` - 启用用户的邮箱目录: ``` sudo doveadm mailbox create -u username INBOX ``` 6. 完成后,你应该能够使用SMTP客户端(如Outlook)和IMAP/POP3客户端(如Thunderbird)连接到你的邮件服务器并进行邮件收发了。 请注意,上述步骤只是一个基本的指南,你可能需要根据你的具体需求和环境进行一些额外的配置和调整。此外,还应该考虑安全性和其他配置,例如SSL证书、反垃圾邮件过滤等。 希望这可以帮助你在CentOS 7上部署邮件服务器!如果有任何问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值