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.

Ubuntu 14.04.4 Server installation notes – Security and Weather

Overview
Needed to install a new Ubuntu Server for a long-term project of creating a DIY Security Monitoring System and DIY Weather Station. The primary outcome (security and weather aside) is learning – Ubuntu, SQL, C Programming, Networking, Wireless Communication, etc). The following are general notes, prior to adding anything related to Security Monitoring or Weather.

Downloading Ubuntu Server

Integrating resources for action support (Book, Forums, Google Search)

Getting the .ISO onto bootable DVD

Main Account username and password

Root-level access to my own account

Modifying the IP Address to be static

Access via Putty (SSH)
Did a search on my own site to review how I did this in the past — http://www.paulgarth.com/2015/11/22/remote-into-ubuntu-desktop-acer/

Updates

Closing the lid and keeping server running
Sudo SU — to get access to root level
vi /etc/systemd/logind.conf
Modified this line to end in “ignore” – HandleLidSwitch=ignore
To save and exit, it is “: and then wq!” — had to be in Insert Mode to edit (i) and then Escape before saving.
Note: Ensure to remove the leading “#” (because that comments it out)
Restart with – restart systemd-logind
Now I can close lid and servers stays on — good for stacking devices…

Syntax with main( ) re: int

I’m using Cloud9 for my IDE and compiler to learn the C Programming Language.

Going through Schildt’s “Teach yourself C” which is copyrighted 1989. I’m thinking there has been a syntax update. When I entered the following code, I received an error.

Code

#include “stdio.h”
main( )
{
printf(“This is a short C program.”);
}

Response with error:

warning: return type defaults to ‘int’ [enabled by default]
main( )
^
This is a short C program.

Issue:

The program did run and displayed “This is a short C program.”, but looks like it added “int” in front of main ( ) for me.

Adding int in front of main ( )

#include “stdio.h”
int main( )
{
printf(“This is a short C program.”);
}

Running program again with no errors:

This is a short C program.

Process exited with code: 0

Followup needed:

Q: What change has happened since book was published?

Q: What current version of C is running inside Cloud9?
A: gcc -v
Actual Answer: gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)
pgarth:~/workspace $ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v –with-pkgversion=’Ubuntu 4.8.4-2ubuntu1~14.04′ –with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs –enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ –prefix=/usr –program-suffix=-4.8 –enable-shared –enable-linker-build-id –libexecdir=/usr/lib –without-included-gettext –enable-threads=posix –with-gxx-include-dir=/usr/include/c++/4.8 –libdir=/usr/lib –enable-nls –with-sysroot=/ –enable-clocale=gnu –enable-libstdcxx-debug –enable-libstdcxx-time=yes –enable-gnu-unique-object –disable-libmudflap –enable-plugin –with-system-zlib –disable-browser-plugin –enable-java-awt=gtk –enable-gtk-cairo –with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre –enable-java-home –with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 –with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 –with-arch-directory=amd64 –with-ecj-jar=/usr/share/java/eclipse-ecj.jar –enable-objc-gc –enable-multiarch –disable-werror –with-arch-32=i686 –with-abi=m64 –with-multilib-list=m32,m64,mx32 –with-tune=generic –enable-checking=release –build=x86_64-linux-gnu –host=x86_64-linux-gnu –target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)

Installing OracleDB on CentOS7

Note: I already have MariaDB and Apache Tomcat installed on CentOS7 server. Now I’ll be adding the free version of OracleDB.
Note: I followed these instructions: http://www.tecmint.com/oracle-database-11g-release-2-installation-in-linux/

cd /etc/yum.repos.d (Change directory)
wget http://public-yum.oracle.com/public-yum-ol6.repo (Get the file)
yum install oracle-rdbms-server-11gR2-preinstall (Install the file I downloaded)

Note: I saw for most part success with the install, except for:
–> Finished Dependency Resolution
Error: Package: kernel-uek-2.6.39-400.264.13.el6uek.x86_64 (ol6_UEK_latest)
Requires: ql23xx-firmware
Available: ql23xx-firmware-3.03.27-3.1.el6.noarch (ol6_latest)
ql23xx-firmware = 3.03.27-3.1.el6
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest

Q: How to create a FQDN for the server?
A: Within /etc/hosts Went into VI and added this:
10.0.0.50 centos.pg.com

Q: How to set the hostname?
A: Within /etc/sysconfig/network I went into VI and added:
HOSTNAME=centos.pg.com

Q: How to set the hosts files
Note: I already added in 10.0.0.50 for centos.pg.com, but then went back in and added oracle
Note: It now looks like:
10.0.0.50 centos.pg.com oracle

Q: How to restart the network?
A: /etc/init.d/network restart

Q: How to add a user account for Oracle?
A: adduser oracle

Q: How to change password for the new account Oracle?
A: passwd oracle – made it redwood123

Q: How to add for 90-nproc.conf?
A: Add the entry to file “/etc/security/limits.d/90-nproc.conf” as described below.
A: With this entry:
# Default limit for number of user’s processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

* soft nproc 1024
# To this
* – nproc 16384

Q: How to change for SELinux
Note: It was originally set for “enforcing” and I changed to “permissive”
A: /etc/selinux/config
A: Changed from enforcing to permissive

Note: After rebooting, log-in as oracle (this is the new account I just created)

When I do PWD is returns /home/oracle

Q: How to modify the .bash_profile file?
A: vi .bash_profile
A: Add this in and modify the FQDN to centos.pg.com
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=centos.pg.com; export ORACLE_HOSTNAME
ORACLE_UNQNAME=DB11G; export ORACLE_UNQNAME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=DB11G; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH export PATH

SQL within 1and1 databases – basic commands

Access the database within 1and1 using Putty and SSH – this is the easy part, and I’m into SQL Monitor where the prompt is: mysql>

Note: 1and1 is using Oracle, which is convenient for learning and I can create a bunch of different databases.

Q: How to know the names of the tables within the database?
A: show tables from ;
A: Below:
mysql> show tables from db610639204;

+————————-+
| Tables_in_db610639204 |
+————————-+
| accessprofile |
| accessright |
| accessscope |
| action |
| activity |
| activityprice |
| affectation |
| alert |
| approver |
| assignment |
| attachment |
| audit |
| auditsummary |
| bill |
| billline |
| calendar |
| calendardefinition |
| checklist |
| checklistable |
| checklistdefinition |
| checklistdefinitionline |
| checklistline |
| client |
| collapsed |
| columnselector |
| command |
| context |
| contexttype |
| copyable |
| criticality |
| decision |
| delay |
| delayunit |
| deliverymode |
| dependable |
| dependency |
| document |
| documentdirectory |
| documentversion |
| efficiency |
| event |
| expense |
| expensedetail |
| expensedetailtype |
| favorite |
| favoriteparameter |
| feasibility |
| filter |
| filtercriteria |
| habilitation |
| habilitationother |
| habilitationreport |
| health |
| history |
| importable |
| importlog |
| indicator |
| indicatorable |
| indicatorableindicator |
| indicatordefinition |
| indicatorvalue |
| issue |
| likelihood |
| link |
| linkable |
| list |
| mail |
| mailable |
| measureunit |
| meeting |
| menu |
| menuselector |
| message |
| milestone |
| mutex |
| note |
| opportunity |
| origin |
| originable |
| otherversion |
| overallprogress |
| parameter |
| payment |
| paymentdelay |
| paymentmode |
| periodicity |
| periodicmeeting |
| plannedwork |
| planningelement |
| planningmode |
| plugin |
| predefinedtext |
| priority |
| privacy |
| product |
| profile |
| project |
| projecthistory |
| quality |
| question |
| quotation |
| recipient |
| referencable |
| report |
| reportcategory |
| reportparameter |
| requirement |
| resource |
| resourcecost |
| risk |
| risklevel |
| role |
| runstatus |
| severity |
| sla |
| status |
| statusmail |
| team |
| tempupdate |
| term |
| testcase |
| testcaserun |
| testsession |
| textable |
| ticket |
| today |
| todayparameter |
| trend |
| type |
| urgency |
| version |
| versionproject |
| visibilityscope |
| work |
| workelement |
| workflow |
| workflowstatus |
| workperiod |
+————————-+
138 rows in set (0.15 sec)

Note: This is the Projeqtor database, which is quite commprehensive

Q: How to know the fields within a table? In this case, the table is called “Client”
A: show columns from client;
A: This comes back with information within each of these colunns, at the field level:
Field | Type | Null | Key | Default | Extra

Compilation of interests, thoughts and musings…