MySQL Yum repo setups for commercial and community use cases

By | March 19, 2018

MySQL Package Management Options

Yum package manager…useful, yes!…tasty…not so much

In this blog we will explore some interesting ways to install MySQL Community and Enterprise Edition binaries using your associated Linux package manager.  In this case we’ll look mostly at the Yum package manager on Oracle Linux.  The benefit of these package managers is that you can install software packages easily, get updates easily…and also ensure that dependencies are retrieved and installed too!

Update, Feb. 12, 2019: Configuration for getting the webserver ready to deliver RPM packages has been added to the blog. Click here to go direct to that section.

MySQL Package Repo options

MySQL provides their own distribution of repositories for Download from the following URLs as follows.

To install the Yum repo from the links above, there are a set of instructions to help us on our way here https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/.  Installing the repo and using it can be simple.  The guides also provide more involved instructions to help you navigate more precisely how this is done.

No Linux distribution provides access the MySQL Enterprise Edition commercial binary packages via these packaged approaches.  But if you are a subscription customer with MySQL, then these commercial repositories can be retrieved from the Oracle Support website and installed in your private licensed environments.

Let’s take a look at the Yum setup for both the Community and Enterprise Editions of MySQL here using Oracle Linux 7.

Installing the MySQL Community Repository

In the output below, you can see all of the MySQL repos have “enabled=0”, meaning they are all disabled.  This is important if we want to install and manage our own explicitly setup MySQL repository for our Linux package management setup.

Next if we wanted to install the MySQL repo that was found on the URL above, then we can use this method below.  Adding the “-y” option (meaning, YES go ahead) is useful for scripted builds.

Installing the MySQL Commercial Repository

Configuring a Yum Repo Webserver

This provides a facility for the rpms to be delivered, so we setup an apache webserver as follows:

Acquire Your Repo Packages

Getting access to the MySQL Enterprise Edition binary packages for Yum are as simple as gaining access to your normal commercial installation files.  Start like normal by going to the Oracle Support website and login with your normal credentials that give you access to your CSI related to your MySQL products.  Search as usual for your files, by following these steps:

  1. Select “Patches & Updates”
  2. Choose the vertical tab  “Product or Family (Advanced)”
  3. Product:  “MySQL Server”
    Release: “MySQL Server 5.7” (or whichever is relevant)
    Platform: “Linux x86-64”
    Description: “repo” (this will provide options for EL/RHEL/etc & SUSE)
    Description: “Ubuntu” (provides normal binaries for Ubuntu/Deb)

Once you’ve downloaded the files, then there are a few more steps that need to be done (at least for yum based setups).

Load Repo Files into current Yum Repo Infrastructure Server

First you can add the components to your current in-house yum repo server infrastructure, which is possibly an Apache Webserver. Add the files in the package you acquired from the support site and put the “mysql-5.7” directory at the same level as the RPM-GPG-KEY-mysql file.  From the mysql-5.7 directory, you would then add your minor release content, such as directories named like 5.7.20, 5.7.21….this is where the rpm files reside, along with further metadata files related to those installers.

If your first level directory above the webroot is “repo”, then your path to your files in a browsser or curl command is http://example.my/repo/mysql-5.7.  This structure will prepare your Yum repo server to be capable of providing the RPM packages to the requesting servers in your private environment.

See the tree structure below to understand the layout for the MySQL EE repo files.

Building your client-side Yum Repo File for your MySQL Database servers

Once you’ve built your mysql.repo file on your local database server as below, you’ll be ready to go.  It’ll be to easy to install and upgrade your MySQL Enterprise binaries across your licensed infrastructure.

Now that the repo file is in place let’s refresh Yum cache, and then install our MySQL Enterprise Edition Server from the internally accessible Yum repository server.

Upgrading Our MySQL Enterprise environment

Preparing the Repo Server

Inevitably, we need to upgrade our MySQL database systems.  The basis for being able to upgrade is to first have our new MySQL RPM packages loaded onto our repo server infrastructure.  See below, how we copy the tar package directly to the webserver and unpack it in place…then of course deleting the tar package.  Depending on how it is done…permissions and file ownership may need to be fixed too!

Preparing our Yum client side for fetching new updates

Once we have added those files to the Yum Repo server, we need to have the Yum client utility remake its cache.  We can initiate this with the yum makecache  command.

Considering Our client side mysql.repo Setup

We can choose to configure our /etc/yum.repos.d/mysql.repo  in one of 2 different ways, which enables two different approaches to managing our “updating” of MySQL.

Looking below, we can see that we enabled the section [mysql-5.7] , and left the other sections that show the minor patch releases remaining “disabled”.

  • Benefit of this: We can update the Yum repo server with the next MySQL release’s rpm files and MySQL servers can get upgraded immediately if desired.  There is no “need” to update the mysql.repo files on the servers themselves.

There is a flip-side to this of course where it can be a good “control” to update the mysql.repo file. In this situation, as seen below… For each new patch release it must be registered and enabled on the mysql.repo file.  With these setup, the [mysql-5.7] section remains “disabled”, and any patch release section, such as [mysql-5.7.21] , needs to be explicitly enabled=1 .

  • Forcing the update of the mysql.repo file can ensure that upgrading MySQL becomes an “explicit” activity, and not accidental.  Such as when a “normal” monthly server patching exercise is conducted.
  • Afterall, MySQL needs more attention during upgrades, even patch upgrades.  The MySQL Server should be shutdown, binaries then updated, MySQL started, and the mysql_upgrade utility cleanly executing.

Conclusion

When it comes to “how” we manage our MySQL Server instances, there is no one particular way that fits everyone.  But having both of these community and commercial methods of integrating into our Linux package management toolsets is certainly a very helpful in giving us choices.

Alas, having the flexibility of managing our internal licensed environment is certainly one of those “hidden” eases-of-use that MySQL is known for.

As always, please leave comments.  Always happy to hear

 

One thought on “MySQL Yum repo setups for commercial and community use cases

  1. Pingback: MySQL Yum repo setups for commercial and community use cases – Cloud Data Architect

Comments are closed.