Category Archives: CentOS

Trac installation on Home CentOS Server

Desired Outcome
At home, I have a CentOS7 Server which has Apache and MariaDB installed. Objective is to install Trac. Using this method, I learn how to integrate Python and am not limited with installing on 1and1. Trac references Subversion, which is an Apache Project, so this platform I’m using makes sense to work with.

Q: What do I know so far?
A: On my Centos7 Server at home, it’s functioning with: Apache, MariaDB, Python. The Apache welcome page looks OK.
Note: CentOS is version — 7.xx
Note: MariaDB is version — Server version: 10.1.8
Note: Apache is version — Apache Tomcat/8.0.28
Note: Python is version — xxx

Q: What I unsure of so far?:
A: Understanding of the foundation, workings and principles of Python
Note: I’ve done a good job so far of “winging it” with the installation by following directions, but now need a deeper understanding of Python.

Q: What am I now sure of so far?:
Q: If Python is installed, or maybe the wrong version.
A: 20160420 Python was already installed and is version 2.7.5
Q: What is setuptools?
A: setuptools is installed – setuptools is a fully-featured, actively-maintained, and stable library designed to facilitate packaging Python projects.
Q: If there is a SQL database created and connected to MariaDB.
A: There is no specific database created yet for Trac and I need to configure connectors between Python and MariaDB

Q: What is the internal web-site for accessing the Apache Server?
A: http://10.0.0.50:8080/

Q: What is Trac’s main web-site for downloading, documentation etc?
A: https://trac.edgewall.org/

Q: What is the main site for installation?
A: https://trac.edgewall.org/wiki/TracInstall

Q: What is reference for installing Trac on CentOS?
A: https://www.madboa.com/geek/trac-centos/

Q: What components needed for Trac?
A: Python Programming Language, SQL Database (MariaDB), Genshi Template System for HTML rendering

Q: What are the high-level installation stages to address for installation of Trac?
A: Installation Steps:
Dependencies
Mandatory Dependencies
Optional Dependencies
Installing Trac
Using easy_install
Using pip
From source
Using installer
Using package manager
Advanced easy_install Options
Creating a Project Environment
Deploying Trac
Running the Standalone Server
Running Trac on a Web Server
Configuring Authentication
Granting admin rights to the admin user
Finishing the install
Enable version control components
Using Trac

======================================
Installation Notes — Newest to oldest
======================================

20160422 Project on hold while I review the Python docs to understand Python better.

20160422 Configuring the MariaDB to Python
Summary so far: So far, I’m underwhelmed by the various documentation to follow. I have no real idea of what to do next. I’ve surmised that I needed to at least install Trac in order to use that to configure other things, scripts, etc. Now that Trac is installed, I’ll go back to the MariaDB connector to Python documentation.
Q: How do I connect Python to MariaDB?
Note: I’ve learned so far that Python is the main application that connects everything — MariaDB, Apache, Trac, etc
A: https://mariadb.com/blog/how-connect-python-programs-mariadb for instructions
Q: How do I create a database? It said if I don’t have a database to play with, I could use employees, but I’d like to focus on getting Trac working
A: Within MariaDB: create database ;
Q: What did I enter?
A: create database trac01;
A: show databases; — displayed my new trac01 database
Q: Did I install the MySQL Python Package?
A: Yes — version 1.2.3.
Note: To connect to MariaDB using the MySQL Python module in your program, you have to import it first, just as you would any other module.
Q: Which system do you work in to make this connection?
A: I have no clue. MariaDB? Python? Trac?
Q: What does: For clarity and ease of use, import the connector class only under the name mariadb: import mysql.connector as mariadb – mean? where?
A: I have no freakin’ clue — which system?
A: I’m thinking everything should be from within Python because of this: Here is everything you need to know about connecting to MariaDB from Python for retrieving, updating, and inserting information. “from Python”
A: I think I’m understanding something — Python is an interpreter, that will lose stuff soon as you quit out of Python. In order to “remember” you write scripts that are like modules that you run within Python.
Note: The file name (ie module) is a filename with an extension of .py
Q: For initial testing purposes, before getting too deep into Trac, maybe I should use the employees database
A: Good idea
Q: How do I create a username and password for accessing the employees database?
Note: This connector between Python and MariaDB is MySQLdb
Note: MySQLdb is an interface to the popular MySQL database server for Python
Q: How do I know if MySQLdb is running? Is it something that has to run?
A:
Note: This is a User Guide to review – http://mysql-python.sourceforge.net/MySQLdb.html
Q: How to give privs to the employees database to the user root?
Note: From within MariaDB:
A: GRANT ALL ON employees.* to root@localhost; (Giving privs to root to the database)
Q: How do I make a connection between Python and MariaDB?
Note: There are a couple basic commands, for the simplest database connection:
import _mysql
db=_mysql.connect(“localhost”,”root”,”root”,”employees”) – in this case the user and pswd is root and the database is employees
REALIZATION: I’m over my head right now trying to do advance connections between Python and MariaDB, when I don’t understand the basic workings of Python yet, so…. I’m going to pause on this Trac project and go thru some Python documentation and learnings.

20160421 Installing Trac. Note: I’m installing, not configuring yet…
A: How to install Trac?
Q: Logged in as root: easy_install Trac==1.0
Note: This happened after running the install command:
Searching for Trac==1.0
Reading https://pypi.python.org/simple/Trac/
Best match: Trac 1.0
Downloading https://pypi.python.org/packages/source/T/Trac/Trac-1.0.zip#md5=3dd2e883179879c8fa5b98c984f15058
Processing Trac-1.0.zip
Writing /tmp/easy_install-ouVGSP/Trac-1.0/setup.cfg
Running Trac-1.0/setup.py -q bdist_egg –dist-dir /tmp/easy_install-ouVGSP/Trac-1.0/egg-dist-tmp-Znkclu
Adding Trac 1.0 to easy-install.pth file
Installing trac-admin script to /usr/bin
Installing tracd script to /usr/bin

Installed /usr/lib/python2.7/site-packages/Trac-1.0-py2.7.egg
Processing dependencies for Trac==1.0
Finished processing dependencies for Trac==1.0

20160421 What haven’t I done so far, before installing Trac?:
Q: What’s the to-do list so far?
A: Create a database; make a connection between Python and MariaDB; make a connection between Python and Apache

20160421 Trac and ModPython
Q: What is that?
A: Mod_python is an ​Apache module that embeds the Python interpreter within the server, so that web-based applications in Python will run many times faster than traditional CGI and will have the ability to retain database connections. Trac supports ​mod_python, which speeds up Trac’s response times considerably, especially compared to CGI, and permits use of many Apache features not possible with tracd/mod_proxy.
Q: Where do I go for configuration information?
A: https://trac.edgewall.org/wiki/TracModPython

20160421 WebServer for Trac
Q: Does Trac have a built-in webserver
A: Yes
Q: Can I use Apache instead, seeing as I went out of my to install it?
A: Yes
Q: What do I need to do to connect Apache with Trac?
A: https://trac.edgewall.org/wiki/TracModWSGI (An Apache module for running WSGI-compatible Python applications directly on top of the Apache webserver. The mod_wsgi adapter is written completely in C and provides very good performance)
Note: Documentation is talking about work with scripts that are created by trac_admin — this infers that I need to first install Trac

20160421 Optional dependencies — subversion, etc
Q: Can I wait on installing and configuring subversion among other things
A: Yes — so I’m waiting… Right now I’m dealing with Python, eggs, scripts…
Note: Go back to the original installer document to see if there are other add-ons to add

20160421 Create a connection between Python and MariaDB?
Q: How do I create the connection — meaning, installing the software first?
A: Follow instructions within the MySQL Python package, which is not auto-installed with Python
Note: https://pypi.python.org/pypi/MySQL-python
Note: This site throws to me an index of three possible packages to download — I have no idea what’s next…
Q: How do check the repolist for files in the repository?
A: yum repolist (Note: This confirms that base is CentOS7
Q: How do I check if MySQL-python (case sensitive) is installed?
A: yum search MySQL-python (Note: It showed that xx could be downloaded
========================== N/S matched: MySQL-python ===========================
MySQL-python.x86_64 : An interface to MySQL (Note: The 64 shows that it’s found 64-bit, I think
Q: How to install MySQL-python?
A: yum install MySQL-python
Q: Which version did it install?
A: Installed: MySQL-python.x86_64 0:1.2.3-11.el7 (Note: Looks like version 1.2.3)
Note: The latest version is 1.2.5, but maybe that’s what is compatible with my current system
Q: When it says, within https://mariadb.com/blog/how-connect-python-programs-mariadb, to “connect to MariaDB using the MySQL Python module in your program, you have to import it first, just as you would any other module.” — I’m thinking the program is Trac (which I haven’t installed yet).
Note: I have MariaDB installed, Python, the connector between Python and MariaDB. Now I need a program (Trac)

20160421 Reviewing the MariaDB site re: How to connect Python programs to MariaDB
Q: What is the web-site for review?
A: https://mariadb.com/blog/how-connect-python-programs-mariadb
Note: You can use the popular programming language Python to manage data stored in MariaDB. Here is everything you need to know about connecting to MariaDB from Python for retrieving, updating, and inserting information.

20160420 What is the outcome of reviewing a need for: 64bits of MySQLdb here: www.codegood.com/archives/129 ?
Note: Looks like I have 64-bit Python, so need to take that into consideration

20160420 MySqlDB page referenced prior to creating database (given the caveats and known issues surrounding MySQL)
XREF: https://sourceforge.net/projects/mysql-python/
Q: What information is within this page?
A: The following reference material:
MySQLdb is a Python DB API-2.0-compliant interface; see PEP-249 for details. For up-to-date versions of MySQLdb, use the homepage link – https://github.com/farcepest/MySQLdb1
Supported versions:
* MySQL versions from 3.23 to 5.5; 5.0 or newer recommended. MariaDB should also work.
* Python versions 2.4-2.7; Python 3 support coming soon.
ZMySQLDA is a Database Adapter for Zope2.
Q: Any additional comments?
A: Yes — regarding bitness of Python
This is good for 32bits of Python, but not for 64bits of Python! If you installed 64bits of Python (not 64/32bits of OS), you may want to download the 64bits of MySQLdb here: www_codegood_com/archives/129 I wasted over 1 hour to solve this UnicodeDecodeError (64bits Python + 32bits MySQLdb), and hope to save your time.
Q: What bitness of Python is installed? Note: Hope I’m on the correct path here…
A: Followed these procedures – https://docs.python.org/2/library/platform.html
python (to go into Python)
platform.architecture(executable=sys.executable, bits=”, linkage=”)
Note: It responded with: (’64bit’, ‘ELF’)
Note: Looks like I have 64-bit Python installed.

20160420 Existence of any databases currently within MariaDB
Q: How can I check if there are any databases currently in MariaDB.
Note: The Trac documentation keeps mentioning stuff to review “before” creating a database
A: Go into SQL monitor and type “show databases”
Note: It came back with the following, which I don’t remember creating – these databases are in documentation
information_schema
mysql
performance_schema
test

20160420 SQL Database System (Note: I’m going to use MariaDB)
Q: What version of MariaDB is OK?
A: MariaDB, version 5.0 or later (Note: Trac works well with MySQL, provided you follow the guidelines)
Q: What version of MariaDB do I currently have installed?
A: Server version: 10.1.8
Q: How do I confirm MariaDB (mysqld) is running?
A: systemctl status mysqld.service
Q: How do I confirm MariaDB (service) is running?
A: systemctl is-active mariadb.service
Q: How do you launch the SQL Monitor? (NOTE: Password is what I specifically created)
A: mysql -u root -p

20160420 Pip
Q: What is Pip?
A:

20160420 Installation of Genshi (Note: I need version >= 0.6)
Q: What is Genshi?
A: Genshi is a template engine for XML-based vocabularies written in Python. Genshi is used to easily insert generated output into XML-based languages, usually HTML, and reuse elements between documents. Genshi’s syntax is based on Kid, but its architecture is different.
Q: How do I know if Genshi is already installed?
A: This is a tricky one. If I do (at root): yum list python-genshi* it responds with: python-genshi.x86_64 0.5.1-7.1.el6 ol6_latest
Note: I’m not sure if this is actually downloaded or just available for download
A: If I go into the directory: /lib/python2.7/site-packages I don’t see python-genshi*
A: If I do a: yum list installed python-gen* — it comes back with packages not installed
Q: How do I install Genshi? Because I have easy_install I can do this:
A: easy_install Genshi
Note: It came back with:
Installed /usr/lib/python2.7/site-packages/Genshi-0.7-py2.7-linux-x86_64.egg
Processing dependencies for Genshi
Finished processing dependencies for Genshi
Note: Within site-packages I now see: Genshi-0.7-py2.7-linux-x86_64.egg

20160420 Installation of: setuptools 20.9.0
Note: setuptools could already be installed – I read that installing Python auto-installs setuptools
Q: How to check if setuptools is already installed?
A: Various commands done at the console, logged in as root (su -)
which easy_install
Response was: /bin/easy_install (which is the path for setuptools, if it was installed)
less /bin/easy_install (which opens up a script with various references to Python)
Summary: Based on the script, I believe that setuptools is already installed.
Q: Where is the documentation for easy_install?
A: http://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations
Q: Where is the location easy_install uses to download packages?
A: On console: python -m site –user-site
A: Responds with: /root/.local/lib/python2.7/site-packages
Note: When I went into this directory — /lib/python2.7/site-packages — there were a bunch of files including: setuptools, easy_install, etc…
Q: How do I know I have minimum version installed (which is >= 0.6)?
A: Within the site-packages directory was: setuptools-0.9.8-py2.7.egg-info, so I think I’m OK

20160418 Check to see if Python is already installed
Note: Enter “python” at CentOS prompt
Answer: This is what came back, so looks like Python is installed
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Note: While Python 3.x is available, looks like Trac wants to use version < 3.x 20160418 This installation for Trac is going to be a complete dare. First up for installation is Python. Note: ​Python, version ≥ 2.5 and < 3.0 (note that we dropped the support for Python 2.4 in this release) Q: What are mandatory dependencies? - https://trac.edgewall.org/wiki/TracInstall#Dependencies: A: Looks like: Python, SetupTools, Genshi, SQL Database (MariaDB) and corresponding Python bindings A: Optional, but looks interesting, is Subversion A: A web-server is optional, and Trac has one built-in, but I can make it work with Apache that is installed A: There are a bunch of other optional things to do with wikis, etc -- will get to that in time. Q: What permissions needed to install Trac? A: It is assumed throughout this guide that you have elevated permissions as the root user, or by prefixing commands with sudo. The umask 0022 should be used for a typical installation on a Unix-based platform.

Apache HTTPD installed on same server as Apache Tomcat

Desired Outcome
Install Apache HTTPD on same server as Apache Tomcat, so I can then get PHP working on HTTPD including SugarCRM. Also, it can be configurd so that the HTTP and Tomcat servers talk to each and pass the applicable requests back and forth.
XREF to this document — http://linux-sxs.org/internet_serving/tomcat-apache.html

Note: I’m going to put this project down as Someday/Maybe because there are many things to learn with my current setup, before going down path of adding another module.

firewalld – understanding within Centos7

Desired Outcome:

Understanding all CLI commands and features of firewalld (which replaced iptables)

XREF to this for info:
https://oracle-base.com/articles/linux/linux-firewall-firewalld#firewall-cmd

Error I’m working with:
firewall-cmd –zone=public –list-services
ERROR:dbus.proxies:Introspect error on :1.4:/org/fedoraproject/FirewallD1: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type=”method_call”, sender=”:1.21″ (uid=1000 pid=2418 comm=”/usr/bin/python -Es /usr/bin/firewall-cmd –zone=p”) interface=”org.freedesktop.DBus.Introspectable” member=”Introspect” error name=”(unset)” requested_reply=”0″ destination=”:1.4″ (uid=0 pid=618 comm=”/usr/bin/python -Es /usr/sbin/firewalld –nofork -“)
Error: Rejected send message, 1 matched rules; type=”method_call”, sender=”:1.21″ (uid=1000 pid=2418 comm=”/usr/bin/python -Es /usr/bin/firewall-cmd –zone=p”) interface=”org.fedoraproject.FirewallD1.zone” member=”getServices” error name=”(unset)” requested_reply=”0″ destination=”:1.4″ (uid=0 pid=618 comm=”/usr/bin/python -Es /usr/sbin/firewalld –nofork -“)

Answer to above error — when working with firewalld, be root (or su -)

Java JDK and Apache Tomcat installed on Centos7

Desired Outcome:
Get phpMyAdmin functioning on Centos7 Server, which would include things like Apache Tomcat and PHP

Modified Desired Outcome — now I’m finding that Apache Tomcat is more in line with Java development vs PHP. Strategically, people use HTTPD (Apache) port 80 for web and php stuff and have HTTPD forward Java/JSP stuff over to Tomcat (port 8080). This means that, for now, the Apache Tomcat and Java Project is concluded. I need to resolve how I’m going to get Apache HTTPD running – on same server as Tomcat? I’d like to be running PHP apps like SugarCRM — XREF to http://wiki.apache.org/tomcat/UsingPhp

General overview of project, from perspective of phpMyAdmin, is:
phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. phpMyAdmin supports a wide range of operations on MySQL and MariaDB. Frequently used operations (managing databases, tables, columns, relations, indexes, users, permissions, etc) can be performed via the user interface, while you still have the ability to directly execute any SQL statement.

Note: This document is getting too long — covering Java, Apache, Firewalld. Will break up the rest (php, phpMyAdmin) on another post.

Q: Where is the mail web-site for go-to information (manuals, FAQ, etc)?
A: https://www.phpmyadmin.net/
A: For documentation — http://docs.phpmyadmin.net/en/latest/
A: For Apache Tomcat installers — http://tomcat.apache.org/download-80.cgi

Q: What are the main components needed for installation?
A: http://docs.phpmyadmin.net/en/latest/require.html – List of requirements with details
Note: Summary of various components to install is:
OK -Java Installation
Note: Tomcat requires that Java is installed on the server, so any Java web application code can be executed. Let’s satisfy that requirement by installing OpenJDK 7 with yum.
OK -Web Server — I’m going to use Apache Tomcat because it’s closest to LongJump Infrastructure and uses Java
Note: Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation.
Note: Details about Apache Tomcat 8 – http://tomcat.apache.org/tomcat-8.0-doc/index.html
Note: https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-centos-7
-php 5.5 or newer
-MariaDB 5.5 or newer (Note: I already have this installed)
-phpMyAdmin — Which is installed into Web-Server
-Web Browser (eg FireFox) to interact with phpMyAdmin on Web-Server, with cookies and JavaScript enabled

Q: Are there any pre-requisite things to do on server before proceeding (ie server updates, etc)?
A: Didn’t have to, but I’m sure I need to be doing updates at some point.

Installation Notes:

Java installation

Q: How do I know I don’t already have Java installed? – Summary: I don’t.
A: java -version
Note: -bash: java: command not found – not installed
A: javac
Notes: -bash: javac: command not found
A: locate jdk or locate java – to see if you have the java binary. Don’t forget to run updatedb if you are using locate for the first time.
Note: Additional info on locate and updatedb – http://www.liquidweb.com/kb/how-to-install-mlocate-locate-and-updatedb-commands-on-centos-7/
Note: Initially blank for both “locate jdk” and “locate java”
Note: When I ran “updatedb or sudo updatedb” there was no command
NOTE: For now, I’m moving on from locate, but I’ll circle back after and review the document link
A: which java
Note: /usr/bin/which: no java in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/paul/.local/bin:/home/paul/bin) — this is the most conclusive response so far re: is Java installed or not
A: sudo aptitude search Note: This is for checking any package, whether installed or not
A: sudo aptitude search jdk
Note: The key is to look for the symbol “small letter i” to the left — means that it’s installed
EG: rpm -qa Maria*
Returns this:
[paul@localhost ~]$ rpm -qa Maria*
MariaDB-shared-10.1.8-1.el7.centos.x86_64
MariaDB-common-10.1.8-1.el7.centos.x86_64
MariaDB-client-10.1.8-1.el7.centos.x86_64
MariaDB-server-10.1.8-1.el7.centos.x86_64
A: yum list jdk
Note: Returns if installed or available – not installed

Q: How do I know I’m getting the correct and latest version of Java?
Note: I was advised to do “sudo yum install java-1.7.0-openjdk-devel” – OpenJDK 7 JDK
Note: Info on various version of JDK – http://openjdk.java.net/install/
Note: For building Tomcat 8, JDK 7 is fine – https://tomcat.apache.org/tomcat-8.0-doc/building.html

Q: Where do I get the software from?
A: sudo yum install java-1.7.0-openjdk-devel
Note: I went to the JDK site and it gives me more info on options – http://openjdk.java.net/install/index.html
JDK7 – Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.
On the command line, type:
$ su -c “yum install java-1.7.0-openjdk”
The java-1.7.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.7.0-openjdk-devel package.
Q: Before installing Java, is this folder existing — /usr/lib/jvm/jre
A: No

Q: What steps to install and configure for Java?
A: sudo yum install java-1.7.0-openjdk-devel

Q: Quick aside — how to verify available disk space?
A: df -h (the -h means human readable) — I’m OK

Q: How to verify Java installed?
A: java -version
java version “1.7.0_91”
OpenJDK Runtime Environment (rhel-2.6.2.1.el7_1-x86_64 u91-b00)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)
A: which java
/usr/bin/java
A: rpm -qa java*
java-1.7.0-openjdk-devel-1.7.0.91-2.6.2.1.el7_1.x86_64
javapackages-tools-3.4.1-6.el7_0.noarch
java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.1.el7_1.x86_64
java-1.7.0-openjdk-1.7.0.91-2.6.2.1.el7_1.x86_64
A: yum list java*
Installed Packages
java-1.7.0-openjdk.x86_64 1:1.7.0.91-2.6.2.1.el7_1 @updates
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.91-2.6.2.1.el7_1 @updates
java-1.7.0-openjdk-headless.x86_64 1:1.7.0.91-2.6.2.1.el7_1 @updates
javapackages-tools.noarch 3.4.1-6.el7_0 @base

Create a user for Tomcat
Note: For security purposes, Tomcat should be run as an unprivileged user (i.e. not root). We will create a new user and group that will run the Tomcat service.

Q: How to create a group and a user for Tomcat?
A: sudo groupadd tomcat
Q: How to list all groups, including one I just created?
A: cut -d: -f1 /etc/group
Q: How do you create a new user and add to a group?
Note: We’ll make this user a member of the tomcat group, with a home directory of /opt/tomcat (where we will install Tomcat), and with a shell of /bin/false (so nobody can log into the account):
A: sudo useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat

Install Tomcat webserver

Q: How to find the latest version of Tomcat?
A: http://tomcat.apache.org/download-80.cgi
Note: Answer is: 8.0.28
Q: How to find the file?
A: Under the Binary Distributions section, then under the Core list, copy the link to the “tar.gz”.
Note: http://www.us.apache.org/dist/tomcat/tomcat-8/v8.0.28/bin/apache-tomcat-8.0.28.tar.gz
Q: How to download the latest binary distribution to our home directory.
A: Go to Home by entering: cd~
Note: I entered pwd (Print Working Directory) and got: \home\paul
Q: How to download the file to the server?
A: wget http://www.us.apache.org/dist/tomcat/tomcat-8/v8.0.28/bin/apache-tomcat-8.0.28.tar.gz
ISSUE: I don’t think wget is installed yet as that command didn’t work
Q: How to check to see if wget is installed?
A: rpm -q wget
package wget is not installed
Q: How to install wget?
A: sudo yum install wget
Installed:
wget.x86_64 0:1.14-10.el7_0.1
Q: How to check is wget is installed (triple-checking)”
A: rpm -q wget
wget-1.14-10.el7_0.1.x86_64
Q: How to download the file to the server? Now that I have wget installed.
A: wget http://www.us.apache.org/dist/tomcat/tomcat-8/v8.0.28/bin/apache-tomcat-8.0.28.tar.gz
Wow… that was fast to download – only 8.7MB

How to create the directory for tomcat and install the software?
Q: How to create the directory that I’ll install tomcat into?
Note: We’re going to install Tomcat to the /opt/tomcat directory. Create the directory, then extract the archive to it with these commands:
A: sudo mkdir /opt/tomcat

Q: How to install tomcat?
A: sudo tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat –strip-components=1

Q: How to setup permissions?
Note: The tomcat user that we set up needs to have the proper access to the Tomcat installation. We’ll set that up now.
A: Change to the Tomcat installation directory with: cd /opt/tomcat
Note: We will give the tomcat user write access to the conf directory, and read access to the files in that directory.
A: sudo chgrp -R tomcat conf
A: sudo chmod g+rwx conf
A: sudo chmod g+r conf/*

Q: How to give tomcat user have access to various directories — tomcat user the owner of the webapps, work, temp, and logs directories
A: sudo chown -R tomcat webapps/ work/ temp/ logs/

How to create a systemd unit file — nearly there
Note: Because we want to be able to run Tomcat as a service, we will set up a Tomcat Systemd unit file.
Q: How to create and open the new unit file?
A: sudo vi /etc/systemd/system/tomcat.service
Note: Will paste in this content and there is a note about: You may also want to modify the memory allocation settings that are specified in CATALINA_OPTS. Will come back to that.
Note: Here’s what I pasted in:
# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment=’CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC’
Environment=’JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom’

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target

NOTE: I had made some mistakes when creating the file initially, after pasting — somehow removed the first lines “#” character. To save initially, I went out of Insert Mode with the Escape Key and did: wq!
Because it ends up being a read only file, I had to edit and save as root
su –
vi xxxx — directory and file name
Insert
Make the correction
Escape
:wq!

Note: The script above tells the server to run the Tomcat service as the tomcat user, with the settings specified.

Reloading and starting the webserver

Q: How do I reload Systemd to load the Tomcat unit file?
A: sudo systemctl daemon-reload

Q: How do I check to see what services are running right now, before loading a new service?
A: service –status-all
NOTE: When I did that there was a reference to an error with MySQL — maybe this will be fixed soon…
ERROR! MySQL is running but PID file could not be found
netconsole module not loaded
Configured devices:
lo enp0s25
Currently active devices:
lo enp0s25

Q: How to I start the Tomcat service with this systemctl command?
A: sudo systemctl start tomcat

Q: How to load automatically on server boot?
A: sudo systemctl enable tomcat

Q: How to access the webserver as an interim step?
A: From a web-browser: http://10.0.0.50:8080
Note: Not working – timing out

Q: How to check which version of Tomcat installed.
Note: You have to be in the install directory (/opt/tomcat directory first)
[paul@localhost tomcat]$ java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/8.0.28
Server built: Oct 7 2015 18:25:21 UTC
Server number: 8.0.28.0
OS Name: Linux
OS Version: 3.10.0-123.9.3.el7.x86_64
Architecture: amd64
JVM Version: 1.7.0_91-mockbuild_2015_10_21_20_22-b00
JVM Vendor: Oracle Corporation

NOTE: Looks like the “netstat” command in Centos7 has been deprecated. Now need to use “ss”
ss -tpln (Note that it finds port 8080 in listen mode)

State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 1 ::ffff:127.0.0.1:8005 :::*
LISTEN 0 100 :::8009 :::*
LISTEN 0 80 :::3306 :::*
LISTEN 0 100 :::8080 :::*
LISTEN 0 128 :::22 :::*

NOTE: I think the issue is that the JAVA_HOME path within the tomcat.service file is not actually pointing to where Java is installed.

Q: Where do I think Java is installed?
A: /usr/lib/jvm/jre-1.7.0-openjdk-1.7.0.91-2.6.2.1.el7_1.x86_64

Q: What change made to tomcat.service file?
A: sudo vi /etc/systemd/system/tomcat.service
Was: Environment=JAVA_HOME=/usr/lib/jvm/jre
Now: Environment=JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk-1.7.0.91-2.6.2.1.el7_1.x86_64

Restart Daemon with: sudo systemctl daemon-reload

Restart tomcat with: sudo systemctl start tomcat

Changed tomcat.service file again
Was: Environment=JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk-1.7.0.91-2.6.2.1.el7_1.x86_64
Now: Environment=JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk
NOTE: I think this Java setting is correct as Apache Tomcat worked when I turned off the firewall

No change.

While Port 8080 is listening, I’m wondering if a firewall port still has to be addressed.
Note: Formerly iptables and in Centos7 it’s firewalld
XREF to: https://fedoraproject.org/wiki/FirewallD

Q: Is Firewalld running?
Note: Key info on firewalld — https://oracle-base.com/articles/linux/linux-firewall-firewalld
A: systemctl status firewalld
Yes

WOW!!! This install is insane, but forcing me to learn a ton…

Firewall Configuration:

Note: I had a hunch that everything was working, but the CentOS Server firewall was blocking port 8080
Note: Did this command, which temporarily stops the firewall — systemctl stop firewalld
From a browser: http://10.0.0.50:8080 — it works and shows the Tomcat splash screen
If you’re seeing this, you’ve successfully installed Tomcat. Congratulations!

Note: Obviously, it’s not good to have the firewall shutdown, but at least I know that Java and Tomcat are functioning. This post at the end alluded to stopping the firewall, which gave me the idea — https://www.centos.org/forums/viewtopic.php?t=2532

Q: How do I change firewall port via CLI — Note: I need to come back to firewalld and learn more about this
A: firewall-cmd –zone=public –add-port=8080/tcp –permanent
Note: Maybe not good to have done this

Note: Firewalld service can be stopped, but issues starting, for some reason

Q: What is command to review log?
A: journalctl -xn

Note: this is not really pointing to anything

— Logs begin at Mon 2015-11-23 22:14:45 PST, end at Tue 2015-11-24 10:25:06 PST
Nov 24 10:25:06 localhost.localdomain NetworkManager[744]: preferred_lf
Nov 24 10:25:06 localhost.localdomain NetworkManager[744]: address 2601
Nov 24 10:25:06 localhost.localdomain NetworkManager[744]: nameserver ‘
Nov 24 10:25:06 localhost.localdomain NetworkManager[744]: nameserver ‘
Nov 24 10:25:06 localhost.localdomain dbus[630]: [system] Activating via systemd
Nov 24 10:25:06 localhost.localdomain dbus-daemon[630]: dbus[630]: [system] Acti
Nov 24 10:25:06 localhost.localdomain systemd[1]: Starting Network Manager Scrip
— Subject: Unit NetworkManager-dispatcher.service has begun with start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

— Unit NetworkManager-dispatcher.service has begun starting up.
Nov 24 10:25:06 localhost.localdomain dbus-daemon[630]: dbus[630]: [system] Succ
Nov 24 10:25:06 localhost.localdomain dbus[630]: [system] Successfully activated
Nov 24 10:25:06 localhost.localdomain systemd[1]: Started Network Manager Script
— Subject: Unit NetworkManager-dispatcher.service has finished start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

— Unit NetworkManager-dispatcher.service has finished starting up.

— The start-up result is done.
lines 1-23/23 (END)

Maybe it wasn’t a good idea to have entered this — firewall-cmd –zone=public –add-port=8080/tcp –permanent
I think I had issues after that where the firewalld will not start up again

Note: This is a dump from firewalld after attempting to start:

[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl start firewalld.service
Job for firewalld.service failed. See ‘systemctl status firewalld.service’ and ‘journalctl -xn’ for details.
[root@localhost ~]# journalctl -xn
— Logs begin at Mon 2015-11-23 22:14:45 PST, end at Tue 2015-11-24 10:25:06 PST
Nov 24 10:25:06 localhost.localdomain NetworkManager[744]: preferred_lf
Nov 24 10:25:06 localhost.localdomain NetworkManager[744]: address 2601
Nov 24 10:25:06 localhost.localdomain NetworkManager[744]: nameserver ‘
Nov 24 10:25:06 localhost.localdomain NetworkManager[744]: nameserver ‘
Nov 24 10:25:06 localhost.localdomain dbus[630]: [system] Activating via systemd
Nov 24 10:25:06 localhost.localdomain dbus-daemon[630]: dbus[630]: [system] Acti
Nov 24 10:25:06 localhost.localdomain systemd[1]: Starting Network Manager Scrip
— Subject: Unit NetworkManager-dispatcher.service has begun with start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

— Unit NetworkManager-dispatcher.service has begun starting up.
Nov 24 10:25:06 localhost.localdomain dbus-daemon[630]: dbus[630]: [system] Succ
Nov 24 10:25:06 localhost.localdomain dbus[630]: [system] Successfully activated
Nov 24 10:25:06 localhost.localdomain systemd[1]: Started Network Manager Script
— Subject: Unit NetworkManager-dispatcher.service has finished start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

— Unit NetworkManager-dispatcher.service has finished starting up.

— The start-up result is done.

[root@localhost ~]# firewall-cmd –zone=public –add-port=8080/tcp –permanent
success
[root@localhost ~]# systemctl status firewalld
firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: failed (Result: timeout) since Tue 2015-11-24 10:24:54 PST; 13min ago
Main PID: 7724
CGroup: /system.slice/firewalld.service

Nov 24 10:24:53 localhost.localdomain systemd[1]: firewalld.service operation…
Nov 24 10:24:54 localhost.localdomain systemd[1]: Failed to start firewalld -…
Nov 24 10:24:54 localhost.localdomain systemd[1]: Unit firewalld.service ente…
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl status firewalld
firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: failed (Result: timeout) since Tue 2015-11-24 10:24:54 PST; 14min ago
Main PID: 7724
CGroup: /system.slice/firewalld.service

Nov 24 10:24:53 localhost.localdomain systemd[1]: firewalld.service operation…
Nov 24 10:24:54 localhost.localdomain systemd[1]: Failed to start firewalld -…
Nov 24 10:24:54 localhost.localdomain systemd[1]: Unit firewalld.service ente…
Nov 24 10:38:52 localhost.localdomain systemd[1]: Stopped firewalld – dynamic…
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl start firewalld.service
Job for firewalld.service failed. See ‘systemctl status firewalld.service’ and ‘journalctl -xn’ for details.
[root@localhost ~]# firewall-cmd –zone=public –add-port=8080/tcp –permanent^C
[root@localhost ~]#

systemctl status firewalld (Checking status of firewalld)
firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: failed (Result: timeout) since Tue 2015-11-24 10:40:35 PST; 4h 28min ago
Main PID: 8987
CGroup: /system.slice/firewalld.service

Nov 24 10:40:34 localhost.localdomain systemd[1]: firewalld.service operation timed out…g.
Nov 24 10:40:35 localhost.localdomain systemd[1]: Failed to start firewalld – dynamic f…n.
Nov 24 10:40:35 localhost.localdomain systemd[1]: Unit firewalld.service entered failed…e.
Hint: Some lines were ellipsized, use -l to show in full.

Dissecting this firewall command

firewall-cmd –zone=public –add-port=8080/tcp –permanent

firewall-cmd –list-all
Shows the 8080 rule within Public (That makes sense)

–add-port=[-]/ Add the port for a zone [P] [Z] [T]
–remove-port=[-]/ Remove the port from a zone [P] [Z]
–query-port=[-]/ Return whether the port has been added for zone [P] [Z]

firewall-cmd –query-port=8080/tcp
Returns with: yes

firewall-cmd –remove-port=8080/tcp
Success – 8080 not there anymore
Note: This means I’ve now reversed what I had CLI’d into the firewall

Having now manually removed what I did manually (the 8080 rule), stopping and starting firewalld still gives error.

Shutdown (restarted) server
A: shutdown -r now

Note: Didn’t quite get to root of it, but firewalld is running now without error:
systemctl status firewalld
firewalld.service – firewalld – dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: active (running) since Tue 2015-11-24 15:33:41 PST; 1min 28s ago
Main PID: 618 (firewalld)
CGroup: /system.slice/firewalld.service
ââ618 /usr/bin/python -Es /usr/sbin/firewalld –nofork –nopid

And, of course, I tried //http://10.0.0.50:8080/ and it loaded fine.

Finishing up the Tomcat installation

Note: I noticed that while I have a web-page with Tomcat showing, I need a user account to log-in with

Q: How do I create an account so I can use the manager webapp that comes with Tomcat. Need to add a login to the Tomcat server.
A: sudo vi /opt/tomcat/conf/tomcat-users.xml (Edit this file)
Note: Need to add a user who can access the manager-gui and admin-gui (webapps that come with Tomcat). You can do so by defining a user similar to the example below. Be sure to change the username and password to something secure:
A: Kept the various comments in for reference and added this entry:



Note:
Save and quit — :wq (used root)
Restart the Tomcat service — sudo systemctl restart tomcat

How to I access/reaccess browser — in my case I just refreshed my web-page via Firefox
http://10.0.0.50:8080/
Note: Didn’t work when clicking on button “manager app”
Note: Instruction were to go to: 10.0.0.50:8080/manager/html

Instructions within the .xml file shows making changes for both user and role — I only had done for user
Now its:

Issue: Prompt for username and password not working for what I configured within .xml file

Restarted server with — shutdown -r now

What’s throwing me off are the comments, so with the .xml file — at the top — I have:



Note: XREF to — http://examples.javacodegeeks.com/enterprise-java/tomcat/tomcat-users-xml-configuration-example/

Resolved re: Manager App
Note: This .xml file is nightmare with the comments
A: Made a cp (copy) of the file with extension .bak (for a backup)
A: Created a new .xml file and entered this:




Restarted tomcat

Worked!

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/