Edgewall Software

Changes between Initial Version and Version 1 of Ubuntu-16.04-Git


Ignore:
Timestamp:
Oct 23, 2017, 1:22:25 AM (7 years ago)
Author:
JoakimReck
Comment:

This howto is ofcourse posted under GPL and is in version .1 but proved working on both Ubuntu 16.10 and LinuxMint 18.2

Legend:

Unmodified
Added
Removed
Modified
  • Ubuntu-16.04-Git

    v1 v1  
     1= Install Trac on Ubuntu proxied by Nginx =
     2[[PageOutline(2-5,Contents,pullout)]]
     3
     4How to install and run a single hosted Trac project from https://trac.edgewall.org
     5
     6This guide should apply for the following debian variations:
     7 * Debian 9
     8 * Ubuntu 16.04
     9 * Ubuntu 16.10
     10 * !LinuxMint 18.1
     11 * !LinuxMint 18.2
     12
     13Here is a somewhat basic copy paste #!bash script for this, however, there will be some manual labor for you :P but a find+replace would help you a lot. Be aware you might run all of these commands with the `sudo -H`
     14
     15{{{#!div class="important"
     16**important** remember to replace the `https://trac-hacks.org/svn/fullblogplugin/0.11` with [https://trac-hacks.org/wiki/FullBlogPlugin latest verion]
     17}}}
     18
     19{{{#!bash
     20apt-get install subversion libapache2-mod-python pypy python python-babel trac python-pip -y
     21pip install --upgrade pip
     22pip install --upgrade Babel
     23pip install --upgrade Trac
     24pip install --upgrade pillow
     25pip install dnspython
     26pip install spambayes
     27pip install oauth2
     28pip install httplib2
     29pip install TracTags
     30pip install TracSpamFilter
     31pip install TracVote
     32easy_install --always-unzip https://trac-hacks.org/svn/fullblogplugin/0.11
     33mkdir -p /var/www/trac/
     34
     35trac-admin /var/www/trac initenv
     36
     37}}}
     38Follow the trac-admin guide...
     39
     40Now lets test the trac before we do more
     41{{{#!bash
     42tracd --port 8000 /var/www/trac
     43lynx localhost:8000/trac
     44}}}
     45
     46Great it's working, then it's time to setup a admin user and password for the admin account. Bad luck if it doesn't as that is beyond this wiki and you'll need to go https://duckduckgo.com to find a solution :(
     47
     48{{{#!bash
     49htpasswd -c /var/www/trac/.htpasswd adminusername
     50trac-admin /var/www/trac/ permission add adminusername TRAC_ADMIN
     51}}}
     52
     53Replace `adminusername` with your desired username
     54
     55Next we set the propper user and group permissions on the Trac folder to allow the !Nginx/Apache/Trac server to access it
     56
     57{{{#!bash
     58chown -R UserName:GroupName /var/www/trac/
     59chmod -R 775 /var/www/trac/
     60}}}
     61
     62== Enable GIT source ==
     63To enable git source brosing we need another subfolder
     64{{{#!bash
     65mkdir -p /var/www/trac/git
     66}}}
     67
     68== Systemd startup script == #SystemD
     69
     70In your `/etc/systemd/system/` make this new file -->
     71{{{#!bash
     72nano /etc/systemd/system/tracd.service
     73}}}
     74{{{#!ini
     75[Unit]
     76Description=TrackD Daemon
     77After=network.target
     78
     79[Service]
     80ExecStart=/usr/local/bin/tracd -p 3050 --protocol=http --basic-auth="*,/var/www/trac/.htpasswd,Restricted" -s /var/www/trac
     81Type=simple
     82User=UserName
     83Group=GroupName
     84
     85[Install]
     86WantedBy=multi-user.target
     87}}}
     88
     89== Nginx configs ==
     90Now it's time to do the NginX configureations :)
     91
     92First we have to make a reverse proxy to the Trac daemon we have made in [#SystemD Systemd startup script]
     93
     94In the `/etc/nginx/nginx.conf` we'll have to add a upstream for our reverse_proxy to Trac
     95{{{#!nginx-conf
     96  upstream live_trachosts_com {
     97        server  127.0.0.1:3050;
     98  }
     99}}}
     100
     101Now make the site.conf file in your preferred location, which by default would be `/etc/nginx/conf.d/` for other it would be in `/etc/nginx/sites-available` but we go whit the default [[br]]
     102`nano /etc/nginx/conf.d/site.conf`
     103
     104{{{#!nginx-conf
     105server {
     106  listen       123.123.123.123:80;
     107  server_name  trac.local;
     108 
     109  charset utf8;
     110  access_log  /var/log/nginx/trac.access.log;
     111  error_log  /var/log/nginx/trac.debug.log;
     112
     113  location / {
     114    proxy_pass  http://live_trachosts_com;
     115    proxy_set_header Host $host;
     116  }
     117 
     118  # redirect server error pages to the static page /50x.html
     119  #
     120  error_page   500 502 503 504  /50x.html;
     121  location = /50x.html {
     122      root   /usr/share/nginx/html;
     123  }
     124
     125  # deny access to .htaccess files, if Apache's document root
     126  # concurs with nginx's one
     127  #
     128  location ~ /\.ht {
     129      deny  all;
     130  }
     131}
     132}}}
     133== Apache ==
     134And since you properly anyway use apache :( well here is that piece of code :(
     135
     136{{{#!bash
     137a2enmod python
     138nano /etc/apache2/sites-available/trac.conf
     139}}}
     140
     141{{{#!apacheconf
     142<VirtualHost 123.123.123.123:80>
     143 ServerName trac.local
     144 <Location />
     145  SetHandler mod_python
     146  PythonInterpreter main_interpreter
     147  PythonHandler trac.web.modpython_frontend
     148  PythonOption TracEnv /var/www/trac
     149  PythonOption TracEnvParentDir /var/www/trac
     150  PythonOption TracUriRoot /
     151  PythonOption TracEnv /var/www/trac
     152  # PythonOption TracEnvIndexTemplate /var/www/trac/templates/index-template.html
     153  PythonOption TracLocale en_US.UTF8
     154  PythonOption PYTHON_EGG_CACHE /tmp
     155  Order allow,deny
     156  Allow from all
     157 </Location>
     158 <Location /login>
     159  AuthType Basic
     160  AuthName "myproject"
     161  AuthUserFile /var/www/trac/.htpasswd
     162  Require valid-user
     163 </Location>
     164</VirtualHost>
     165}}}
     166
     167To enable the trac site run `a2ensite trac.conf`
     168
     169== !Find/Replace ==
     170The following paths is to be replaced with your preferences [[br]]
     171`/var/www/trac` --> `/full/path/to/trac` [[br]]
     172`adminusername` --> `YourUserName` to be used as the track admin [[br]]
     173`UserName` --> The username for which trac daemon runs as ex. `Your login UserName` [[br]]
     174`GroupName` --> The group name for which trac daemon runs as ex `www-data` [[br]]
     175`trac.local` --> `full.domain.tld` [[br]]
     176`live_trachosts_com` --> to what suits your needs [[br]]
     177`123.123.123.123` --> if you are running both NginX and Apache on port 80/443 you'll need to set the IP, but if you only runs Nginx or Apache you can delete the ip to listen on all address
     178
     179== Versions ==
     180In this tutorial I have used the following software versions
     181{{{#!bash
     182$ uname -a
     183Linux hostname 4.11.0-14-generic #20~16.04.1-Ubuntu SMP Wed Aug 9 09:06:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
     184$ tracd --version
     185tracd 1.2.2
     186$ nginx -v
     187nginx version: nginx/1.13.6
     188}}}
     189
     190=== Which list ===
     191A complete HOWTO copy/paste guide to make Nginx running as "Front-end" of trac