yay Installation Failed Solution
Due to well-known reasons, it is not possible to install yay normally on domestic networks, so I am writing this article.
I hope this article provides a reference for installing yay and avoids pitfalls.
Conventional Installation Method #
git clone https://aur.archlinux.org/yay
cd yay
makepkg -si
Usually, executing the above commands can successfully install yay, but often there are network errors. The main reasons are as follows:
The installation source of the Go language software is blocked.
GitHub access is restricted.
Therefore, the solution is either to use magic software or to use the methods I mentioned below.
Solution #
Change the Go language source
This article uses the Goproxy.cn source. The official website has a method for changing the source, which is also posted here.
Change the source
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
Make the changed source take effect
Take effect temporarily
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
Take effect permanently
echo "export GO111MODULE=on" >> ~/.profile
echo "export GOPROXY=https://goproxy.cn" >> ~/.profile
source ~/.profile
After completing the above steps, you can try again
makepkg -si
If there are still network problems, you can continue to read and modify the hosts file.
Modify hosts to access GitHub
This article uses the GitHub hosts found on Gitee.
The GitHub hosts are as follows:
# GitHub Host Start
185.199.108.154 github.githubassets.com
140.82.112.22 central.github.com
185.199.108.133 desktop.githubusercontent.com
185.199.108.153 assets-cdn.github.com
185.199.108.133 camo.githubusercontent.com
185.199.108.133 github.map.fastly.net
199.232.69.194 github.global.ssl.fastly.net
140.82.114.3 gist.github.com
185.199.108.153 github.io
140.82.113.3 github.com
140.82.112.5 api.github.com
185.199.108.133 raw.githubusercontent.com
185.199.108.133 user-images.githubusercontent.com
185.199.108.133 favicons.githubusercontent.com
185.199.108.133 avatars5.githubusercontent.com
185.199.108.133 avatars4.githubusercontent.com
185.199.108.133 avatars3.githubusercontent.com
185.199.108.133 avatars2.githubusercontent.com
185.199.108.133 avatars1.githubusercontent.com
185.199.108.133 avatars0.githubusercontent.com
185.199.108.133 avatars.githubusercontent.com
140.82.112.10 codeload.github.com
52.217.207.1 github-cloud.s3.amazonaws.com
52.216.78.4 github-com.s3.amazonaws.com
52.217.194.169 github-production-release-asset-2e65be.s3.amazonaws.com
52.216.131.131 github-production-user-asset-6210df.s3.amazonaws.com
52.216.28.204 github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.108.153 githubstatus.com
64.71.144.202 github.community
185.199.108.133 media.githubusercontent.com
Please Star: https://github.com/ineo6/hosts#
Mirror Repo: https://gitee.com/ineo6/hosts#
Update at: 2021-12-01 08:39:41#
GitHub Host End#
Modify hosts
sudo vim /etc/hosts
Append the above GitHub host content to the /etc/hosts file.
Make the updated hosts take effect immediately
sudo systemctl restart nscd
Author: tickltock
Source: https://www.cnblogs.com/tickltock/p/16480395.html
Copyright: This work is licensed under a "Attribution-NonCommercial-ShareAlike 4.0 International" license.