|
| 1 | + |
| 2 | +| sidebar_label | title | cname | |
| 3 | +| :-----------: | ------------------------------------------------- | ----- | |
| 4 | +| MSYS2 | Usage Guide for MSYS2 Software Repository Mirrors | MSYS2 | |
| 5 | +## Introduction and Usage Scenarios of MSYS2 |
| 6 | +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. |
| 7 | +## Inclusive Architecture |
| 8 | +- MinGW: i686, x86_64, ucrt64, clang64 |
| 9 | +- MSYS: i686, x86_64 |
| 10 | +## Download and Installation of MSYS2 |
| 11 | + |
| 12 | +Please visit the distrib/ directory under the mirror directory: |
| 13 | + |
| 14 | +### x86_64 |
| 15 | + |
| 16 | +<SiteLink href="/msys2/distrib/x86_64/"> |
| 17 | + <button className="button button--primary">Check the installation packages of the x86_64 version</button> |
| 18 | +</SiteLink> |
| 19 | + |
| 20 | + |
| 21 | +### i686 |
| 22 | + |
| 23 | +<SiteLink href="/msys2/distrib/i686/"> |
| 24 | + <button className="button button--primary">Check the installation packages of the i686 version |
| 25 | + </button> |
| 26 | +</SiteLink> |
| 27 | + |
| 28 | +### Usage Details |
| 29 | + |
| 30 | +Find the file named `msys2-<architecture>-<date>.exe`(such as `msys2-x86_64-20141113.exe`), and then download and install it. |
| 31 | + |
| 32 | +## The configuration of pacman within MSYS2 |
| 33 | + |
| 34 | +:::caution |
| 35 | +**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.** |
| 36 | +::: |
| 37 | + |
| 38 | +## Manual Source Replacement |
| 39 | + |
| 40 | +1.**Edit the`/etc/pacman.d/mirrorlist.mingw32` file**: Add the following content at the beginning of the file: |
| 41 | + |
| 42 | +```bash varcode |
| 43 | + Server = ${_http}://${_domain}/msys2/mingw/i686 |
| 44 | +``` |
| 45 | +2.**Edit the `/etc/pacman.d/mirrorlist.mingw64` file**: Add the following content at the beginning of the file: |
| 46 | + |
| 47 | +```bash varcode |
| 48 | + Server = ${_http}://${_domain}/msys2/mingw/x86_64 |
| 49 | +``` |
| 50 | +3.**Edit the `/etc/pacman.d/mirrorlist.msys` file**: Add the following content at the beginning of the file: |
| 51 | + |
| 52 | +```bash varcode |
| 53 | + Server = ${_http}://${_domain}/msys2/msys/$arch |
| 54 | +``` |
| 55 | +4.**Edit the `/etc/pacman.d/mirrorlist.ucrt64` file**: Add the following content at the beginning of the file: |
| 56 | + |
| 57 | +```bash varcode |
| 58 | + Server = ${_http}://${_domain}/msys2/mingw/ucrt64 |
| 59 | +``` |
| 60 | +5.**Refresh the software package database**: |
| 61 | + |
| 62 | +```shell varcode |
| 63 | + Is [ ] (root) a root user |
| 64 | + --- |
| 65 | + const SUDO = !root ? 'sudo ' : ''; |
| 66 | + --- |
| 67 | + ${SUDO}pacman -Sy |
| 68 | +``` |
| 69 | + |
| 70 | +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. |
| 71 | + |
| 72 | +## One-click source replacement |
| 73 | + |
| 74 | +:::caution |
| 75 | +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. |
| 76 | +::: |
| 77 | + |
| 78 | +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: |
| 79 | + |
| 80 | +```shell varcode |
| 81 | +Is [ ] (root) a root user |
| 82 | +--- |
| 83 | +const SUDO = !root ? 'sudo ' : ''; |
| 84 | +--- |
| 85 | +${SUDO}sed -i "s#https\\?://mirror.msys2.org/#${_http}://${_domain}/msys2/#g" /etc/pacman.d/mirrorlist* |
| 86 | + |
| 87 | +``` |
| 88 | + |
| 89 | +## Quote |
| 90 | + |
| 91 | +1. [MSYS2 Mirror Site Usage Help | Alibaba Cloud Open Source Mirror Station](https://developer.aliyun.com/mirror/msys2) |
| 92 | + |
| 93 | +2. [MSYS2 Mirror Site Usage Help | Tsinghua University Open Source Software Mirror Station](https://mirrors.tuna.tsinghua.edu.cn/help/msys2/) |
0 commit comments