Usage Guide for MSYS2 Software Repository Mirrors
Introduction and Usage Scenarios of MSYS2
MSYS2 is a software distribution for Windows that provides an environment similar to Unix. It is based on the modern Cygwin and MinGW-w64 projects, aiming to offer developers a powerful platform for building and development. MSYS2 uses the pacman package manager, (which is the same as Arch Linux), making it convenient to install, update, and manage software packages. It provides an environment akin to Unix systems, making cross-platform development on Windows easier. MSYS2 includes a vast array of pre-compiled packages, including compilers, libraries, tools, and so on.
Inclusive Architecture
- MinGW: i686, x86_64, ucrt64, clang64
- MSYS: i686, x86_64
Download and Installation of MSYS2
Please visit the distrib/ directory under the mirror directory:
x86_64
i686
Usage Details
Find the file named msys2-<architecture>-<date>.exe
(such as msys2-x86_64-20141113.exe
), and then download and install it.
The configuration of pacman within MSYS2
To avoid issues after replacing the software source configuration file, please first back up the system's default software source configuration file, and then proceed with the following steps.
Manual Source Replacement
- Edit the
/etc/pacman.d/mirrorlist.mingw32
file: Add the following content at the beginning of the file:
Server = https://mirrors.hust.edu.cn/msys2/mingw/i686
- Edit the
/etc/pacman.d/mirrorlist.mingw64
file: Add the following content at the beginning of the file:
Server = https://mirrors.hust.edu.cn/msys2/mingw/x86_64
- Edit the
/etc/pacman.d/mirrorlist.msys
file: Add the following content at the beginning of the file:
Server = https://mirrors.hust.edu.cn/msys2/msys/$arch
- Edit the
/etc/pacman.d/mirrorlist.ucrt64
file: Add the following content at the beginning of the file:
Server = https://mirrors.hust.edu.cn/msys2/mingw/ucrt64
- Refresh the software package database:
sudo pacman -Sy
Through these steps, you can change the mirror source of MSYS2 to the mirror station of Huazhong University of Science and Technology, thus speeding up the download and update of software packages.
One-click source replacement
This method is only applicable to changing from the official source to the source of this site. If you have already changed the source, please do not use the following commands.
You can use the following command to change the mirror source of MSYS2 to the mirror station of Huazhong University of Science and Technology with one click:
sudo sed -i "s#https\?://mirror.msys2.org/#https://mirrors.hust.edu.cn/msys2/#g" /etc/pacman.d/mirrorlist*