# Ubuntu

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

在 Ubuntu 中设置代理服务器有多种方法。本指南将介绍两种常见方法： [使用系统（GNOME）设置](#method-1-system-settings) 并 [使用终端](#method-2-terminal-sessions)。请按照以下步骤进行配置 [**独享ISP代理**](broken://pages/4af4201c0a9c95be03c3bf7169c117dfdfc7018c) 您已通过自助服务购买。

### 方法 1：系统设置

要设置全局网络代理，请按照以下步骤操作：

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

**步骤 2。** 找到 **Settings** 从 Ubuntu 启动器中，并转到 **Network** 选项卡。

<figure><img src="/files/d7da687882f6e49cc438af43e8da5d3fa46ba378" alt="Network"><figcaption></figcaption></figure>

**步骤 3。** 点击 **Network**后，会打开一个新对话框。在三个选项中，选择 **Network Proxy。**

<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="Network"><figcaption></figcaption></figure>

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

**HTTP Proxy**: `disp.oxylabs.io`

**端口**: `8001`

{% hint style="success" %}
端口号表示你所购买的 [代理列表](broken://pages/7fd13a6e3bd5e827f37ba7aaf782b77f6d508cae) 中的哪个 IP 地址将被使用。使用端口 `8000` 用于自动 [代理 IP 轮换](broken://pages/66709396c838c13f121c37b3699df5bab4276740).
{% endhint %}

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

**步骤 5。** 关闭 Network Proxy 窗口。更改将自动保存，全局代理将被激活。

每次通过浏览器或其他应用发出网页请求时， **弹出窗口都会提示您输入该会话的凭据** ，即您的 Oxylabs 代理用户凭据。&#x20;

{% hint style="warning" %}
请记得在用户名后附加 `user-` 部分，例如： `user-john_f8yR`.
{% 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@disp.oxylabs.io:8001"
export https_proxy="user-USERNAME:PASSWORD@disp.oxylabs.io:8001"
export ALL_PROXY="socks5://user-USERNAME:PASSWORD@disp.oxylabs.io:8001"
```

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

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

**端口：** `8001`

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

**密码：** `PASSWORD`

{% hint style="success" %}
端口号表示你所购买的 [代理列表](broken://pages/7fd13a6e3bd5e827f37ba7aaf782b77f6d508cae) 中的哪个 IP 地址将被使用。使用端口 `8000` 用于自动 [代理 IP 轮换](broken://pages/66709396c838c13f121c37b3699df5bab4276740).
{% endhint %}

{% hint style="warning" %}
别忘了在您的用户名中添加 `user-` 这一部分。
{% endhint %}

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

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

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

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

如果您希望为所有用户启用它，则需要将上面的两行追加到 `/etc/environment`.

就是这样！您已成功集成 Oxylabs 代理。

您可以找到完整教程 [这里](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-isp-proxies-guides/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.
