wiki:Quick-Start

How to quickly get started with Trac on a new machine

This will set up a Trac system at localhost/trac/foo and a SVN repository at localhost/svn/foo with a test user named bar. You can change foo and bar to the names of your choosing, or create additional repositories and trac sites in parallel directories in the same manner.

  1. Get the .iso file for MX Linux. You can find it (and alternatives) at http://distrowatch.org Many other distros would work but this was chosen because it's currently the top listed there, and because Mint had problems installing python modules.
  1. Get Virtualbox. You can get it at http://virtualbox.org for free and install it and create a new virtual machine with it and install the .iso file. You now have a fresh operating system installation on the new virtual machine. (if you have something equivalent like Parallels already installed, or are starting with a bare metal machine that you wish to reformat and start fresh, don't bother with Virtualbox)
  1. Issue the following commands (you probably don't need all of these packages. Someone with time to eliminate the unnecessary ones and test please do so and shorten the list. This has not been tested since being generified)
sudo apt update -y
sudo apt full-upgrade -y,
sudo apt-get -y install g++ trac default-jdk figlet apache2 subversion gufw libapache2-mod-python libapache2-mod-svn apache2-utils python-subversion libsvn-java openssh-server dconf-editor glogg tree traceroute curl apparmor apparmor-utils libapache2-mod-svn python-setuptools python-jinja2 python3-pip jq python-configparser python-tk certbot python3-certbot-apache
sudo apt autoremove -y
sudo mkdir -m 2660 /srv/auth /var/www/svn /var/www/trac
sudo svnadmin create /var/www/svn/foo
sudo trac-admin /var/www/trac/foo initenv
sudo chmod -R g+rw /var/www/trac/
sudo chmod +x svn trac
sudo trac-admin /var/www/trac/foo config set components "tracopt.versioncontrol.svn.*" enabled
sudo trac-admin /var/www/trac/foo config set trac permission_policies AuthzSourcePolicy,ReadonlyWikiPolicy,DefaultPermissionPolicy,LegacyAttachmentPolicy
sudo trac-admin /var/www/trac/foo config set trac authz_file /srv/auth/authz
sudo trac-admin /var/www/trac/foo config set trac repository_dir /var/svn/foo 
sudo trac-admin /var/www/trac/shared permission add bar

sudo reboot
  1. If you're running an actual system rather than a test site, you will want get a certificate for your domain name if you don't already have one. Then issue this command
certbot --apache

Enter your email, confirm, choose to redirect to https

As a result, you will visit the site at https:// with the domain name that you own instead of http:

  1. Create file files using the (sudo featherpad commmand)

/var/apache2/sites-available/trac.conf

  <Location /svn>
    AuthName           "TracAuth"
    SVNParentPath      /var/www/svn
    SVNListParentPath  on
    AuthUserFile       /srv/auth/htpasswd
    AuthzSVNAccessFile /srv/auth/authz
    DAV svn
    AuthType Basic
    Require valid-user
  </Location>
  <Location /trac>
    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend
    PythonOption TracUriRoot              /trac
    PythonOption TracEnvParentDir /var/www/trac
  </Location>
  <Location /trac/foo/login>
    AuthType Basic
    AuthName           "TracAuth"
    AuthUserFile /srv/auth/htpasswd
    Require valid-user
  </Location>

/srv/auth/authz

[/]
* = r
bar = rw
  1. Issue these commands
sudo chown www-data:www-data -R /var/www/*
sudo htpasswd -c /var/www/auth/htpasswd  bar
sudo a2ensite trac.conf
sudo apache2ctl restart
  1. Browse the website at http://localhost/trac for the trac site, and https://localhost/svn for the svn site.

(Someone can add here an example of checking in some documents and browsing them, creating a trac ticket, etc. for first time users to follow, and change the script to create the files above using heredoc so the user only needs to paste a script and run it on a fresh install. Maybe also move the certbot stuff to the end so everything before it can be in a script.)

Last modified 10 months ago Last modified on Jan 25, 2021, 8:35:06 AM
Note: See TracWiki for help on using the wiki.