> 文章列表 > centoschrome设置代理

centoschrome设置代理

centoschrome设置代理

在CentOS中设置代理,可以通过以下方法:

方法一:通过编辑 `/etc/profile` 文件

1. 打开终端并编辑 `/etc/profile` 文件:

```bash sudo vi /etc/profile ```

2. 在文件末尾添加以下内容,将代理地址和端口替换为实际的代理地址和端口:

```bash export http_proxy=http://代理地址:端口 export https_proxy=http://代理地址:端口 export ftp_proxy=http://代理地址:端口 export no_proxy=localhost,127.0.0.1 ```

3. 保存并退出编辑器,然后执行以下命令使配置文件生效:

```bash source /etc/profile ```

4. 验证代理是否已设置成功:

```bash echo $http_proxy ```

方法二:通过编辑 `/etc/yum.conf` 文件

1. 编辑 `/etc/yum.conf` 文件,添加以下代码:

```bash proxy=http://username:password@yourproxy:8080/ ```

如果无密码限制,则为:

```bash proxy=http://yourproxy:8080/ ```

方法三:通过编辑 `/etc/wgetrc` 文件

1. 编辑 `/etc/wgetrc` 文件,添加以下两行:

```bash http_proxy=http://username:password@yourproxy:8080/ ftp_proxy=http://username:password@yourproxy:8080/ ```

方法四:通过编辑 `~/.bashrc` 文件

1. 如果只想给自己的账户设置代理,则编辑 `~/.bashrc` 文件,添加以下内容:

```bash export http_proxy=http://代理地址:端口 export https_proxy=http://代理地址:端口 export ftp_proxy=http://代理地址:端口 ```

2. 保存并退出编辑器,然后执行以下命令使配置文件生效:

```bash source ~/.bashrc ```

验证代理设置

1. 网页上网 :

在Firefox浏览器中,依次点击:编辑 -> 首选项 -> 高级 -> 网络 -> 手动代理配置,输入代理地址和端口。

2. YUM代理设置 :

确保 `/etc/yum.conf` 文件中包含正确的代理设置。

3. Wget代理设置 :

确保 `/etc/wgetrc` 文件中包含正确的代理设置。

通过以上步骤,你可以在CentOS系统中成功设置全局代理。如果需要针对特定用户设置代理,可以编辑 `~/.bashrc` 文件。

其他小伙伴的相似问题:

centos配置环境变量如何设置代理?

CentOS 7代理设置教程

CentOS系统设置HTTP代理教程