Working Behind a Network Proxy

From Yocto Project
Jump to: navigation, search



The Yocto Project build system provides the tools and environment to build the packages that comprise a bootable Linux image. All the sources for the packages must be fetched through various means, including wget, git, and others. You need to configure your system to work with your corporate proxies and there are two options for doing this

  1. Environment variables and configuration files - this is the traditional and least intrusive option but involves a number of steps and it can fail in some situations.
  2. Chameleonsocks - this is Redsocks auto-configured in a docker container, the Yocto team's favorite option. If in doubt, go with this option.

Option 1: Environment Variables and Configuration Files


Set the following environment variables in your ~/.bashrc file. This example uses the same proxy server and port number for all three protocols.

export http_proxy=''
export https_proxy=''
export ftp_proxy=''
export ALL_PROXY='socks://'
export all_proxy='socks://'
export no_proxy=''

Git Proxy Configuration

Git allows you to specify a command via GIT_PROXY_COMMAND to proxy its network communications. The script, oe-git-proxy, uses socat and standard proxy environment variables. Make sure socat is installed otherwise oe-git-proxy will fail silently.

Copy oe-git-proxy to a location in your PATH, typically ~/bin/ is a good choice. /usr/local/bin is another common option. oe-git-proxy is provided in poky/scripts/oe-git-proxy, but use the link below to get you bootstrapped. Replacing it with the latest from the poky git repository is recommended.

$ sudo apt-get install socat
$ wget
$ cp oe-git-proxy ~/bin
$ chmod +x ~/bin/oe-git-proxy

Update your .bashrc to setup the GIT_PROXY_COMMAND variable. You also need to set the NO_PROXY variable as oe-git-proxy does no recognize no_proxy

export GIT_PROXY_COMMAND="oe-git-proxy"
export NO_PROXY=$no_proxy

Be sure to log out and back in for the settings to take effect.

Wget Proxy Configuration

Proxy environment variables are not propagated to all stages of the Yocto build process so sometimes wget cannot pick them up. To workaround this add the following to ~/.wgetrc.

https_proxy =
http_proxy =
ftp_proxy =
no_proxy =;
use_proxy = on

Option 2: Chameleonsocks

Chameleonsocks is a containerized proxy solution that is very easy to set up.

Personal tools