How to install Mysql from a network yum source
Recently, I want to build Mysql environment locally. The preparation and installation process is as follows:
1. Software environment:
CentOS 7
Mysql 5.6
2. Linux environment installation method comparison:
Advantages and disadvantages of installation source package compilation and installation can be customized software function module;
Source compilation optional parameters, error-prone;
The compilation and installation process takes a long time;
Does not have software management functions;
RPM Installation (Redhat Package Manager)
Provide software management functions, installation, upgrade, uninstall;
Easy and fast operation;
(b) Private dependence;
Yellow Dog Updater,Modified
Support online and offline two ways;
automatically resolve dependencies;
3. Yum Introduction
Before starting the installation, let's understand the common commands and related configurations of yum.
3.1 Yum common command
Query software installation
yum list installed #Query installed software
yum list installed| grep package #Query whether a specific software is installed
install software
yum install packageName #Install packages online
yum localinstall packageName.rpm #localinstall
update software
yum list updates #List software that can be updated
yum update package_name #Update software
uninstall software
yum remove package_name #Remove only packages, keep configuration files and data files;
yum erase package_name #Delete the software and all its files.
3.2 Create a network yum source
To build a yum source, you need to know the following configuration files and related directories.
/etc/yum.conf #yum configuration file, configuration cache path, log path and gpg check
/etc/yum.repos.d/ #custom repository
The requested URL/var/log/yum.log was not found on this server.
/var/cache/yum/ #Store downloaded rpm packages
yum.conf configuration file, mainly divided into two parts,[main] part to configure global variables; the second part, used to configure the repository server, this part can also be in/etc/yum.repos.d/directory, save as.repo file for configuration.
The following information is contained in/etc/yum.conf:
[root@Durian etc]# nl yum.conf
1 [main]
2 cachedir=/var/cache/yum/$basearch/$releasever
3 keepcache=0
4 debuglevel=2
5 logfile=/var/log/yum.log
6 exactarch=1
7 obsoletes=1
8 gpgcheck=1
9 plugins=1
10installonly_limit=5
11bugtracker_url=http://bugs.centos.org/set_project.php? project_id=23&ref=http://bugs.centos.org/bug_report_page.php? category=yum
12distroverpkg=centos-release
13# This is the default, if you make this bigger yum won't see if the metadata
14# is newer on the remote and so you'll "gain" the bandwidth of not having to
15# download the new metadata and "pay" for it by yum not having correct
16# information.
17# It is esp. important, to have correct metadata, for distributions like
18# Fedora which don't keep old packages around. If you don't like this checking
19# interupting your command line usage, it's much better to have something
20# manually check the metadata once an hour (yum-updatesd will do this).
21# metadata_expire=90m
22# PUT YOUR REPOS HERE OR IN separate files named file.repo
23# in /etc/yum.repos.d
After understanding the above knowledge, start to create Mysql repository files.
cd /etc/yum.repos.d/
touch mysql-community.repo
vi mysql-community.repo
Add the following information to the file:
#Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/
enabled=1 #0 turns off the yum source, 1 turns on the yum source
gpgcheck=0 #0 for packages that do not require validation, 1 for packages that require validation
gpgkey=
4. install MySQL
With the repository configured and yum commands known, you can install it!
Simple execution yum install mysql, easy to get a command!
You can use Mysql now!
After installation, check the files under the cache directory/var/cache/yum to see the rpm package of get.
References:
Linux System Commands and Shell Scripting Practice Guide
Linux Command Line and Shell Script Programming