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?
Q: What is Trac’s main web-site for downloading, documentation etc?
Q: What is the main site for installation?
Q: What is reference for installing Trac on 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:
Using package manager
Advanced easy_install Options
Creating a Project Environment
Running the Standalone Server
Running Trac on a Web Server
Granting admin rights to the admin user
Finishing the install
Enable version control components
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?
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:
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
Best match: Trac 1.0
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
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?
20160421 WebServer for Trac
Q: Does Trac have a built-in webserver
Q: Can I use Apache instead, seeing as I went out of my to install it?
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: 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?
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)
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
* 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
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
Q: What is Pip?
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:
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 -)
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?
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.