This the multi-page printable view of this section.Click here to print.
Not doing so could cause you not to be able to make any further updates to your machine!
To switch over to using your new proxy you need to edit the apt sources files under /etc/apt/
then run apt-get update
.
If you have followed the naming conventions above you can go in to /etc/apt/sources.list
and replace
any reference to the remote storage url in nexus with the new path.
You should also do this for anything in the /etc/apt/sources.list.d/
directory - but only those
you have configured a proxy for!
For example, if your local nexus is accessible at http://10.11.12.13:8081/
then
for the apt-ubuntu-archive proxy
changing http://gb.archive.ubuntu.com/ubuntu
in sources.list with
http://10.11.12.13:8081/repository/apt-ubuntu-archive/
For example:
1deb http://gb.archive.ubuntu.com/ubuntu focal main restricted
2deb http://gb.archive.ubuntu.com/ubuntu focal-updates main restricted
becomes:
1deb http://10.11.12.13:8081/repository/apt-ubuntu-archive/ focal main restricted
2deb http://10.11.12.13:8081/repository/apt-ubuntu-archive/ focal-updates main restricted
focal-updates
above.
They should match that of the remote repository.
Do not replace them with the value in the proxy!
If like me, you have https configured, then you should be using the correct https address and not the 8081 port.
Now run an update:
1sudo apt-get update
Apt should now access your local proxy. If this completes without any errors then any future upgrade or install will now use the proxy instead.
Configuring NPM to use Nexus as a proxy is simple.
First ensure you've created the NPM proxy.
Next, edit or create the file .npmrc
in your home directory with the following line:
1registry=http://10.11.12.13:8081/repository/npm-proxy
Where 10.11.12.13
is where you have deployed Nexus and
npm-proxy
is what you called your NPM proxy.
If you've configured a group then use the group's name instead, e.g. npm-group
Obviously if you've configured https and dns then use that and not port 8081.
Now any time you run npm
it will use your proxy.
Configuring PIP to use Nexus as a proxy is simple.
First ensure you've created the PyPi proxy.
Next, we need to edit or create pip.conf
to hold the new index position.
This file can be in one of three locations:
${XDG_CONFIG_DIRS}/pip.conf
will be loaded, followed by
/etc/pip.conf
.
${HOME}/.config/pip/pip.conf
for the specific user.
There is a legacy option of ${HOME}/.pip/pip.conf
which will be used if it exists.
${VIRTUAL_ENV}/pip.conf
pip.conf
should contain the following:
1[global]
2index = http://10.11.12.13:8081/repository/pypi-group/pypi
3index-url = http://10.11.12.13:8081/repository/pypi-group/simple
Where 10.11.12.13
is where you have deployed Nexus and
pypi-proxy
is what you called your PyPi proxy.
If you've configured a group then use the group's name instead, e.g. pypi-group
Obviously if you've configured https and dns then use that and not port 8081.
Now any time you run pip
it will use your proxy.