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
- Install gitosis
git clone git://eagain.net/gitosis.gitcd gitosissudo python setup.py install
- Add User git
sudo adduser \ --system \ --shell /bin/sh \ --gecos 'git version control' \ --group \ --disabled-password \ --home /home/git \ git
- Generate a local key
Switch to a man-machine. If yes ~ /. Ssh/id_rsa.pub skip this step
ssh-keygen -t rsa
- Upload the key to the temporary directory on the server
Scp ~ /. Ssh/id_rsa.pub username @ host:/tmp
- Initial gitosis
Switch back to server
sudo -H -u git gitosis-init < /tmp/id_rsa.pub
- Modify post-update permission
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
- 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
- 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.
- 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.
- 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.
- 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
- 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
- Submit changes
Git add gitosis. confgit commit-m "add project test configuration" git push
- 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
- 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
- Install the localized module Babel. To support internationalization
easy_install babel
- 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
- Create the trac directory under the web root directory
cd /var/wwwsudo mkdir tracsudo chown www-data:www-data trac
- Add trac Virtual Host Configuration
cd /etc/apache/conf.dsudo vim trac
- 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
- 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
-
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!
- 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
- 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
- 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
- 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.