# Ubuntu

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

在 Ubuntu 上设置代理服务器有多种方式。在本指南中，你会找到两种常见方法： [使用系统（GNOME）设置](#method-1-system-settings) 并 [使用终端](#method-2-terminal-sessions).

### 方法 1：系统设置

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

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

**步骤 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" %}
你需要选择一个分配给已购买的 IP 地址的端口， [**代理列表**](broken://pages/c15b9796b97ccb979daeedccf6fd1971753445a2)**,** 你可以在 Oxylabs 的仪表盘中找到。
{% endhint %}

<figure><img src="/files/9bf4fe2b75ec6f7ed2015d6fc12cdce584013ded" alt="" width="563"><figcaption></figcaption></figure>

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

每次你通过浏览器或其他应用程序发起网络请求时， **弹出窗口都会提示你输入该会话的凭据** ，即你的 Oxylabs 代理用户凭据。

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

***

### 方法 2：终端会话

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

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

**步骤 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/integrations/cn/proxy-integrations/dedicated-datacenter-proxies-guides/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.
