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 can provide a reference for installing yay and avoid pitfalls.
Conventional Installation Method #
git clone https://aur.archlinux.org/yay
cd yay
makepkg -si
In general, executing the above commands should result in a successful installation. However, network errors are often encountered, with the main reasons being:
The installation source for the Go language is blocked.
Limited access to GitHub.
Therefore, the solution can either involve using magic software or adopting the methods described below.
Solution #
Changing the Go language source
This article uses the Goproxy.cn source, and the official website provides a method for changing the source, which is also provided here.
Change the source
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
Make the changed source effective
Temporarily effective
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
Permanently effective
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 issues, you can continue reading 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 file 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.