Commit b09936472ff36afecc4f1d8f8ee448e167196b48

Authored by Matheus de Sousa Faria
1 parent a8f16493

Instalation Tutorial on Cent OS 6.4

docs/cent-os/colab-centos-instalation-tutorial.rst 0 → 100644
... ... @@ -0,0 +1,718 @@
  1 +.. -*- coding: utf-8 -*-
  2 +
  3 +.. highlight:: rest
  4 +
  5 +.. _colab_software:
  6 +
  7 +====================
  8 +Colab on Cent OS 6.4
  9 +====================
  10 +
  11 +Nginx 1.6
  12 +=========
  13 +
  14 +Download the nginx
  15 +
  16 +.. code-block::
  17 + cd /tmp
  18 + wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
  19 + sudo rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
  20 +
  21 +Install nginx
  22 +
  23 +.. code-block::
  24 +
  25 + sudo yum install nginx -y
  26 +
  27 +Start nginx with the system
  28 +
  29 +.. code-block::
  30 +
  31 + sudo chkconfig nginx on
  32 +
  33 +
  34 +Postgres Server 9.3
  35 +===================
  36 +
  37 +Install postgresql
  38 +
  39 +.. code-block::
  40 +
  41 + sudo yum localinstall http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm -y
  42 + sudo yum install postgresql93 postgresql93-devel postgresql93-libs postgresql93-server -y
  43 +
  44 +Initialize database
  45 +
  46 +.. code-block::
  47 +
  48 + sudo service postgresql-9.3 initdb
  49 +
  50 +Start postgresql with the system
  51 +
  52 +.. code-block::
  53 +
  54 + sudo chkconfig postgresql-9.3 on
  55 +
  56 +Start postgresql
  57 +
  58 +.. code-block::
  59 +
  60 + sudo service postgresql-9.3 start
  61 +
  62 +Put the binaries of postgres in the PATH variable
  63 +
  64 +.. code-block::
  65 +
  66 + echo "export PATH=$PATH:/usr/pgsql-9.3/bin/" >> ~/.bashrc
  67 + source ~/.bashrc
  68 + sudo su
  69 + echo "export PATH=$PATH:/usr/pgsql-9.3/bin/" >> ~/.bashrc
  70 + source ~/.bashrc
  71 + exit
  72 +
  73 +Edit sudoers file
  74 +
  75 +.. code-block::
  76 +
  77 + sudo vim /etc/sudoers
  78 +
  79 +Inside sudoers file change the line
  80 +
  81 +.. code-block::
  82 +
  83 + Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
  84 +
  85 +To this line
  86 +
  87 +.. code-block::
  88 +
  89 + Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/pgsql-9.3/bin/
  90 +
  91 +And save the file
  92 +
  93 +.. code-block::
  94 +
  95 + [ESC]:wq!
  96 +
  97 +Create a password for postgresql database, in this case we have an user called ``colab``, and we will set its password too.
  98 +
  99 +.. code-block::
  100 +
  101 + sudo -u postgres psql
  102 +
  103 +.. code-block::
  104 +
  105 + ALTER USER postgres WITH PASSWORD 'colab';
  106 + CREATE USER colab SUPERUSER INHERIT CREATEDB CREATEROLE;
  107 + ALTER USER colab PASSWORD 'colab';
  108 + \q
  109 +
  110 +Restart the postgresql
  111 +
  112 +.. code-block::
  113 +
  114 + sudo service postgresql-9.3 restart
  115 +
  116 +
  117 +Trac 1.0
  118 +========
  119 +
  120 +Install the dependencies
  121 +
  122 +.. code-block::
  123 +
  124 + sudo yum install gcc python-devel python-setuptools -y
  125 +
  126 +Install this package to use Trac with postgresql
  127 +
  128 +.. code-block::
  129 +
  130 + sudo easy_install psycopg2
  131 +
  132 +If you are going to use postgresql, create the database for trac
  133 +
  134 +.. code-block::
  135 +
  136 + sudo -u postgres psql
  137 +
  138 +.. code-block::
  139 +
  140 + CREATE DATABASE "trac_colab" WITH OWNER "colab" ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' TEMPLATE=template0;
  141 + \q
  142 +
  143 +And change the database authentication to md5
  144 +
  145 +.. code-block::
  146 +
  147 + sudo vi /var/lib/pgsql/9.3/data/pg_hba.conf
  148 +
  149 +.. code-block::
  150 +
  151 + [ESC]:%s/peer/md5
  152 + [ESC]:%s/ident/md5
  153 +
  154 +.. code-block::
  155 +
  156 + [ESC]:wq!
  157 +
  158 +And restart postgresql
  159 +
  160 +.. code-block::
  161 +
  162 + sudo service postgresql-9.3 restart
  163 +
  164 +
  165 +Install Trac
  166 +
  167 +.. code-block::
  168 +
  169 + sudo easy_install trac
  170 +
  171 +Intiate Trac
  172 +
  173 +.. code-block::
  174 +
  175 + sudo mkdir -p /opt/trac
  176 + sudo trac-admin /opt/trac initenv
  177 +
  178 +In ``Project Name [My Project]>`` we used ``colab``. And if you are going to use the postgresql, put this line in ``Database connection string [sqlite:db/trac.db]>``, and we are using the user ``colab``.
  179 +
  180 +.. code-block::
  181 +
  182 + postgres://colab:colab@/trac_colab?host=localhost
  183 +
  184 +SVN Plugin
  185 +
  186 +Install subversion
  187 +
  188 +.. code-block::
  189 +
  190 + sudo yum install subversion -y
  191 +
  192 +Create a repository and initiate it
  193 +
  194 +.. code-block::
  195 +
  196 + mkdir -p /home/colab/myrepo
  197 + mkdir -p /tmp/project/{branches,tags,trunk}
  198 + svnadmin create /home/colab/myrepo/
  199 + svn import /tmp/project file:///home/colab/myrepo/ -m "initial import"
  200 + sudo rm -rf /tmp/project
  201 + find /home/colab/myrepo -type f -exec chmod 660 {} \;
  202 + find /home/colab/myrepo -type d -exec chmod 2770 {} \;
  203 +
  204 +Edit the Trac's configuration file
  205 +
  206 +.. code-block::
  207 +
  208 + sudo vim /opt/trac/conf/trac.ini
  209 +
  210 +Inside the trac.ini file.
  211 +Replace the line
  212 +
  213 +.. code-block::
  214 +
  215 + repository_dir =
  216 +
  217 +With this one
  218 +
  219 +.. code-block::
  220 +
  221 + repository_dir = /home/colab/myrepo/
  222 +
  223 +Insert those lines in the end of file to activate the view of subversion on Trac.
  224 +
  225 +.. code-block::
  226 +
  227 + [components]
  228 + tracopt.versioncontrol.svn.* = enabled
  229 +
  230 +.. code-block::
  231 +
  232 + [ESC]:wq!
  233 +
  234 +Remote User
  235 +
  236 +Create the plugin to set the remote user variable
  237 +
  238 +.. code-block::
  239 +
  240 + sudo vim /opt/trac/plugins/remote-user-auth.py
  241 +
  242 +And put this in the file
  243 +
  244 +.. code-block::
  245 +
  246 + from trac.core import *
  247 + from trac.config import BoolOption
  248 + from trac.web.api import IAuthenticator
  249 +
  250 + class MyRemoteUserAuthenticator(Component):
  251 +
  252 + implements(IAuthenticator)
  253 +
  254 + obey_remote_user_header = BoolOption('trac', 'obey_remote_user_header', 'false',
  255 + """Whether the 'Remote-User:' HTTP header is to be trusted for user logins
  256 + (''since ??.??').""")
  257 +
  258 + def authenticate(self, req):
  259 + if self.obey_remote_user_header and req.get_header('Remote-User'):
  260 + return req.get_header('Remote-User')
  261 + return None
  262 +
  263 +Save the file
  264 +
  265 +.. code-block::
  266 +
  267 + [ESC]:wq!
  268 +
  269 +Edit Trac's configuration file
  270 +
  271 +.. code-block::
  272 +
  273 + sudo vim /opt/trac/conf/trac.ini
  274 +
  275 +Insert this line in the [trac] session.
  276 +
  277 +.. code-block::
  278 +
  279 + obey_remote_user_header = true
  280 +
  281 +Save and quit
  282 +
  283 +.. code-block::
  284 +
  285 + [ESC]:wq!
  286 +
  287 +*NOTE:*
  288 + To run Trac: ``sudo tracd --port 5000 /opt/trac`` . And to access it `http://localhost:5000 <http://localhost:5000>`_
  289 +
  290 +Solr 4.6.1
  291 +==========
  292 +
  293 +Download Solr and unpack it
  294 +
  295 +.. code-block::
  296 +
  297 + cd /tmp
  298 + sudo wget http://archive.apache.org/dist/lucene/solr/4.6.1/solr-4.6.1.tgz
  299 + sudo tar xvzf solr-4.6.1.tgz
  300 +
  301 +Install Solr in ``/usr/share``
  302 +
  303 +.. code-block::
  304 +
  305 + sudo mv solr-4.6.1 /usr/share/solr
  306 + sudo cp /usr/share/solr/example/webapps/solr.war /usr/share/solr/example/solr/solr.war
  307 +
  308 +Remove the ``updateLog`` tag, editing the solrconfig.xml
  309 +
  310 +.. code-block::
  311 +
  312 + sudo vim /usr/share/solr/example/solr/collection1/conf/solrconfig.xml
  313 +
  314 +And remove those lines
  315 +
  316 +.. code-block::
  317 +
  318 + <updateLog>
  319 + <str name="dir">${solr.ulog.dir:}</str>
  320 + </updateLog>
  321 +
  322 +.. code-block::
  323 +
  324 + [ESC]wq!
  325 +
  326 +*NOTE:*
  327 +
  328 + To run Solr
  329 + cd /usr/share/solr/example/; sudo java -jar start.jar
  330 +
  331 +Mailman
  332 +=======
  333 +
  334 +Install the fcgiwrap
  335 +
  336 +.. code-block::
  337 +
  338 + sudo yum install fcgi-devel git -y
  339 + cd /tmp
  340 + sudo git clone https://github.com/gnosek/fcgiwrap.git
  341 + cd fcgiwrap
  342 + sudo yum groupinstall "Development tools" -y
  343 + sudo autoreconf -i
  344 + sudo ./configure
  345 + sudo make
  346 + sudo make install
  347 +
  348 +Now you can install spawn fcgi
  349 +
  350 +.. code-block::
  351 +
  352 + sudo yum install spawn-fcgi -y
  353 +
  354 +And edit the spawn-fgci configuration file
  355 +
  356 +.. code-block::
  357 +
  358 + sudo vim /etc/sysconfig/spawn-fcgi
  359 +
  360 +.. code-block::
  361 +
  362 + FCGI_SOCKET=/var/run/fcgiwrap.socket
  363 + FCGI_PROGRAM=/usr/local/sbin/fcgiwrap
  364 + FCGI_USER=apache
  365 + FCGI_GROUP=apache
  366 + FCGI_EXTRA_OPTIONS="-M 0770"
  367 + OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS -F 1 -P /var/run/spawn-fcgi.pid -- $FCGI_PROGRAM"
  368 +
  369 +Save and quit
  370 +
  371 +.. code-block::
  372 +
  373 + [ESC]:wq!
  374 +
  375 +Add nginx to the apache's user group, to grant all the right permissions to spawn-fcgi
  376 +
  377 +.. code-block::
  378 +
  379 + sudo usermod -a -G apache nginx
  380 +
  381 +Put spaw-fcgi to start with the system, and start it
  382 +
  383 +.. code-block::
  384 +
  385 + sudo chkconfig --levels 235 spawn-fcgi on
  386 + sudo /etc/init.d/spawn-fcgi start
  387 +
  388 +Install mailman
  389 +
  390 +.. code-block::
  391 +
  392 + sudo yum install mailman -y
  393 +
  394 +Create a list, in this case we called it ``mailman``
  395 +
  396 +.. code-block::
  397 +
  398 + sudo /usr/lib/mailman/bin/newlist mailman
  399 +
  400 +Put a real email in ``Enter the email of the person running the list:``. And put a password in ``Initial mailman password:``, we used ``admin`` as password.
  401 +
  402 +And add that list to the aliases file
  403 +
  404 +.. code-block::
  405 +
  406 + sudo vim /etc/aliases
  407 +
  408 +.. code-block::
  409 +
  410 + ## mailman mailing list
  411 + mailman: "|/usr/lib/mailman/mail/mailman post mailman"
  412 + mailman-admin: "|/usr/lib/mailman/mail/mailman admin mailman"
  413 + mailman-bounces: "|/usr/lib/mailman/mail/mailman bounces mailman"
  414 + mailman-confirm: "|/usr/lib/mailman/mail/mailman confirm mailman"
  415 + mailman-join: "|/usr/lib/mailman/mail/mailman join mailman"
  416 + mailman-leave: "|/usr/lib/mailman/mail/mailman leave mailman"
  417 + mailman-owner: "|/usr/lib/mailman/mail/mailman owner mailman"
  418 + mailman-request: "|/usr/lib/mailman/mail/mailman request mailman"
  419 + mailman-subscribe: "|/usr/lib/mailman/mail/mailman subscribe mailman"
  420 + mailman-unsubscribe: "|/usr/lib/mailman/mail/mailman unsubscribe mailman"
  421 +
  422 +.. code-block::
  423 +
  424 + [ESC]:wq!
  425 +
  426 +Now, reset the aliases
  427 +
  428 +.. code-block::
  429 +
  430 + sudo newaliases
  431 +
  432 +Restart postfix
  433 +
  434 +.. code-block::
  435 +
  436 + sudo /etc/init.d/postfix restart
  437 +
  438 +And add the mailman to start with the system
  439 +
  440 +.. code-block::
  441 +
  442 + sudo chkconfig --levels 235 mailman on
  443 +
  444 +Start mailman and create a symbolic link inside cgi-bin
  445 +
  446 +.. code-block::
  447 +
  448 + sudo /etc/init.d/mailman start
  449 + cd /usr/lib/mailman/cgi-bin/
  450 + sudo ln -s ./ mailman
  451 +
  452 +Create a config file to mailman inside nginx
  453 +
  454 +.. code-block::
  455 +
  456 + sudo vim /etc/nginx/conf.d/list.conf
  457 +
  458 +.. code-block::
  459 +
  460 + server {
  461 + server_name localhost;
  462 + listen 8080;
  463 +
  464 + location /mailman/cgi-bin {
  465 + root /usr/lib;
  466 + fastcgi_split_path_info (^/mailman/cgi-bin/[^/]*)(.*)$;
  467 + include /etc/nginx/fastcgi_params;
  468 + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  469 + fastcgi_param PATH_INFO $fastcgi_path_info;
  470 + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
  471 + fastcgi_intercept_errors on;
  472 + fastcgi_pass unix:/var/run/fcgiwrap.socket;
  473 + }
  474 + location /images/mailman {
  475 + alias /usr/lib/mailman/icons;
  476 + }
  477 + location /pipermail {
  478 + alias /var/lib/mailman/archives/public;
  479 + autoindex on;
  480 + }
  481 + }
  482 +
  483 +.. code-block::
  484 +
  485 + [ESC]:wq!
  486 +
  487 +Restart nginx to update the new configuration
  488 +
  489 +.. code-block::
  490 +
  491 + sudo service nginx restart
  492 +
  493 +Edit the config script of mailman, to fix the url used by it.
  494 +
  495 +.. code-block::
  496 +
  497 + sudo vim /etc/mailman/mm_cfg.py
  498 +
  499 +Add this line in the end of file
  500 +
  501 +.. code-block::
  502 +
  503 + DEFAULT_URL_PATTERN = 'https://%s/mailman/cgi-bin/'
  504 +
  505 +.. code-block::
  506 +
  507 + [ESC]:wq!
  508 +
  509 +Run the fix_url and restart mailman.
  510 +
  511 +.. code-block::
  512 +
  513 + sudo /usr/lib/mailman/bin/withlist -l -a -r fix_url
  514 + sudo service mailman restart
  515 +
  516 +*NOTE:*
  517 + You can access mailman in this url: `http://localhost:8080/mailman/cgi-bin/listinfo <http://localhost:8080/mailman/cgi-bin/listinfo>`_
  518 +
  519 +
  520 +Python 2.7 + Django 1.6
  521 +=======================
  522 +
  523 +Install the devel tools to build specific python 2.7 modules
  524 +
  525 +.. code-block::
  526 +
  527 + sudo yum groupinstall "Development tools" -y
  528 + sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel libxslt-devel -y
  529 +
  530 +Download and compile Python 2.7
  531 +
  532 +.. code-block::
  533 +
  534 + cd /tmp
  535 + sudo wget --no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
  536 + sudo tar xf Python-2.7.6.tar.xz
  537 + cd Python-2.7.6
  538 + sudo ./configure --prefix=/usr/local
  539 + sudo make
  540 +
  541 +Install python 2.7 as an alternative python, because cent os uses python 2.6 in the system.
  542 +
  543 +.. code-block::
  544 +
  545 + sudo make altinstall
  546 +
  547 +Update the PATH variable to execute python as root.
  548 +
  549 +.. code-block::
  550 +
  551 + sudo su
  552 + echo "export PATH=$PATH:/usr/local/bin/" >> ~/.bashrc
  553 + source ~/.bashrc
  554 + exit
  555 +
  556 +Install the easy_install for python 2.7
  557 +
  558 +.. code-block::
  559 +
  560 + cd /tmp
  561 + sudo wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
  562 + sudo /usr/local/bin/python2.7 ez_setup.py
  563 +
  564 +Instal pip 2.7
  565 +
  566 +.. code-block::
  567 +
  568 + sudo /usr/local/bin/easy_install-2.7 pip
  569 +
  570 +Install additional packages to python.
  571 +
  572 +.. code-block::
  573 +
  574 + sudo yum remove libevent -y
  575 + sudo yum install mercurial libevent-devel python-devel -y
  576 +
  577 +Edit sudores file to let ``python2.7`` execute in sudo mode.
  578 +
  579 +*NOTE:*
  580 +
  581 + The path ``/usr/bin:/usr/pgsql-9.3/bin/`` will be only in this file if you installed postgresql before, if you didn't just remove it from those lines.
  582 +
  583 +.. code-block::
  584 +
  585 + sudo vim /etc/sudoers
  586 +
  587 +Change the line
  588 +
  589 +.. code-block::
  590 +
  591 + Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/pgsql-9.3/bin/
  592 +
  593 +To
  594 +
  595 +.. code-block::
  596 +
  597 + Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/pgsql-9.3/bin/:/usr/local/bin/
  598 +
  599 +.. code-block::
  600 +
  601 + [ESC]:wq!
  602 +
  603 +Django 1.6
  604 +
  605 +Install django and uwsgi
  606 +
  607 +.. code-block::
  608 +
  609 + sudo pip2.7 install django
  610 + sudo pip2.7 install uwsgi
  611 +
  612 +Colab
  613 +=====
  614 +
  615 +Install git and clone colab
  616 +
  617 +.. code-block::
  618 +
  619 + sudo yum install git -y
  620 + cd /opt
  621 + sudo git clone https://github.com/colab-community/colab.git
  622 +
  623 +Install colab requirements
  624 +
  625 +.. code-block::
  626 +
  627 + sudo pip2.7 install mimeparse
  628 + sudo pip2.7 install -r /opt/colab/requirements.txt
  629 + sudo pip2.7 uninstall django_browserid -y
  630 + sudo pip2.7 install django_browserid==0.9
  631 +
  632 +
  633 +Create the local_settings file in colab folder
  634 +
  635 +.. code-block::
  636 +
  637 + sudo cp /opt/colab/src/colab/local_settings-dev.py /opt/colab/src/colab/local_settings.py
  638 +
  639 +And edit it inserting browser id in the end of file
  640 +
  641 +.. code-block::
  642 +
  643 + sudo vim /opt/colab/src/colab/local_settings.py
  644 +
  645 +.. code-block::
  646 +
  647 + BROWSERID_AUDIENCES = [SITE_URL, SITE_URL.replace('https', 'http')]
  648 +
  649 +.. code-block::
  650 +
  651 + [ESC]:wq!
  652 +
  653 +Create the database for colab, remind that the user colab was created at the postgresql section
  654 +
  655 +.. code-block::
  656 +
  657 + sudo -u postgres psql
  658 +
  659 +.. code-block::
  660 +
  661 + CREATE DATABASE "colab" WITH OWNER "colab" ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' TEMPLATE=template0;
  662 + \q
  663 +
  664 +
  665 +Build the solr schema.xml
  666 +
  667 +.. code-block::
  668 +
  669 + cd /opt/colab/src
  670 + sudo su
  671 + python2.7 manage.py build_solr_schema > /opt/colab/src/schema.xml
  672 + exit
  673 +
  674 +Copy the shcema to solr
  675 +
  676 +.. code-block::
  677 +
  678 + sudo cp /opt/colab/src/schema.xml /usr/share/solr/example/solr/collection1/conf/schema.xml
  679 + sudo rm -f /opt/colab/src/schema.xml
  680 +
  681 +Edit the schema to change the ``stopwords_en.txt`` to ``lang/stopwords_en.txt``
  682 +
  683 +.. code-block::
  684 +
  685 + sudo vim /usr/share/solr/example/solr/collection1/conf/schema.xml
  686 +
  687 +.. code-block::
  688 +
  689 + [ESC]:%s/stopwords_en.txt/lang\/stopwords_en.txt
  690 + [ESC]:wq!
  691 +
  692 +
  693 +Syncronize and migrate the colab's database
  694 +
  695 +.. code-block::
  696 +
  697 + cd /opt/colab/src
  698 + python2.7 manage.py syncdb
  699 + python2.7 manage.py migrate
  700 +
  701 +Start Solr in a terminal, and then, in other terminal, update colab index
  702 +
  703 +.. code-block::
  704 +
  705 + cd /opt/colab/src
  706 + python2.7 manage.py update_index
  707 +
  708 +Now you can close this terminal, and stop solr with ``Ctrl+C``
  709 +
  710 +Import mailman e-mails
  711 +
  712 +.. code-block::
  713 +
  714 + sudo python2.7 /opt/colab/src/manage.py import_emails
  715 +
  716 +*NOTE:*
  717 +
  718 + To run Colab: python2.7 /opt/colab/src/manage.py runserver . To access colab go in: `http://localhost:8000 <http://localhost:8000>`_
0 719 \ No newline at end of file
... ...