📜 ⬆️ ⬇️

TRAC installation for FreeBSD for beginners

The trac project


I will not describe its capabilities and why this system is needed, everything is on off. site ( http://trac.edgewall.org ) or in wikipedia .
I will consider only installation and configuration in detail for beginners (the article is dedicated to a friend Enver from Ryazan, it may still be useful to someone), this article will not bring benefit to anyone who has already experienced this.

A bunch of FreeBSD + SVN + Apache2 + Trac


For beginners, more about the bundle and how to work

All sources of the developed software are in SVN (it is convenient to see all the changes and it is always easy to roll back if necessary).
Trac is a system that provides the possibility of interactive work primarily with the svn repository, as well as wikis (not counting additional modules).

Installation

The first install Apache 2.2
cd /usr/ports/www/apache22
make WITH_BERKELEYDB=db42 install


Download and install mod python
cd /tmp
fetch http://www.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz
tar -xvf mod_python-3.3.1.tgz
cd mod_python-3.3.1
./configure
make
make install
rm -R mod_python-3.3.1 mod_python-3.3.1.tgz


Next SVN
cd /usr/ports/devel/subversion
make WITH_MOD_DAV_SVN= install


Installing Trac and the webadmin module
cd /usr/ports/www/trac
make install
cd /usr/ports/www/trac-webadmin/
make install


if you wish, you can install other modules, at your discretion

Customization

Now that everything is set up we proceed with the configuration, first we will configure Subversion.
Create a directory for storing repositories, because we will use access via Apache with the WebDav module, it is better to store them in a folder with Apache group rights
mkdir /usr/local/www/repository

create a project
svnadmin create /usr/local/www/repository/project_name

recursively assign the rights of the group and the user apache
chown -R www:www /usr/local/www/repository

create a file with users and passwords
htpasswd -c /usr/local/etc/project_name.passwd user_name
to add a user the same command, but without the -c switch
')
Go to Apache
Check if mod_dav_svn is enabled in the Apache config edit /usr/local/etc/apache22/httpd.conf (there should be a LoadModule line dav_svn_module libexec / apache22 / mod_dav_svn.so )
add below
LoadModule python_module libexec/apache22/mod_python.so

uncomfortable below
Include etc/apache22/extra/httpd-vhosts.conf
save ...

open the file with virtual hosts edit /usr/local/etc/apache22/extra/httpd-vhosts.conf and edit
NameVirtualHost *:80

<VirtualHost *:80>
ServerAdmin webmaster@project_name.ru
DocumentRoot "/usr/local/www/trac/htdocs"
ServerName trac.project_name.ru
ErrorLog "/var/log/trac.project_name.ru-error_log"

<Location ~ "/(svn|project_name/login)">
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /usr/local/etc/project_name.passwd
Require valid-user
</Location>

<Location /svn>
DAV svn
SVNParentPath /usr/local/www/repository
</Location>
</VirtualHost>


save changes and restart apache
apachectl restart

We check the repository for operability through a browser and SVN-client (I use Subcommander and SmartSVN under Linux and Windows, respectively) server_ip / svn / project_name and using the logins of users you created.

Next, create a project in Trac

we create a folder for projects, we copy a statics
cd /usr/local/www
mkdir trac
cd trac
mkdir -pv /usr/local/www/trac/htdocs/i
cp -R /usr/local/share/trac/htdocs/* /usr/local/www/trac/htdocs/i
echo "<html><body><a href=/project_name>Project Name</a></body></html>" >> /usr/local/www/trac/htdocs/index.html


and create the project itself
trac-admin project_name initenv
Further we install by instructions,
Project name
the base is used by default sqlite just click (for other databases the information here is http://trac.edgewall.org/wiki/DatabaseBackend )
repository type: svn
repository path: / usr / local / www / repository / project_name
the rest is default ...

open the edit project for editing edit /usr/local/www/trac/project_name/conf/trac.ini
find directives and set new values
htdocs_location = /i/
default_charset = utf-8
base_url =http://server_ip/project_name


and at the end add the webadmin module
[components]
webadmin.* = enabled

More details on all directives here trac.edgewall.org/wiki/TracIni

assign administrator rights to one of the users
trac-admin /usr/local/www/trac/project_name permission add user_name TRAC_ADMIN

we do project synchronization
trac-admin /usr/local/www/trac/project_name resync

after installation, assign rights to the project folder again
chown -R www:www /usr/local/www/trac

We check Trac tracd --port 8000 /usr/local/www/trac/project_name for operability and watch it in the browser http: // server_ip: 8000
To complete the process, use the combination <Ctrl + C>

If everything works fine, then it’s necessary that Trac launches the Apache ...
Open again for editing.
edit /usr/local/etc/apache22/extra/httpd-vhosts.conf

Add
<Location /project_name>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv/usr/local/www/trac/project_name
PythonOption TracUriRoot /project_name
</Location>


Restart Apache again and open it in the browser http: // server_ip / project_name
We go under the administrator's login and we put things in order. Do not forget to put down access rights for users of http://trac.edgewall.org/wiki/TracPermissions

For Linux systems, only the installation process and file paths differ.

You can have several projects on one server, so you only need to create a new project in svn and trac and add them to httpd-vhosts.conf

PS: The article was written with maximum simplification to understand the initial Linux users, therefore, comments with the fact that “it’s better to do this way” or “it’s safer to be like this” can be omitted, because I assumed that the server is in the company's local network, and not on the Internet ...

Source: https://habr.com/ru/post/45389/


All Articles