zoukankan      html  css  js  c++  java
  • 如何为linux系统设置全局的默认网络代理

    方法1:更改全局配置文件/etc/profile

    all_proxy="all_proxy=socks://proxy.xxx.com.cn:80/"
    ftp_proxy="ftp_proxy=http://proxy.xxx.com.cn:80/"
    http_proxy="http_proxy=http://proxj.xxx.com.cn:80/"
    https_proxy="https_proxy=http://proxy.xxx.com.cn:80/"
    no_proxy="no_proxy=localhost,127.0.0.0/8,::1,.xxx.intra"
    
    for var in "$all_proxy" "$ftp_proxy" "$http_proxy" "$https_proxy" "$no_proxy";do
          echo $var >> /etc/profile
    done
    
    for var in "all_proxy" "ftp_proxy" "http_proxy" "https_proxy" "no_proxy";do
          echo "export $var" >> /etc/profile
    done
    

     方法2:仅针对Gnome或MATE桌面系统, 根据GSetttings配置原理添加override文件

    [org.gnome.system.proxy]
    ignore-hosts=['localhost', '127.0.0.0/8', '::1'']
    
    [org.gnome.system.proxy.ftp]
    host='proxy.xxx.com.cn'
    port=80
    
    [org.gnome.system.proxy.http]
    host='proxy.xxx.com.cn'
    port=80
    
    [org.gnome.system.proxy.https]
    host='proxy.xxx.com.cn'
    port=80
    
    [org.gnome.system.proxy.socks]
    host='proxy.xxx.com.cn'
    port=80
    

      note:命令行下查询Gsetting数据库键值的方法

    [cxy@localhost-live x86_64]$ gsettings get org.gnome.system.proxy
    org.gnome.system.proxy         org.gnome.system.proxy.ftp     org.gnome.system.proxy.http    org.gnome.system.proxy.https   org.gnome.system.proxy.socks 
    [cxy@localhost-live x86_64]$ gsettings get org.gnome.system.proxy
    org.gnome.system.proxy         org.gnome.system.proxy.ftp     org.gnome.system.proxy.http    org.gnome.system.proxy.https   org.gnome.system.proxy.socks 
    [cxy@localhost-live x86_64]$ gsettings get org.gnome.system.proxy.http
    org.gnome.system.proxy.http    org.gnome.system.proxy.https   
    [cxy@localhost-live x86_64]$ gsettings get org.gnome.system.proxy.http 
    authentication-password  authentication-user      enabled                  host                     port                     use-authentication       
    [cxy@localhost-live x86_64]$ gsettings get org.gnome.system.proxy.http host
    'proxy.xxx.com.cn'
    

    [cxy@localhost-live x86_64]$ gsettings
    用法:
    gsettings --version
    gsettings [--schemadir SCHEMADIR] COMMAND [ARGS...]

    命令:
    help 显示此信息
    list-schemas 列出安装了的方案
    list-relocatable-schemas 列出可重定向的方案
    list-keys 列出某个方案中的键
    list-children 列出某个方案的子对象
    list-recursively 递归地列出键和值
    range 查询某个键的范围
    describe 查询某个键的描述
    get 获取某个键值
    set 设置某个键值
    reset 重设某个键值
    reset-recursively 重设指定方案中的所有值
    writable 检查某个键是否可写
    monitor 监视更改

    使用 'gsettings help 命令' 查看详细的帮助。

      

  • 相关阅读:
    myBatis学习笔记(10)——使用拦截器实现分页查询
    电影院的设计与实现(改进更新)
    软件设计师自我修炼1:怎样让用户对软件产生依赖
    jQuery.ajax()方法中參数具体解析
    王立平--Gallery:实现图片的左右滑动
    USB设备驱动概述
    Android中的多线程编程(一)附源代码
    Shannon-Fano-Elias编码的C语言实现
    互联网协议入门深入
    linux内核中创建线程方法【转】
  • 原文地址:https://www.cnblogs.com/noxy/p/9407254.html
Copyright © 2011-2022 走看看