Integrate Apache + Trac + Git in Ubuntu

Source: Internet
Author: User
Ps: there is no record on one side of the operation, there may be some issues with permission settings in some places please note the software installation and installation pythonsetuptoolssudoapt-getinstallpython-setuptools install easy_installaptitudeinstallpython-setuptools install git and apachesudoapt-getinstallgitapache configure git

Ps: The operation is not recorded at the same time. Some permission settings may be incorrect.

Software Installation

Install python setuptools

sudo apt-get install python-setuptools

Install easy_install

aptitude install python-setuptools

Install git and apache

sudo apt-get install git apache
Configure the git Server
  1. Install gitosis

    git clone git://eagain.net/gitosis.gitcd gitosissudo python setup.py install
  2. Add User git

    sudo adduser \    --system \    --shell /bin/sh \    --gecos 'git version control' \    --group \    --disabled-password \    --home /home/git \    git
  3. Generate a local key
    Switch to a man-machine. If yes ~ /. Ssh/id_rsa.pub skip this step

    ssh-keygen -t rsa
  4. Upload the key to the temporary directory on the server
    Scp ~ /. Ssh/id_rsa.pub username @ host:/tmp
  5. Initial gitosis
    Switch back to server

    sudo -H -u git gitosis-init < /tmp/id_rsa.pub
  6. Modify post-update permission

    sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
  7. Clone gitosis Management Platform
    Switch to local

    Git clone git @ host name: gitosis-admin.gitcd gitosis-admin

By now, the git server has been configured. Below are some common management methods for the git server.

Add User
  1. The user to be added runs ssh-keygen-t rsa on the computer to generate id_rsa.pub and sends it to the git administrator.
  2. The git administrator copies the user's id_rsa.pub to the keydir directory under gitosis-admin and changes the file name to the user name to be added.
  3. The git administrator modifies the gitosis. conf file in the gitosis-admin directory and adds the username to the members row of the project to be authorized, separated by spaces.
  4. Upload and modify

    Cd gitosis-admingit add gitosis. confcd keydirgit add {user's id_rsa.pub file name} git commit-m "add User XXX" git push
Create a git repository for the project
  1. Modify the gitosis. conf file

    cd gitosis-adminvim gitosis.conf

    Add the following content at the end of the file

    [Group test] members = {users to be authorized, separated by spaces} writable = test
  2. Submit changes

    Git add gitosis. confgit commit-m "add project test configuration" git push
  3. Create a project library

    Mkdir testgit inittouch READMEgit add READMEgit commit-m' create a project 'git remote add origin git {your domain name}: test. gitgit push-u origin master
Install trac
  1. Install Genshi
    wget http://ftp.edgewall.com/pub/genshi/Genshi-0.6.tar.gztar xzvf Genshi-0.6.tar.gzcd Genshi-0.6sudo python setup.py install
  2. Install the localized module Babel. To support internationalization

    easy_install babel
  3. Install Trac

    wget http://ftp.edgewall.com/pub/trac/Trac-0.12.2.tar.gztar xzvf Trac-0.12.2.tar.gzcd Trac-0.12.2sudo python setup.py install
Integrate trac and apache
  1. Create the trac directory under the web root directory

    cd /var/wwwsudo mkdir tracsudo chown www-data:www-data trac
  2. Add trac Virtual Host Configuration

    cd /etc/apache/conf.dsudo vim trac
  3. Insert the following configuration in vim:

       
        
    DocumentRoot "/var/www/trac" ServerName trac. {your domain name} SetHandler mod_python PythonInterpreter main_interpreter PythonHandler trac. web. modpython_frontend PythonOption TracEnvParentDir/var/www/trac PythonOption TracUriRoot/PythonOption PYTHON_EGG_CACHE/tmp/egg-cache
       
  4. Restart apache

    sudo /etc/init.d/apache2 restart

Next, visit http: // trac. {your domain name}. If "Available Projects" is displayed, the configuration is successful.

Create a project
  1. cd /var/www/tractrac-admin test initenvchown -R www-data.www-data test

    Then visit http: // trac. {youhost}/test to see the main interface of Trac!

  2. Add User

    cd /var/wwwhtpasswd -c .htpasswd admin

    If the. htpasswd file already exists (the second time you add a user), remove-c.
    Modify VM configurations

       
        
         
    DocumentRoot "/var/www/trac" ServerName trac. {your domain name} SetHandler mod_python PythonInterpreter main_interpreter PythonHandler trac. web. export PythonOption TracEnvParentDir/var/www/trac PythonOption TracUriRoot/PythonOption PYTHON_EGG_CACHE/tmp/egg-cache AuthType Basic AuthName "My Trac Server" AuthUserFile/var/www /. htpasswd Require valid-user
        
       
Integrate trac and git
  1. Install the trac-git plug-in with the Project address: http://trac-hacks.org/wiki/GitPlugin

    easy_install http://github.com/hvr/trac-git-plugin/tarball/master
  2. Update trac Configuration

    cd /var/www/trac/vim trac.ini

    Add

    [trac]# simple single-repository configurationrepository_dir = /var/git/Test.gitrepository_type = git## the following settings are only supported for plugin version 0.11 or later[git]## let Trac cache meta-data via CachedRepository wrapper; default: falsecached_repository = true## disable automatic garbage collection for in-memory commit-tree cache; default: falsepersistent_cache = true## length revision sha-sums should be tried to be abbreviated to (must be >= 4 and <= 40); default: 7shortrev_len = 6## (0.12.0.3+) minimum length for which hex-strings will be interpreted as commit ids in wiki context; default: 40wiki_shortrev_len = 7## executable file name (in case of doubt use absolute path!) of git binary; default: 'git'git_bin = /usr/src/git-dev/git## (0.12.0.5+) define charset encoding of paths stored within git repository; default: 'utf-8'git_fs_encoding = latin1## (0.12.0.3+) enable reverse mapping of git email addresses to trac user ids; default: falsetrac_user_rlookup = true## (0.12.0.3+) use git-committer id instead of git-author id as changeset owner; default: trueuse_committer_id = false## (0.12.0.3+) use git-committer timestamp instead of git-author timestamp as changeset time; default: trueuse_committer_time = false
  3. Set the test. git directory permission to allow apache www-data users to access

    cd /home/git/repositoriessudo chmod a+r test.git

Refresh trac and check the effect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.