# Ubuntu

[**Ubuntu**](https://ubuntu.com/) 是一个基于 Linux 的开源软件操作系统，适用于企业服务器、桌面、云和物联网。

有多种方法可以为 Ubuntu 配置代理服务器。在本指南中，您将找到两种常见方法： [使用系统 (GNOME) 设置](#method-1-system-settings) 和 [使用终端](#method-2-terminal-sessions).

### 方法 1：系统设置

要设置系统范围的网络代理，请按照以下步骤操作：

**步骤 1。** [**下载**](https://ubuntu.com/download/desktop) 并安装 Ubuntu Desktop。

**步骤 2。** 查找 **设置** 从 Ubuntu 启动器并转到 **网络** 选项卡。

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiwDdoZGfMbUe5cRL2417%2Fuploads%2FbDYJnF1S6PKLhmBg1kU5%2Fimage.png?alt=media&#x26;token=aa0a5b5a-f669-4b8d-975e-2375995248ee" alt="Ubuntu launcher"><figcaption></figcaption></figure>

**步骤 3。** 单击后 **网络**，将打开一个新对话框。在三个选项中，选择 **网络代理。**

<figure><img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiwDdoZGfMbUe5cRL2417%2Fuploads%2F0QpbIwlPPRIdIB3jYFza%2Fimage.png?alt=media&#x26;token=e78a2185-2744-409b-9ae8-5f0307963093" alt="Choose Network Proxy"><figcaption></figcaption></figure>

**步骤 4。** 选择 **手动** 以配置代理设置。接下来，会弹出几个文本框，您可以在其中设置 `HTTP`, `HTTPS`，或 `SOCKS5` 代理。填写以下信息：&#x20;

**HTTP 代理：** `ddc.oxylabs.io`

**端口：** `8001`

{% hint style="info" %}
你需要选择分配给已购买 [**代理列表**](/documentation/cn/dai-li/dedicated-datacenter-proxies/self-service/proxy-list.md)**,** 的 IP 地址的端口，可在 Oxylabs 仪表盘中找到。
{% endhint %}

<figure><img src="/files/117317ead90bd1f5c8da142dca77cc3cc95adce7" alt="" width="563"><figcaption></figcaption></figure>

**步骤 5。** 关闭“网络代理”窗口。更改将自动保存，系统范围的代理将被激活。&#x20;

每次通过浏览器或其他应用发出网络请求时，都会弹出一个 **弹窗提示您在会话期间输入凭据** 您 Oxylabs 代理用户的凭证。

{% hint style="warning" %}
请记得在用户名中附加 `user-` 部分，例如： `user-USERNAME`.
{% endhint %}

***

### 方法 2：终端会话

要为所有终端会话设置网络代理，请按照以下步骤操作：

**步骤 1。** [**下载**](https://ubuntu.com/download/desktop) 并安装 Ubuntu Desktop。

**步骤 2。** 打开 **shell** 配置，使用编辑器。

对于 ZSH 终端，shell 配置文件默认位于主目录中。我们可以使用 `vim` 通过以下命令编辑该文件：

```sh
vim ~/.zshrc
```

除了 `vim`，您也可以使用 `gedit`, `nano`或您喜欢的任何其他文本编辑器。此外，如果您使用的是 Bash 而不是 ZSH，则需要编辑您的 bash shell 配置文件，即 `~/.bashrc` 而不是 `~/.zshrc`.

**步骤 3。** 创建两个新的环境变量

在此配置文件底部，您需要定义 `http_proxy，` `https_proxy`，或 `ALL_PROXY` （用于 SOCKS5）变量。

```sh
export http_proxy="user-USERNAME:PASSWORD@ddc.oxylabs.io:8001"
export https_proxy="user-USERNAME:PASSWORD@ddc.oxylabs.io:8001"
export ALL_PROXY="socks5://user-USERNAME:PASSWORD@ddc.oxylabs.io:8001"
```

以下是您需要填写的详细信息：

**代理地址：** `ddc.oxylabs.io`

**端口：** `8001`

**用户名：** `user-username`

**密码：** `密码`

{% hint style="warning" %}
别忘了添加 `user-` 部分。
{% endhint %}

**步骤 4。** 重新加载配置

现在，您可以通过打开新终端或在现有终端中运行以下命令来重新加载配置文件：

```sh
source ~/.zshrc
```

代理将在当前用户下始终处于激活状态。shell 配置文件会在每次打开新终端时加载。因此，即使重启电脑，环境变量也会始终可用。

如果您想为所有用户启用，则需要将上述两行附加到 `/etc/environment`.

就这样！您已成功集成您的 Oxylabs 代理。&#x20;

您可以在完整教程中找到相关内容 [此处](https://oxylabs.io/resources/integrations/ubuntu).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.oxylabs.io/documentation/cn/dai-li/integration-guides/3rd-party-integrations-1-1/self-service/ubuntu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
