MariaDB/SQL installed on CentOS 7 Server

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)?
A: rpm -qa | grep -i mysql
Note: My response is: blank
Note: If there was anything installed you remove with: yum remove

Q: How to get more info on repolist?
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

Q: How to expire cache?
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

Q: How to check for version of MariaDB?
A: http://ask.xmodulo.com/check-mariadb-server-version.html

Q: If I already have MariaDB installed (version 5.5) what is the best way to upgrade to the latest version?
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.

Q: How to check for packages (by showing a list) of things already installed on system
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]

Q: How to list information about available packages
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

Q: What happens when I attempt to start MariaDB?
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.

Q: What is the best practice to install the software (ensuring latest version)?
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

Q: By installing using yum, does it install the latest version, or is it a prior version re: “default yum repo”??
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

Q: What is procedure recommended for yum installation by MariaDB?
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

Q: Why do I sometimes see a reference to the client (MariaDB-client) for installation?
Note: yum install MariaDB-server MariaDB-client
*** A: Not sure yet.

Q: How do you start the MariaDB service?
A: sudo systemctl start mariadb.service

Q: How do you stop the MariaDB service?
A: sudo systemctl stop mariadb.service

Q: What are the installation procedures?
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).

# MariaDB 10.1 CentOS repository list – created 2015-11-21 02:23 UTC
# 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

After the file is in place, install MariaDB with:
sudo yum install MariaDB-server MariaDB-client

Q: What did I do specifically for install?
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)

su – (and entered password for root)
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

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

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)
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:

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
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).

3. Disable the repository, so yum won’t use it by default. Yum will then
just ignore the repository until you permanently enable it again or u se
–enablerepo for temporary usage:

yum-config-manager –disable mariadb

4. Configure the failing repository to be skipped, if it is unavailable.
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:

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)
cd /etc
vi resolv.conf
DNS1 75.75.75.75
DNS2 75.75.76.76
nameserver 8.8.8.8

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
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
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: mtu 1500 qdisc pfifo_fast state UP qlen 1000
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

The IP Address is 10.0.0.50. That address should still work.

To verify the status of Network Manager service:
systemctl status NetworkManager.service
Note: Shows Active and running

To check which network interface is managed by Network Manager, run:
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.

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)
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”

When saving, msg about multiple files, so:
vi -r ifcfg-enp0s25 — it came back with a different file, so I updated with revised info

To the file ifcfg-enp0s25, I added a line:
GATEWAY=10.0.0.1

Confirmed within /etc/resolv.conf that I have:
nameserver 8.8.8.8

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:
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”

“ip route” now works and ping google.com works!

This document is useful for troubleshooting:
http://superuser.com/questions/901672/centos-7-ping-8-8-8-8-connect-network-is-unreachable

sudo yum install MariaDB-server MariaDB-client (to install MariaDB):
Installed and looking good so far — version 10.1.8 being installed and a bunch of stuff re: Perl

Was able to start and stop service:
Q: How do you start the MariaDB service?
A: sudo systemctl start mariadb.service

Q: How do you stop the MariaDB service?
A: sudo systemctl stop mariadb.service

Need to address some security, I think:
/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

Logged out and logged in as root. Different error now:
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):

Ahh…. I didn’t have the service running, so:

sudo systemctl start mariadb.service
/usr/bin/mysql_secure_installation (one time, for some security stuff)

-Changed root password
-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

Comes back with:
All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

To get it working, now (Note: I followed this: https://www.vultr.com/docs/install-mariadb-on-centos-7)

sudo systemctl start mariadb.service
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:

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:
sudo systemctl stop mariadb.service

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.1.8-MariaDB MariaDB Server

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: Review various commands within this post — http://dbahire.com/how-to-install-mysql-5-6-on-centos-7/

Posted in CentOS | Leave a comment

Configuring sudo privs for user in CentOS

On home CentOS 7 Server, I created an account and now need to add sudo privs:

Note: What I’m really wanting it to have sudo access from my own account

/usr/sbin/visudo (which came back with error of — visudo: /etc/sudoers: Permission denied)
su – (followed by the pswd for root) — changes prompt from $ to #)
/usr/sbin/visudo (which now allowed me to edit /etc/sudoers file)
Then, find the following line: root ALL=(ALL) ALL — found it
Add your login so it looks like (for login “jdoe”): jdoe ALL=(ALL) ALL
Note: While in visudo — You have two “modes”
• Command mode – Press ‘ESC’ to access.
• Insert mode – Press ‘I’ to access. — I pressed “i” in order to insert a line
You’re always in one or the other.
To save and quit — :wq ; Escape; :q
Note: This was useful for the editor commands — https://maeks84.wordpress.com/2008/05/29/how-to-use-visudo/
Logout (to get out of root and back to my own account — which should now be root privs)
Tried /usr/sbin/visudo — that didn’t work and got same error as above
Completely logged out and back in again — same thing…
Note: Trying to figure out if change to give my account root privs was conclusive:
sudo -l (which should tell me if I have any sudoers privileges
It returned with: User paul may run the following commands on this host: (ALL) ALL

When trying to resolve with running visudo, it mentions a temporary file still out there:
(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use “:recover” or “vim -r /etc/sudoers.tmp”
to recover the changes (see “:help recovery”).
If you did this already, delete the swap file “/etc/.sudoers.tmp.swp”
to avoid this message.
“/etc/sudoers.tmp” 115L, 3895C
Logged in as paul and went to /etc to do an: ls .sudeoers.tmp.* — found the file (.sudoers.tmp.swp)
del .sudoers.tmp.swp (which isn’t correct command)
Note: This website shows how remove (rm) a swapfile — https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-swap-removing-file.html
Tried rm .sudoers.tmp.swp (as paul)
Couldn’t do it — permission denied. This tells me that my account (paul) doesn’t have root privs yet.
su – and logged into root
cd /etc and then ls .sudoers.tmp.swp to confirm file is still there
Tried rm .sudoers.tmp.swp (as root) — that worked…
Logged out and back into paul
[paul@localhost etc]$ /usr/sbin/visudo
visudo: /etc/sudoers: Permission denied

Logged back into root and visudo works with no msg about swap file now
Interesting — the file I opened doesn’t show a reference to paul — have to start over again.
Probably what happened is that I didn’t originally save the file correctly

Entered “i” to go into Insert Mode; then added a line; then:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
paul ALL=(ALL) ALL
:wq — which saves the changes
Confirmed by doing visudo again — saw change and no error
:q — which quits out without saving

logout — back to paul account
visudo — same error re: privs

For purposes of this exercise, I think paul does have sudo access because:
sudo -l -U paul — returns with:
User paul may run the following commands on this host:
(ALL) ALL

Note: this is specifically for editing the sudo file. Protects you from making a mistake in this file which could cause root not to be able to log in.

This site had an entry that was a very good summary — http://forums.fedoraforum.org/showthread.php?t=223742

There are the following ways that user jdoe, acting as a normal user, can execute commands requiring superuser privileges:

Log out of the desktop session, and log back in as user root, which is a VERY bad idea.
Enter “su -” and entering the superuser password.
Requires that you know the superuser’s password.
Will allow user jdoe to switch to the user root account. Once switched to user root’s account, user jdoe can execute any command as the superuser until the “exit” command is executed. Convenient when user jdoe needs to enter more than one command as the superuser.
su -c {command}
Requires that you know the superuser’s password.
Will allow user jdoe to execute the single {command} as the superuser. This sequence needs to be entered each time a command requiring superuser privileges is typed, so it is not very convenient if more than one command requiring superuser privileges needs to be executed.
sudo {command}
Requires that user jdoe be configured in the /etc/sudoers file, which can only be done by someone with superuser privileges (one of the things that justifies System Administrators, at least until we know what they know).
The /etc/sudoers file can be configured (using the visudo command) to limit the commands that user jdoe can execute using sudo, for security purposes.
Ask the System Administrator to modify the /etc/sudoers file to add privileged commands that you run often. The idea is to keep user root’s (a.k.a., the superuser) password from all but the System Administrator.
Once configured, user jdoe enters jdoe’s password (NOT the superuser password). For a period of about 5 minutes, user jdoe may execute commands normally requiring superuser privileges without being prompted for a password.

In the event that user root’s password does get out, it will not do a user any good, as we are going to lock down the use of the su command, forcing users to be in the “wheel” group before they may execute the su command. Only trusted users will be placed in the wheel group.

Each time the user issues a sudo command, this is logged. Each time a sudo command request fails, an e-mail is sent to the System Administrator. So, if a user attempts to execute commands with sudo that the user is not configured to execute, the System Administrator will know about it.

Trying now to be conclusive:

Logged in as paul
sudo /usr/sbin/visudo
Went down to the entry I had edited and rem’d it out with a #:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
## paul ALL=(ALL) ALL
:wq — which save and quits out of the file

sudo /usr/sbin/visudo
[paul@localhost ~]$ sudo /usr/sbin/visudo
paul is not in the sudoers file. This incident will be reported.
Note: This is now conclusive that my entry before (when logged into root) entered me into the sudoers list

su – (logged in as root)
/usr/sbin/visudo
i (for insert)
Went down file and removed the ## that I had added before paul
Escape Key — to get out of Insert Mode
:wq (save and quit)
logout (back to paul)

[paul@localhost ~]$ /usr/sbin/visudo
visudo: /etc/sudoers: Permission denied
Note: This makes sense — only root can do this command

[paul@localhost ~]$ sudo /usr/sbin/visudo
[sudo] password for paul:
Note: By asking and accepting the password, tells me that paul is part of sudoers and can edit file

Here’s an interesting FAQ on visudo:
http://manpages.ubuntu.com/manpages/precise/en/man8/visudo.8.html

Posted in CentOS | Leave a comment

Install McAfee Mail Security for Domino

20151012 So far so good. Downloaded the Installer, Patch2 and Hotfix files to the Server (Win Server 2008). Also reviewed the uninstallation routine for SMSDOM — should be an easy Add/Remove uninstall, and I have the manual steps to do a cross-check (within notes.ini, etc)
20151012 After many years of service, I’m now uninstalling Symantec Mail Security for Domino and SEP for Windows and SEP for Mac. Product is going end-of-life. Switching over to McAfee. Read all documentation and about to do download and the begin with the uninstall of SMSDOM on Domino

Posted in Lotus Notes | Leave a comment