方法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 命令' 查看詳細的幫助。
