自建mysql的yum服务器+本地仓库分发

自建mysql的yum服务器+本地仓库分发

1.服务端操作

1.安装FTP

[root@localhost ~]# yum install -y vsftpd

[root@localhost ~]# systemctl start vsftpd

2.准备ftp主目录

[root@localhost ~]# mkdir /var/ftp/mysql80/

3.官网下载yum仓库的包

mysql repo官网

[root@localhost ~]# wget https://repo.mysql.com//mysql80-community-release-el7-9.noarch.rpm

[root@localhost ~]# yum install -y mysql80-community-release-el7-9.noarch.rpm

4.仅下载不安装mysql

[root@localhost ~]# yum install -y --downloadonly mysql-community-server.x86_64

5.把下载的mysql安装包复制到 /var/ftp/mysql80下面

[root@localhost ~]# cd /var/cache/yum/x86_64/7/mysql80-community/packages

[root@localhost packages]# ls
mysql-community-client-8.0.34-1.el7.x86_64.rpm          mysql-community-icu-data-files-8.0.34-1.el7.x86_64.rpm  mysql-community-server-8.0.34-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.34-1.el7.x86_64.rpm  mysql-community-libs-8.0.34-1.el7.x86_64.rpm
mysql-community-common-8.0.34-1.el7.x86_64.rpm          mysql-community-libs-compat-8.0.34-1.el7.x86_64.rpm

[root@localhost packages]# cp ./* /var/ftp/mysql80/

6.创建依赖关系

[root@localhost mysql80]# yum install createrepo -y

[root@localhost mysql80]# createrepo /var/ftp/mysql80/

2.客户端操作

另外再开一台虚拟机作为客户端操作

1.自建yum仓库

[root@localhost ~]# vim /etc/yum.repos.d/mysql80.repo
[mysql80]
name=xux
baseurl=ftp://192.168.70.33/mysql80
gpgcheck=0
enabled=1

2.清空yum源 更新yum源

[root@localhost ~]# yum clean all

[root@localhost ~]# yum makecache

[root@localhost ~]# yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
源标识                                                            源名称                                                                                           状态
base/7/x86_64                                                     CentOS-7 - Base - mirrors.aliyun.com                                                             10,072
epel/x86_64                                                       Extra Packages for Enterprise Linux 7 - x86_64                                                   13,759
extras/7/x86_64                                                   CentOS-7 - Extras - mirrors.aliyun.com                                                              518
mysql80                                                           xux                                                                                                   7
updates/7/x86_64                                                  CentOS-7 - Updates - mirrors.aliyun.com                                                           5,061
repolist: 29,417

可以看到mysql80 yum仓库已经建好并可以使用了

3.安装mysql5.7试试

yum install -y mysql-community-server

4.启动mysql

systemctl start mysqld
posted @ 2023-08-14 00:30  FouroFour  阅读(51)  评论(0编辑  收藏  举报