The perfect guide to Tsinghua Mirror Source: Make your software installation smoother

WBOY
Release: 2024-01-16 10:08:21
Original
1524 people have browsed it

The perfect guide to Tsinghua Mirror Source: Make your software installation smoother

Tsinghua mirror source usage guide: To make your software installation smoother, specific code examples are needed

In the process of daily use of computers, we often need to install various software to meet different needs. However, when installing software, we often encounter problems such as slow download speed and inability to connect, especially when using foreign mirror sources. In order to solve this problem, Tsinghua University provides a mirror source, which provides rich software resources and has very fast download speed. Next, let us learn about the usage strategy of Tsinghua mirror source.

First, we need to set up the Tsinghua mirror source. Open the terminal (for Windows systems, you can search cmd in the start menu and open it), enter the following instructions:

For Ubuntu systems:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak    #备份原 sources.list 文件
sudo sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
sudo sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
sudo apt update    #更新软件源
Copy after login

For CentOS systems:

sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak    #备份原 CentOS-Base.repo 文件
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Base.repo
sudo sed -i 's/#baseurl/baseurl/g' /etc/yum.repos.d/CentOS-Base.repo
sudo sed -i 's|http://mirror.centos.org/centos|https://mirrors.tuna.tsinghua.edu.cn/centos|g' /etc/yum.repos.d/CentOS-Base.repo
sudo yum makecache    #生成缓存元数据
Copy after login

Next, we can use the Tsinghua mirror source to install the software. Taking the apt package manager as an example, enter the following command:

sudo apt install 软件名
Copy after login

where "software name" is the name of the software you need to install. For example, to install Google Chrome, you can enter the following command:

sudo apt install google-chrome-stable
Copy after login

In this way, the apt package manager will automatically download and install Google Chrome from the Tsinghua mirror source, and the download speed will be very fast.

If the software you need to install is not in the default software source, you can also manually add the Tsinghua mirror source for installation. Taking Docker as an example, enter the following command:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0EBFCD88    #添加Docker官方GPG密钥
echo "deb [arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io    #安装Docker
Copy after login

In this example, we first added the official GPG key of Docker, then added the Tsinghua image source, and finally installed Docker using the apt package manager.

Through the above steps, we can easily use the Tsinghua mirror source to install the software. This not only increases the speed of installing software, but also reduces download failures caused by connection issues. At the same time, Tsinghua Image Source also provides various versions of software to meet the needs of different users.

In general, the guide to using Tsinghua Mirror Source includes two steps: setting up Tsinghua Mirror Source and using Tsinghua Mirror Source to install software. Through these steps, we can easily enjoy a fast and stable software download experience. Hope this article is helpful to everyone!

The above is the detailed content of The perfect guide to Tsinghua Mirror Source: Make your software installation smoother. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template