Linux-configure Alibaba Cloud YUM source

Condition: The virtual machine can access the Internet.

The basic steps:

a. Clean up the original YUM configuration

b. Go to the Alibaba open source mirror station to download and configure

c. Update the YUM repository

d. Execute the installation

1. Clean up the original YUM configuration

Use the command: cd /etc/yum.repos.d/

Use the command: ls

View the original YUM configuration.

Use the command: mv * /tmp/ to move the original YUM configuration to the tmp path.

Use the command: ls to check whether the move is successful.

Use the command: vim /tmp/CentOS-Base.repo to view the contents of the file.

We will find that official words such as centos will be marked in the documents to prove that these documents are official documents of centos .

exit file

2. Download the basic and extended configuration

2.1 Download the basic configuration

Go to the website Alibaba Open Source Mirror Station to download the configuration

Basic configuration select centos

Copy command: wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo Download Ali basic configuration.

Command explanation :

wget 下载 ; O 后跟下载位置; /etc/yum.repos.d/ 下载路径;CentOS-Base.repo 库名;

https://mirrors.aliyun.com/repo/Centos-7.repo 下载库的链接位置(阿里云镜像网站)。

下载基本配置后,利用命令: lspwd 查看文件,发现路径下分别显示CentOS-Base.repo/etc/yum.repos.d

利用命令:vim CentOS-Base.repo 查看文件。

注意红色方框部分与前述的区别。

2.2下载扩展配置

扩展配置,选择epel

选择对应版本,复制链接到终端进行执行。

3.更新YUM仓库

利用命令:yum makecache 更新YUM仓库

4.执行安装

利用命令:yum repolist 查询安装的配置共有多少个软件包。

利用命令: yum install -y httpd 安装httpd服务

会发现来自aliyun镜像网站

利用命令:systemctl start httpd 开启httpd服务

利用命令:systemctl stop firewalld 关闭防火墙服务

打开浏览器,输入IP地址:http://127.0.0.1 出现如图页面,则证明执行安装成功。

Guess you like

Origin blog.csdn.net/aaaccc444/article/details/128581242