Desired Outcome: Install MariaDB (SQL) on CentOS 7 Server, so I can work through my MySQL tutorial book.
Note: This has been challenging trying to resolve what to actually install and how, so this document will be in FAQ format as I review each section. Good thing is that the learning applies to other applications as well.
Q: What is MariaDB?
A: MariaDB server is a community developed fork of MySQL server. When Oracle bought MySQL the licensing changed, so a fork was made and called MariaDB. MariaDB has same functionality as MySQL, with some added features.
XREF to: https://mariadb.org/en/about/
Q: Do I install MySQL and MariaDB or just MariaDB?
A: No requirement to install MySQL — MariaDB can be installed by itself.
Q: What Hardware am I using?
A: Laptop with CentOS 7 Server installed. 64-Bit.
Note: When I enter “uname -i” it comes back with: x86_64. This tells me it has 64-bit, which is probably more required for when I install an Oracle DB on the Server later.
Q: What is AMD64?
A: x86-64 (also known as x64, x86_64 and AMD64) is the 64-bit version of the x86 instruction set.
Q: What are some yum commands?
A: http://yum.baseurl.org/wiki/YumCommands — for a list of commands
Q: Do I need to do a system update of CentOS Server before installing MariaDB?
A: I didn’t need to, but doing system updates of CentOS is another Project.
Q: How do I check for existing installation or configuration files of MySQL? Commands done before I did anything.
A: mysql –help
Note: It returned “-bash: mysql: command not found”
A: mysqld –help –verbose
Note: It returned “-bash: mysqld: command not found”
A: mysql –help | grep Default -A 1
Note: It returned “-bash: mysql: command not found”
A: locate my.cnf
Note: It returned “-bash: locate: command not found”
A: rpm -q –list mysql-server (Note: -q is for query)
Note: It returned “package mysql-server is not installed” — I think it’s now conclusive that MySQL is not installed.
Q: How to check for available updates on the system?
A: yum check-update
Note: It came back including: mariadb-libs.x86_64 1:5.5.44-1.el7_1
Q: Does this mean that mariadb is somehow already installed? Note that it’s version 5.5.44 for update
A: From info within https://www.vultr.com/docs/install-mariadb-on-centos-7, “MariaDB is shipped in the CentOS repo as of CentOS 7.”
Q: Why is it that it’s on system someplace as version 5.5.37 and available update only to 5.5.44? Repo setting?
A: yum list installed mariadb returns: 1:5.5.37-1.el7_0
Note: 5.5.37 was stable release dated 2014-04-17
Note: 5.5.44 was stable release dated 2015-06-11
Note: I’m seeing that the newest stable release is dated 2015-10-12 for 5.5.46. Not sure why stopping at .44
Q: How to clean up packages
A: yum clean packages — eliminates any cached packages from the system
Note: Zero Packages removed, in my case
Q: How to ensure that MySQL or MariaDB is not installed (DBAForHire info)? Q: How to get more info on repolist? Q: How to expire cache? Q: How to check for version of MariaDB? Q: If I already have MariaDB installed (version 5.5) what is the best way to upgrade to the latest version? Q: How to check for packages (by showing a list) of things already installed on system Q: How to list information about available packages Q: What happens when I attempt to start MariaDB? Q: What is the best practice to install the software (ensuring latest version)? Q: By installing using yum, does it install the latest version, or is it a prior version re: “default yum repo”?? Q: What is procedure recommended for yum installation by MariaDB? Q: Why do I sometimes see a reference to the client (MariaDB-client) for installation? Q: How do you start the MariaDB service? Q: How do you stop the MariaDB service? Q: What are the installation procedures? # MariaDB 10.1 CentOS repository list – created 2015-11-21 02:23 UTC After the file is in place, install MariaDB with: Q: What did I do specifically for install? su – (and entered password for root) vi MariaDB.repo Note: When I had done “su -” to get privs to create the file, I had forgotten to cd into the correct directory. Resolved by entering this command which moved the file — mv MariaDB.repo /etc/yum.repos.d/ Logout (to quit out of root and back to my paul account). Doing this because the next command begins with SUDO and I’m in the SUDOERS list sudo yum install MariaDB-server MariaDB-client (to install MariaDB) 1. Contact the upstream for the repository and get them to fix the probl em. 2. Reconfigure the baseurl/etc. for the repository, to point to a workin g 3. Disable the repository, so yum won’t use it by default. Yum will then yum-config-manager –disable mariadb 4. Configure the failing repository to be skipped, if it is unavailable. yum-config-manager –save –setopt=mariadb.skip_if_unavailable=tr ue NOTE: Issue is that my CentOS Server cannot reach the IP address of: 173.203.201.148. When I do a ping within CentOS terminal it’s not reachable. When I ping within Windows7 it is reachable. Need to resolve a network issue within CentOS first. NOTE: I think I need to resolve DNS within the server su – (log in as root) NOTE: I just remembered something. I had this CentOS server configured on a different network when in Ojai. The static address on server probably needs to be changed. Currently, when I do “ip addr” it returns: [root@localhost bin]# ip addr The IP Address is 10.0.0.50. That address should still work. To verify the status of Network Manager service: To check which network interface is managed by Network Manager, run: I need to disable Network Manager — even though the ComCast router shows the Static IP of 10.0.0.50 Go to the /etc/sysconfig/network-scripts directory, and locate its configuration file (ifcfg-enp0s25) When saving, msg about multiple files, so: To the file ifcfg-enp0s25, I added a line: Confirmed within /etc/resolv.conf that I have: RESOLVED re: being able to ping out. I had made a mistake within the ifcfg-enp0s25 file. I had quotes around the IP addresses. Should be: “ip route” now works and ping google.com works! This document is useful for troubleshooting: sudo yum install MariaDB-server MariaDB-client (to install MariaDB): Was able to start and stop service: Q: How do you stop the MariaDB service? Need to address some security, I think: Logged out and logged in as root. Different error now: Ahh…. I didn’t have the service running, so: sudo systemctl start mariadb.service -Changed root password Comes back with: To get it working, now (Note: I followed this: https://www.vultr.com/docs/install-mariadb-on-centos-7) sudo systemctl start mariadb.service NOTE: I have it configured so that mariadb.service auto starts, so I only have to do the mysql -u root – p Note: To stop service: Welcome to the MariaDB monitor. Commands end with ; or \g. Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement. MariaDB [(none)]> I now have my very own MariaDB/SQL Server to play with… Q: What are some ideas for post-installation?
A: rpm -qa | grep -i mysql
Note: My response is: blank
Note: If there was anything installed you remove with: yum remove
Note: XREF to info from RedHat on listing packages – https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Listing_Packages.html
A: yum repolist
Note: Lists the repository ID, name, and number of packages it provides for each enabled repository.
Note: This was my return:
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos.den.host-engine.com
* extras: centos.den.host-engine.com
* updates: centos.den.host-engine.com
repo id repo name status
base/7/x86_64 CentOS-7 – Base 8,652
extras/7/x86_64 CentOS-7 – Extras 278
updates/7/x86_64 CentOS-7 – Updates 1,726
repolist: 10,656
A: yum clean expire-cache – which is much more efficient way to tell yum to check the repos
Note: Mine returned with:
Loaded plugins: fastestmirror
Cleaning repos: base extras updates
6 metadata files removed
A: http://ask.xmodulo.com/check-mariadb-server-version.html
A: https://mariadb.com/kb/en/mariadb/upgrading-from-mariadb-55-to-mariadb-100/
Note: There are no changes in table or index formats between MariaDB 5.5 and MariaDB 10.0, so on most servers the upgrade should be painless.
A: yum list installed
Note: It came back with: mariadb-libs.x86_64 1:5.5.37-1.el7_0
Note: This is the complete command — yum list [available|installed|extras|updates|obsoletes|all|recent] [pkgspec]
A: yum list mariadb-libs.x86_64
Note: It came back with:
Installed Packages
mariadb-libs.x86_64 1:5.5.37-1.el7_0 @updates
Available Packages
mariadb-libs.x86_64 1:5.5.44-1.el7_1 updates
A: sudo systemctl start mariadb.service
A: Failed to issue method call: Unit mariadb.service failed to load: No such file or directory.
Q: Is MariaDB installed right now, or is just the repo file that’s being listed?
A: I don’t think MariaDB is installed right now. Nothing I’ve done has conclusively shown it being installed. The software maybe available within a repo, but it’s not actually installed yet.
A: One site says to run: sudo yum install mariadb-server mariadb
A: One site says that “although at the time of writing this post, MariaDB 10.0.12 Stable release is available (Dated on 2014-06-16), yet we will install it by simply using yum command from default yum repo”
Note: That site said, after doing “yum install mariadb-server mariadb” he did “rpm -qa|grep -i maria” and reviewed the version being 5.5.37 — this was back in 2014. But, I think this is an outdated version. The current version of MariaDB is version xx.xx
Q: What happens when I run “rpm -qa|grep -i maria” on my system right now (before doing any install or upgrade)?
A: mariadb-libs-5.5.37-1.el7_0.x86_64
Note: This tells me that the CentOS 7 installation automatically included MariaDB
A: It may not be the absolute newest version of the software.
Q: What does yum repo (repository) mean?
A: Proactive downloads of various applications and updates
A: https://mariadb.com/kb/en/mariadb/yum/
Note: http://yum.mariadb.org/10.0/centos7-amd64/ is the location of the most recent version of 10. As of today (20151119) it’s 10.0.22 which matches this site that references MariaDB 10.0 series — https://downloads.mariadb.org/
Note: Looks like they are now up to MariaDB 10.1 series with 10.1.8 being stable version. I’d like to install 10.1.8
Note: yum install MariaDB-server MariaDB-client
*** A: Not sure yet.
A: sudo systemctl start mariadb.service
A: sudo systemctl stop mariadb.service
A: In order to get the latest version (10.1.8), I need to customize a repository setting on the server. I ran the Repository Configuration Tool from: https://downloads.mariadb.org/mariadb/repositories/#mirror=digitalocean-nyc By answering obvious questions CentOS; 7; 64-bit; it creates a custom config that you then create on the server
Note: In my case it responded with this:
Here is your custom MariaDB YUM repository entry for CentOS. Copy and paste it into a file under /etc/yum.repos.d/ (we suggest naming the file MariaDB.repo or something similar).
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
sudo yum install MariaDB-server MariaDB-client
A: cd /etc/yum.repos.d
vi MariaDB.repo
i (for insert mode)
# MariaDB 10.1 CentOS repository list – 20151120PG
Escape Key
:wq (Save and quit) — so that I could confirm this would save before spending too much time
Got this error:
“MariaDB.repo”
“MariaDB.repo” E212: Can’t open file for writing
:q! (which quits without saving)
vi MariaDB.repo
i (for insert mode)
# MariaDB 10.1 CentOS repository list – 20151120PG
Escape Key
:wq (Save and quit) — so that I could confirm this would save before spending too much time
ls — I see the file MariaDB.repo and I know it saved because data was there when I did another vi MariaDB.repo
i (for insert mode)
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
It returned with:
Loaded plugins: fastestmirror
base | 3.6 kB 00:00
extras | 3.4 kB 00:00
http://yum.mariadb.org/10.1/centos7-amd64/repodata/repomd.xml: [Errno 14] cur l#7 – “Failed to connect to 173.203.201.148: Network is unreachable”
Trying other mirror.
http://yum.mariadb.org/10.1/centos7-amd64/repodata/repomd.xml: [Errno 14] cur l#7 – “Failed to connect to 173.203.201.148: Network is unreachable”
Trying other mirror.
One of the configured repositories failed (MariaDB),
and yum doesn’t have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work “fix” this:
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
just ignore the repository until you permanently enable it again or u se
–enablerepo for temporary usage:
Note that yum will try to contact the repo. when it runs most command s,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a ni ce
compromise:
cd /etc
vi resolv.conf
DNS1 75.75.75.75
DNS2 75.75.76.76
nameserver 8.8.8.8
1: lo:
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s25:
link/ether 00:1e:37:8c:48:b1 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.50/24 brd 10.0.0.255 scope global enp0s25
systemctl status NetworkManager.service
Note: Shows Active and running
nmcli dev status
Note: Shows connected, which means that the output of nmcli shows “connected” for a particular interface it means that the interface is managed by Network Manager.
HWADDR=”00:1E:37:8C:48:B1″
TYPE=”Ethernet”
BOOTPROTO=”static”
IPADDR=”10.0.0.50″
NETMASK=”255.255.255.0″
NM_CONTROLLED=no
DEFROUTE=”yes”
PEERDNS=”yes”
PEERROUTES=”yes”
IPV4_FAILURE_FATAL=”no”
IPV6INIT=”yes”
IPV6_AUTOCONF=”yes”
IPV6_DEFROUTE=”yes”
IPV6_PEERDNS=”yes”
IPV6_PEERROUTES=”yes”
IPV6_FAILURE_FATAL=”no”
NAME=”enp0s25″
UUID=”f923d9cd-61e2-4c78-9e62-685685fa550a”
ONBOOT=”yes”
vi -r ifcfg-enp0s25 — it came back with a different file, so I updated with revised info
GATEWAY=10.0.0.1
nameserver 8.8.8.8
HWADDR=”00:1E:37:8C:48:B1″
TYPE=”Ethernet”
BOOTPROTO=”static”
IPADDR=10.0.0.50
NETMASK=255.255.255.0
GATEWAY=10.0.0.1
NM_CONTROLLED=no
DEFROUTE=”yes”
PEERDNS=”yes”
PEERROUTES=”yes”
IPV4_FAILURE_FATAL=”no”
IPV6INIT=”yes”
IPV6_AUTOCONF=”yes”
IPV6_DEFROUTE=”yes”
IPV6_PEERDNS=”yes”
IPV6_PEERROUTES=”yes”
IPV6_FAILURE_FATAL=”no”
NAME=”enp0s25″
UUID=”f923d9cd-61e2-4c78-9e62-685685fa550a”
ONBOOT=”yes”
http://superuser.com/questions/901672/centos-7-ping-8-8-8-8-connect-network-is-unreachable
Installed and looking good so far — version 10.1.8 being installed and a bunch of stuff re: Perl
Q: How do you start the MariaDB service?
A: sudo systemctl start mariadb.service
A: sudo systemctl stop mariadb.service
/usr/bin/mysql_secure_installation
Needs the password for root user. Not set yet, so entering blank.
Responds with error:
/usr/bin/mysql_secure_installation: line 211: .mysql.2148: No such file or directory
Enter current password for root (enter for none):
/usr/bin/mysql_secure_installation: line 240: .my.cnf.2148: Permission denied
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2 “No such file or directory”)
Enter current password for root (enter for none):
/usr/bin/mysql_secure_installation (one time, for some security stuff)
-Removed Anonymous User
-Disallow root login remotely = Yes
-Remove test database = No (I’d like to see what that is)
-Reload Privilege Tables Now – Yes
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.
sudo systemctl enable mariadb.service
systemctl is-active mariadb.service (to check it’s working) — says “active”
mysql -u root -p and entered the password I had set — It worked!!! I’m into Monitor:
sudo systemctl stop mariadb.service
Your MariaDB connection id is 8
Server version: 10.1.8-MariaDB MariaDB Server
A: Review various commands within this post — http://dbahire.com/how-to-install-mysql-5-6-on-centos-7/