Installing MindTouch package on Gentoo

     

    Applies toMindTouch 1.9 or laterLicenseAll versions
    Operating SystemLinuxDocumentation TypesSetup
    Community Documentation
     

    This guide has been used on the following configurations:

    • MindTouch Hayes 1.8.2 on Gentoo (December 10, 2007).  Most of this went pretty smoothly, however, html2ps  didn't have an ebuild so some feature features in MindTouch for exporting PDFs will probably be broken.
       
    • MindTouch 1.9.0 on Gentoo (April 2008)

      

    This guide was developed by following the 1.8 Hayes Official Install and Upgrade Guide with the following caveats... 

    • The database server, web server and Deki Dream server are all installed on the same host.  It is possible to install different components on different hosts, but that is beyond the scope of this How To.
    • I'm assuming the MindTouch source code is installed in a directory pointed to by ${DEKI_SRC}.  Probably that's in a location like ${HOME}/src/Deki_Wiki_1.9.0b_Itasca_source.  If you don't have such an environment variable set, just substitute ${DEKI_SRC}with the location of the source.
    • This guide assumes you are installing MindTouch 1.9.0

    Download MindTouch Source 

    Download the MindTouch source code and unpack it.  I'm assuming MindTouch 1.9.0 in the following example:
     

    # cd ${HOME}/src
    # tar -xzvf Deki_Wiki_1.9.0b_Itasca_source.tar.gz
    # export DEKI_SRC=${HOME}/src/Deki_Wiki_1.9.0b_Itasca_source 

    Install and Configure Software Components

    MindTouch has dependencies on a number of additional software components.  Fortunately almost all of them are installed easily using Gentoo's ebuild installation manager.  Since a number of these components use the same build options, its a good idea to configure your USE flag in /etc/make.conf with the common options.  Below is an example of a fairly safe and minimal set of build options:
     

     USE="apache2 bzip2 curl gd jpeg json ldap logrotate mmx mysql \
    php png ssl syslog tiff truetype xml zip"

    Install PHP 5

    Install the php ebuild.  MindTouch requires the additional modules curl, GD, PEAR and PEAR_Cache_Lite which are separate ebuilds in Gentoo.  The apache2 USE flag will take care of building mod_php.
     

    # emerge -av php curl gd PEAR-Cache_Lite PEAR-PEAR 

    Install MySQL

    Install the mysql ebuild

    # emerge -av mysql

    Also in Gentoo, the default mysql install has the following setting in the mysql config file /etc/mysql/my.cnf

    # security:
    # using "localhost" in connects uses sockets by default
    # skip-networking
    bind-address                          = 127.0.0.1

    The "bind-address"  line is not commented out. Please comment out that line for its needed for the dekihost to work. (see faq entry)

      

    Setup MySQL to start automatically at boot time and start MySQL:

    # rc-update add default mysql
    

    # /etc/init.d/mysql start 

    Login to mysql as root and change the root password.  Run the commands in bold below, replacing 'newpwd' with your secure password and 'host_name' with your Gentoo server's host name:

    # mysql -u root
    Welcom to the MySQL monitor.  Commands end with ; or \g
    Your MySQL Connection id is #
    Server version:  5.0.##-log Gentoo Linux mysql-5.0.##
    
    Type 'help;' or '\h' for help.  Type '\c' to clear the buffer.
    mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
    mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');

    Install HTML2PS 

    The HTML2PS ebuild is lacking a maintainer and is no longer supported (any volunteers?).  In the mean time you'll have to install this manually by visiting the HTML2PS homepage and following the instructions located there.
     

    Install Remaining Dependencies  

    Install the remaining ebuilds that don't require any sepcial configuration
     

    # emerge -av mono wv pdf2html html2text htmldoc XML-Parser imagemagick
    

    Install Apache

    Apache uses the variable APACHE_MODULES in /etc/make.conf to control which modules are built.  Without this variable  a default set is provided, however, it is missing mod_proxy and mod_proxy_http.  The example below includes the default set with the addition of mod_proxy and mod_proxy_http.
     

      

    APACHE2_MODULES="access actions alias auth auth_basic auth_digest authn_anon authn_dbd authn_dbm \
    authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user \
    autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache \
    filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation \
    proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id \
    userdir usertrack vhost_alias"

    Note:  This is probably overkill for almost any apache installation, however, you can control which modules are loaded in the httpd.conf file.

    Install the apache ebuild.  MindTouch requires mod_proxy_html, which is a separate ebuild in Gentoo, so grab that while we're at it.
     

    # emerge -av apache mod_proxy_html
    

    In /etc/conf.d/apache2 add "-D PHP5 -D PROXY -D PROXY_HTML" to the APACHE2_OPTS environment variable.
     

    edit your /etc/apache2/httpd.conf file to ensure that the proper modules are loaded.  Add the following lines to the Load Module section

    LoadModule rewrite_module	modules/mod_rewrite.so
    LoadModule proxy_module		modules/mod_proxy.so
    LoadModule proxy_http_module    modules/mod_proxy_http.so

    Note:  The default Gentoo Apache configuration will load all of the .conf files in /etc/apache2/modules.d.  The -D PROXY in /etc/conf.d/apache2 will load and configure mod_php in /etc/apache2/modules.d/70_mod_php5.conf and the -D PROXY_HTML will load the mod_proxy_html module in /etc/apache2/modules.d/27_mod_proxy_html.conf.
     

    Copy the deki-apache configuration file from the MindTouch source directory

    # cp ${DEKI_SRC}/config/deki-apache.conf \
       /etc/apache2/vhosts.d/deki-apache.include

    Note:  I changed the file extension from .conf to .include during this step.  Gentoo's default Apache configuration includes everything in the /etc/apache2/vhosts.d/ directory that ends in a .conf extension automatically and I wanted a little more control over when this file gets included. 

    Edit your Apache configuration file to include MindTouch's Apache configuration script.  Add the following to the bottom of the /etc/apache2/httpd.conf file:

    Include /etc/apache2/vhosts.d/deki-apache.include 

    I had to add this to the apache virtual host config in /etc/apache2/vhosts.d/ but it is probably specific to the latest Gentoo apache config, more than anything to do with MindTouch.
     

           <Directory />
               Options FollowSymLinks
               AllowOverride None
               Order allow,deny
               Allow from all
            </Directory> 
    

    Wherever the Install Guide refers to "www-data," use "apache" instead since that is the user apache runs under.  You'll need to also change this in the /etc/init.d/dekihost script.

    When using the web installr, http://deki-hayes/config/index.php you will need to edit index.php to comment out the section under "apache > 2.0.0" since this test fails, inappropriately saying you have a wrong version of apache installed even though you don't.  Accordingly comment out the following section so as to not run the test.  Note:  In MindTouch 1.9.0, the code is slightly different and can be found in ${DEKI_SRC}/Deki_Wiki_1.9.0b_Itasca_source/web/maintenance/install_utils.inc.
     

    //apache > 2.0.0
    //if(function_exists('apache_get_version')) {
    //      $apache_ver = apache_get_version();
    //      if(preg_match('/Apache\/(2\.[0-9]+\.[0-9]+)/', $apache_ver, $matches))
    //              print "<li>Apache version <tt>" . htmlspecialchars( $matches[0] ) . "</tt>.</li>\n";
    //      else
    //             dieout("<li class='error'><strong>Fatal: Detected apache version: <tt>" . htmlspecialchars($apache_ver) . "</tt>.  Apache 2.x is required. Aborting...</strong></li></ul>");
    //}

    Setup Apache to start automatically at boot time:

    # rc-update add default apache2 

    Start Apache and make sure it works.  The default index.html file that comes with Apache should simply contain "It works!

    # /etc/init.d/apache2 start

    Configure MindTouch 

    Install the MindTouch web pages

    Copy the MindTouch web pages to your Apache htdocs directory (I'm assuming that is /var/www/localhost/htdocs, if not you'll need to change the destination path appropriately).

    # cp -rp ${DEKI_SRC}/web/* /var/www/localhost/htdocs/ 

    Run the MindTouch Web-Based Configurator

    Open a web browser and go to the URL http://gentoo_host/config/index.php.  If your Apache installation is running and configured correctly you should see a page that checks for the necessary software, and allows you to specify your MindTouch settings.  The installer will create your MySQL database, and create some configuration files for you and instruct you to copy them to your Gentoo filesystem. 
     

    The installer will have you copy the file mindtouch.host.conf.in to the /etc/dekiwiki directory.  Once this is complete, create a symbolic link named dekiwiki to the file in the /etc/conf.d directory:

    # ln -s /etc/dekiwiki/mindtouch.host.conf.in /etc/conf.d/dekiwiki

    The Gentoo Dream startup script /etc/init.d/dekiwiki (created below) will use the file /etc/conf.d/dekiwiki

    The default startup file (that the installer told you to copy to /etc/dekiwiki/mindtouch.deki.host.xml) references a cache directory for the lucene search engine.  Create the directory

    # mkdir /var/www/dekiwiki/bin/cache
    # mkdir /var/www/dekiwiki/bin/cache/luceneindex
    # chown apache:www /var/www/dekiwiki/bin/cache/luceneindex
    # chmod 775 /var/www/dekiwiki/bin/cache/luceneindex

      

    Setup the Configuration Files 

    You will need to create a startup script to start the MindTouch Dream server automatically.  Unfortunately the MindTouch source doesn't come with a suitable script.  Create the file /etc/init.d/dekiwiki with your favorte editor (vi).  The following is a bare-bones example of a startup script:
     

      

    #!/sbin/runscript
    # Copyright 1999-2007 Gentoo Foundation
    # Distributed under the terms of the GNU General Public License v2
    
    opts="configtest reload"
    
    depend() {
            need net
            use mysql apache2
            after sshd
    }
    
    configtest() {
            ebegin "Checking Dekiwiki Configuration"
            checkconfig
            eend $?
    }
    
    checkconfd() {
            if [ -z "$DEKIUSER" ]; then
                    eerror "Please enter the username for the DekiWiki daemon"
                    return 1
            fi
    
            if [ ! -f "$MONO" ]; then
                    eerror "Please enter the full path to your mono binary"
                    return 1
            fi
    
            if [ ! -d "$BIN_DIR" ]; then
                    eerror "Please enter the full path to your DekiWiki bin directory"
                    return 1
            fi
    
            if [ -z "$APIKEY" ]; then
                    eerror "Please specify your APIKEY"
                    return 1
            fi
    
            if [ -z "$PATH_PREFIX" ]; then
                    PATH_PREFIX="@api"
            fi
    
            if [ -z "$HTTP_PORT" ]; then
                    HTTP_PORT=8081
            fi
    
            if [ -z "$IP" ]; then
                    IP="localhost"
            fi
    
            if [ -z "$HOST_EXE" ]; then
                    HOST_EXE="$BIN_DIR/mindtouch.host.exe"
            fi
    

         

    if [ -z "$SCRIPT" ]; then

                    SCRIPT="/etc/dekiwiki/mindtouch.deki.startup.xml"

            fi

          

            if [ -z "$NOTTY" ]; then

                    NOTTY="notty"

            fi

          

            if [ -z "$CONNECT_LIMIT" ]; then

                    CONNECT_LIMIT="-5"

            fi

            if [ -z "$LOGDIR" ]; then

                    LOGDIR="/var/log/dekiwiki"

            fi

          

            if [ -z "$LOGFILE" ]; then

                    LOGFILE="${LOGDIR}/deki-api.log"

            fi

          

            if [ -z "$DEKIPID" ]; then

                    DEKIPID="/var/run/dekihost.pid"

            fi

    }

          

    checkconfig() {

            checkconfd || return 1

    }

          

    start() {

            ebegin "Starting DekiWiki"

            checkconfig || return 1

            if [ ! -d "$LOGDIR" ]; then

                    einfo "Creating DekiWiki log director:  $LOGDIR"

                    mkdir "$LOGDIR"

            fi

            chown -R $DEKIUSER "$LOGDIR"

            MONO_ARGS="$HOST_EXE apikey $APIKEY script $SCRIPT path-prefix $PATH_PREFIX http-port $HTTP_PORT ip $IP connect-limit $CONNECT_LIMIT $NOTTY"

          

            start-stop-daemon --start --quiet --chuid ${DEKIUSER} \

                    --make-pidfile --background --pidfile ${DEKIPID} \

                    --exec ${MONO} -- ${MONO_ARGS} > ${LOGFILE} 2>&1

          

            eend $?

    }

    stop() {

            ebegin "Stopping DekiWiki"

            checkconfd || return 1

            start-stop-daemon --stop --quiet --pidfile ${DEKIPID}

            eend $?

    }

    Now configure the script to start automatically at boot time:

      

    # chmod 755 /etc/init.d/dekiwiki
    # rc-update add default /etc/init.d/dekiwiki

    Lastly start the MindTouch Dream server before you visit your new MindTouch site

      

    # /etc/init.d/dekiwiki start
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by