Last active
June 26, 2024 03:26
-
-
Save GaryLee/dc2bb0c8ec0e069e78e4d66c68110d12 to your computer and use it in GitHub Desktop.
How to use proxy to do PIP/YUM/DNF installation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Refer to https://stackoverflow.com/questions/48343669/how-to-install-python-packages-over-ssh-port-forwarding. | |
# Login to server via following ssh command. Your computer must have permission to connect to PIP server directly. | |
ssh -R 9999 [email protected] | |
# After login to your server.host.name. Use following command to install proxy package. | |
pip install package_name --proxy socks5h:127.0.0.1:9999 | |
# The apt and yum can work with this tunnel by setting proxy. | |
# Add following line in /etc/yum.conf | |
proxy=socks5h://127.0.0.1:9999 | |
# If you encounter error like "Cannot prepare internal mirrorlist: No URLs in mirrorlist", | |
# you may need to update your mirror list of YUM and DNF to newer information. | |
# Use following command to do this. | |
cd /etc/yum.repos.d/ | |
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* | |
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment