2011年7月3日 星期日

Ubuntu 11.04 安裝 Trac

//===================
// 安裝 trac
//==================
1.安裝 trac
  sudo apt-get install trac

//===================
// 安裝PostgreSQL數據庫
//===================
1.安裝 postgresql
  sudo apt-get install postgresql


2.為了讓trac能訪問PostgreSQL,則需要安裝python-psycopg2模塊:
  sudo apt-get install python-psycopg2

3.啟動PostgreSQL伺服器daemon:
  sudo /etc/init.d/postgresql start

//=========================
// 設定PostgreSQL用戶和數據庫
//=========================
1.添加PostgreSQL用戶和數據庫也很簡單,只需要輸入下列命令:

  sudo -u postgres sh (切换到postgres用户)
  createuser -A -D -P username (创建username用户,并提示输入密码,请输入123456以便和下文对应)
  Shall the new role be allowed to create more new roles? (y/n) y
  createdb -O username trac (创建trac数据库)
  exit (退出postgres用户,回到正常用户提示行)

//========================
//創建配置Trac環境
//========================
1.Trac用目錄和數據庫來儲存計劃信息, 叫做”環境“。一個新的Trac環境是通過使用trac-admin創建出來的,同Subversion一樣,Trac環境可以放至在任意位置,由於Trac是個Web應用,是通過Apache來訪問的,所以通常將其設在/var/www目錄中。具體命令及設置如下:

cd /var/www
sudo mkdir trac
sudo chown -R www-data:www-data trac
sudo -u www-data trac-admin trac initenv
Project Name [My Project]> project1 (在这里输入你的项目名称)
Database connection string [sqlite:db/trac.db]>postgres://username:123456@localhost/trac (输入PostgreSQL数据库的位置)
Repository type [svn]>
Path to repository [/path/to/repos]> /home/svnroot/project1

2.執行
tracd --port 8000 /var/www/trac

3.驗證
http://localhost:8000/trac


//=======
// 參考連結
//=======
Ubuntu Trac

沒有留言: