红联Linux门户
Linux帮助

ubuntu安装trac

发布时间:2016-02-21 11:22:51来源:linux网站作者:youbo_sun

1.安装trac

$ sudo apt-get install trac


2.初始化项目

$ sudo mkdir –p /var/trac/digcredit   #创建目录

$ cd /var/trac/digcredit

$ sudo trac-admin . initenv # 利用安装trac生成的命令初始化项目环境


3.添加admin管理员

$ sudo apt-get install apache2-utils

$ sudo htpasswd -c .htpasswd admin  #设置admin用户及密码(密码根据交互提示设置)

$ sudo trac-admin . permission add admin TRAC_ADMIN  #添加admin为trac admin


4.设置项目所属用户

$ sudo chown –R www-data: .

$ sudo chmod -R 775 .


5.创建trac wsgi文件:wsgi_trac.py

存入/var/trac/digcredit,文件内容如下:

import os

importsys

importtrac.web.main

sys.stdout=sys.stderr

os.environ['TRAC_ENV']= '/var/trac/digcredit'

application= trac.web.main.dispatch_request


6.配置supervisor启动文件

[program:trac]

command=uwsgi

--chdir /var/trac/digcredit

--module wsgi_trac:application

--socket 127.0.0.1:7520

--processes 4

--threads 4

--master

--thunder-lock

--harakiri 60

stopsignal=QUIT

autostart=false

autorestart=false

stdout_logfile=/var/log/supervisor/trac/error.log

stderr_logfile=/var/log/supervisor/trac/access.log


7.配置nginx转发

upstreamtrac {

server 127.0.0.1:7520;

}

#configuration of the server

server {

# the port your site will be served on

listen     7000;

# the domain name it will serve for

server_name localhost; # substitute yourmachine's IP address or FQDN

charset    utf-8;

# Finally, send all non-media requests tothe Django server.

location / {

auth_basic_user_file/var/trac/digcredit/.htpasswd;

auth_basic 'this is not for you';

uwsgi_param REMOTE_USER $remote_user;

uwsgi_pass  trac;

include     /etc/nginx/uwsgi_params; # theuwsgi_params file you installed

}

}


8.问题

a.启动用户需要有trac数据库目录的读写权限

b.设置head log 图片,默认目录为:/var/lib/apache2/site


本文永久更新地址:http://www.linuxdiyf.com/linux/18262.html