杨叔叔 发表于 2018-5-9 06:44:10

Ubuntu安装Trac+svn+apache+ldap+[mysql]认证

Ubuntu安装Trac+svn+apache+ldap认证

权限全为www-data:www-dataapt-get installlibapache2-svn libsvn-perllibsvn1 libldap-2.4-2 libldap2-devtrac libapache2-mod-python libapache2-mod-python-docapache2-mpm-prefork
####trac default usesqlite database to depositproject database
####butyou can use other database software “mysql,postgresql


root@wikiserver:/etc/apache2/mods-available#vi dav_svn.conf###没配置
root@wikiserver:/etc/apache2/mods-available#vi ../apache2.conf


<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>


ServerTokens Full
ServerSignature On


root@wikiserver:/etc/apache2/mods-available#vi ../httpd.conf


Redirect permanent/<project> http://<ip/hostname>/<project>
Redirect permanent/<project> http://<ip/hostname>/<project>


<Location/Projects>
   SetHandlermod_python
   PythonInterpretermain_interpreter
   PythonHandlertrac.web.modpython_frontend
   PythonOptionTracEnvParentDir /srv/trac/projects
   PythonOptionTracUriRoot /Projects
</Location>


<LocationMatch"/Projects/[^/]+/login">
      AuthTypeBasic
      AuthName"projects"
      AuthBasicProvider"ldap"
      AuthLDAPURL"ldap://scidc02.domainname.com:3268/Dc=domainname,dc=com?sAMAccountName?sub?(objectClass=user)"
      AuthLDAPBindDN      trac@domainname.com
      AuthLDAPBindPassword"123456"
      authzldapauthoritativeOff
      requirevalid-user CN=Users,dc=domainname,dc=com
</LocationMatch>


<Location/project>
   SetHandlermod_python
   PythonInterpretermain_interpreter
   PythonHandlertrac.web.modpython_frontend
   PythonOptionTracEnv /srv/trac/projects/project
   PythonOptionTracUriRoot /project
</Location>


<Location/Project/login>
      AuthTypeBasic
      AuthName"project"
      AuthBasicProvider"ldap"
      AuthLDAPURL"ldap://scidc02.domainname.com:3268/Dc=domainname,dc=com?sAMAccountName?sub?(objectClass=user)"
      AuthLDAPBindDN      trac@domainname.com
      AuthLDAPBindPassword"123456"
      authzldapauthoritativeOff
      requirevalid-user CN=Users,dc=domainname,dc=com
</Location>


<Location/project>
   SetHandlermod_python
   PythonInterpretermain_interpreter
   PythonHandlertrac.web.modpython_frontend
   PythonOptionTracEnv /srv/trac/projects/project
   PythonOptionTracUriRoot /Sandbox
</Location>


<Location/project/login>
      AuthTypeBasic
      AuthName"project"
      AuthBasicProvider"ldap"
      AuthLDAPURL"ldap://scidc02.domainname.com:3268/Dc=domainname,dc=com?sAMAccountName?sub?(objectClass=user)"
      AuthLDAPBindDN      trac@domainname.com
      AuthLDAPBindPassword"123456"
      authzldapauthoritativeOff
      requirevalid-user CN=Users,dc=domainname,dc=com
</Location>


<Location /svn>
DAV svn
SVNParentPath/srv/svn_repo
      aUTHtypeBasic
      AuthName"Subversion repository"
      AuthBasicProvider"ldap"
      AuthLDAPURL"ldap://scidc02.domainname.com:3268/Dc=domainname,dc=com?sAMAccountName?sub?(objectClass=user)"
      AuthLDAPBindDN      trac@domainname.com
      AuthLDAPBindPassword"123456"
      authzldapauthoritativeOff
      requirevalid-user CN=Users,dc=domainname,dc=com
</Location>


<Location/mpinfo>
   SetHandlermod_python
   PythonInterpretermain_interpreter
   PythonHandlermod_python.testhandler
</Location>


###enable python
a2enmodpython
###enableldap auth
a2enmod authnz_ldap


trac配置项目:
root@SHTRAC01:/srv/trac/projects#pwd
/srv/trac/projects
root@SHTRAC01:/srv/trac/projects#ls
projectsprojects   projects


svn项目:
root@SHTRAC01:/srv/svn_repo#ls
AeSwExchgSamsung   TD-Project
root@SHTRAC01:/srv/svn_repo#pwd
/srv/svn_repo


###############################################
###if you use otherdatabase softwarelike mysql:
登陆MySQL
#mysqlmysql -u root -p
创建用户trac
mysql>GRANTALL PRIVILEGES ON *.* TO trac@'%' IDENTIFIED BY 'password' WITH GRANTOPTION;
mysql>flush privileges;
###############################################



创建trac项目环境:
root@SHTRAC01:~# trac-admin eeeinitenv
Creating a new Trac environment at/root/eee

Trac will first ask a few questionsabout your environment
in order to initialize and prepare theproject database.

Please enter the name of yourproject.
This name will be used in page titlesand descriptions.

Project Name > eee

Please specify the connection stringfor the database to use.
By default, a local SQLite database iscreated in the environment
directory. It is also possible to usean already existing
PostgreSQL database (check the Tracdocumentation for the exact
connection string syntax).

Database connection string>
###############################################
#Database connection string>mysql://trac:password@localhost:1521/project//这里我们用MySQL数据库,如果用SQLite直接回车即可   
###############################################
Please specify the type of versioncontrol system,
By default, it will be svn.

If you don't want to use Trac withversion control integration,
choose the default here and don'tspecify a repository directory.
in the next question.

Repository type >

Please specify the absolute path tothe version control
repository, or leave it blank to useTrac without a repository.
You can also set the repositorylocation later.

Path to repository ><svn project name path>


####start apache
/etc/init.d/apache2 start/restart/stop
页: [1]
查看完整版本: Ubuntu安装Trac+svn+apache+ldap+[mysql]认证