Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
Git CentOS 7 - GitWeb
Git ist ein freies auf Open-Source basierendes Versionskontrollsystem, entwickelt um kleine bis sehr große Projekte, schnell und effizient verwalten zu können.
Mit Git ab der Version 1.4.0 wird standardmäßig GitWeb ausgeliefert. GitWeb ist eine simple webbasierte CGI-Skript, welches zur Visualisierung von Git-Repositorys zum Einsatz kommen kann.
Beschreibung | Externer Link |
---|---|
Homepage | https://git.wiki.kernel.org/index.php/Gitweb |
Ab hier werden root
-Rechte zur Ausführung der nachfolgenden Befehle benötigt. Um der Benutzer root
zu werden, geben Sie bitte nachfolgenden Befehl ein:
$ su - Password:
Voraussetzungen
Als Voraussetzung für die hier, nachfolgend dargestellte Installation von Git sind folgende Komponenten erforderlich:
- Lauffähiges Git WICHTIG - Alle nachfolgenden Beschreibungen bauen auf folgende Installation von Git auf:
- Siehe auch den internen Link: Git CentOS 7
- Git als Installationspaket
- ab der Version 1.6.6 oder höher
- Lauffähiger Web-Server z.B. Apache HTTP Server
- Siehe auch den internen Link: Apache HTTP Server CentOS 7
- Siehe auch den internen Link: Apache HTTP Server CentOS 7 - mod_ssl - Verschlüsselung (https)
- Siehe auch den internen Link: Apache HTTP Server CentOS 7 - mod_ldap - LDAP-Authentifizierung
- Lauffähiger LDAP-Server z.B. OpenLDAP
- Siehe auch den internen Link: LDAP CentOS 7
Installation
Die Installation kann aus den Standard CentOS-Repositorys erfolgen und wird mit nachfolgendem Befehl durchgeführt:
# yum install gitweb Loaded plugins: changelog, priorities base | 3.6 kB 00:00 epel | 4.4 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 65 packages excluded due to repository priority protections Resolving Dependencies --> Running transaction check ---> Package gitweb.noarch 0:1.8.3.1-4.el7 will be installed --> Finished Dependency Resolution Changes in packages about to be updated: Dependencies Resolved =============================================================================== Package Arch Version Repository Size =============================================================================== Installing: gitweb noarch 1.8.3.1-4.el7 base 109 k Transaction Summary =============================================================================== Install 1 Package Total download size: 109 k Installed size: 320 k Is this ok [y/d/N]: y Downloading packages: gitweb-1.8.3.1-4.el7.noarch.rpm | 109 kB 00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : gitweb-1.8.3.1-4.el7.noarch 1/1 Verifying : gitweb-1.8.3.1-4.el7.noarch 1/1 Installed: gitweb.noarch 0:1.8.3.1-4.el7 Complete!
Mit nachfolgendem Befehl kann überprüft werden, welche Inhalte mit den Paket git
installiert wurden.
# rpm -qil gitweb Name : gitweb Version : 1.8.3.1 Release : 4.el7 Architecture: noarch Install Date: Fri 07 Aug 2015 09:40:30 AM CEST Group : Development/Tools Size : 327778 License : GPLv2 Signature : RSA/SHA256, Fri 04 Jul 2014 03:33:03 AM CEST, Key ID 24c6a8a7f4a80eb5 Source RPM : git-1.8.3.1-4.el7.src.rpm Build Date : Tue 10 Jun 2014 10:40:28 AM CEST Build Host : worker1.bsys.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : http://git-scm.com/ Summary : Simple web interface to git repositories Description : Simple web interface to track changes in git repositories /etc/gitweb.conf /etc/httpd/conf.d/git.conf /usr/share/doc/gitweb-1.8.3.1 /usr/share/doc/gitweb-1.8.3.1/INSTALL /usr/share/doc/gitweb-1.8.3.1/README /var/www/git /var/www/git/gitweb.cgi /var/www/git/static /var/www/git/static/git-favicon.png /var/www/git/static/git-logo.png /var/www/git/static/gitweb.css /var/www/git/static/gitweb.js
Konfiguration
Nachfolgende Konfigurationsdateien sind für den Einsatz von GitWeb erforderlich:
/etc/gitweb.conf
- Hauptkonfigurationsdatei/etc/httpd/conf.d/git.conf
- Konfigurationsdatei für den Apache HTTP Server
/etc/gitweb.conf
Nachfolgende Anpassungen sind für den Betrieb mindestens erforderlich:
Relevante Änderungen sind mit einem vorangestellten Kommentar, welcher wie nachfolgend dargestellt aussieht, gekennzeichnet:
# Tachtler
(Komplette Konfigurationsdatei):
# The gitweb config file is a fragment of perl code. You can set variables # using "our $variable = value"; text from "#" character until the end of a # line is ignored. See perlsyn(1) man page for details. # # See /usr/share/doc/gitweb-*/README and /usr/share/doc/gitweb-*/INSTALL for # more details and available configuration variables. # Set the path to git projects. This is an absolute filesystem path which will # be prepended to the project path. # Tachtler # default: #our $projectroot = "/var/lib/git"; our $projectroot = "/srv/git"; # Set the list of git base URLs used for URL to where fetch project from, i.e. # the full URL is "$git_base_url/$project". By default this is empty # Tachtler # default: #our @git_base_url_list = qw(git://git.example.com # default: # ssh://git.example.com/var/lib/git); our @git_base_url_list = qw(http://git.tachtler.net https://git.tachtler.net); # Enable the 'blame' blob view, showing the last commit that modified # each line in the file. This can be very CPU-intensive. Disabled by default #$feature{'blame'}{'default'} = [1]; # # Allow projects to override the default setting via git config file. # Example: gitweb.blame = 0|1; #$feature{'blame'}{'override'} = 1; # Disable the 'snapshot' link, providing a compressed archive of any tree. This # can potentially generate high traffic if you have large project. Enabled for # .tar.gz snapshots by default. # # Value is a list of formats defined in %known_snapshot_formats that you wish # to offer. #$feature{'snapshot'}{'default'} = []; # # Allow projects to override the default setting via git config file. # Example: gitweb.snapshot = tbz2,zip; (use "none" to disable) #$feature{'snapshot'}{'override'} = 1; # Disable grep search, which will list the files in currently selected tree # containing the given string. This can be potentially CPU-intensive, of # course. Enabled by default. #$feature{'grep'}{'default'} = [0]; # # Allow projects to override the default setting via git config file. # Example: gitweb.grep = 0|1; #$feature{'grep'}{'override'} = 1; # Disable the pickaxe search, which will list the commits that modified a given # string in a file. This can be practical and quite faster alternative to # 'blame', but still potentially CPU-intensive. Enabled by default. #$feature{'pickaxe'}{'default'} = [0]; # # Allow projects to override the default setting via git config file. # Example: gitweb.pickaxe = 0|1; #$feature{'pickaxe'}{'override'} = 1;
Erklärungen zu den Konfigurationsdateiänderungen:
# Set the path to git projects. This is an absolute filesystem path which will # be prepended to the project path. # Tachtler # default: #our $projectroot = "/var/lib/git"; our $projectroot = "/srv/git"; # Set the list of git base URLs used for URL to where fetch project from, i.e. # the full URL is "$git_base_url/$project". By default this is empty # Tachtler # default: #our @git_base_url_list = qw(git://git.example.com # default: # ssh://git.example.com/var/lib/git); our @git_base_url_list = qw(http://git.tachtler.net);
our $projectroot = "/srv/git";
Setzen des Verzeichnispfades zu dem Speicherort, an dem die Git-Repositorys im Dateisystem abgelegt sind.
our @git_base_url_list = qw(http://git.tachtler.net https://git.tachtler.net);
Setzen der Basis-URLs, unter denen die Git-Repositorys erreichbar sind.
/etc/httpd/conf.d/git.conf
Die mit der Installation von GitWeb mitgelieferte Konfigurationsdatei
/etc/httpd/conf.d/git.conf
soll nachfolgend nicht zum Einsatz kommen.
Die nötigen Konfigurationen des Apache HTTP Server sollen in einem VHOST erfolgen, wie unter nachfolgenden internen Links bereits beschrieben.
Aufbauen auf vorhergehender Konfiguration aus nachfolgendem internen Link
sind nachfolgende erneute Anpassungen durchzuführen.
WICHTIG - Nachfolgende Konfigurationen stellen eine grundlegende Apache HTTP Server-VHOST-Konfiguration dar.
Weitere Einzelheiten zu Apache HTTP Server-VHOST sind in der Dokumentation zum Apache HTTP Server verfügbar!
Nachfolgend ein Beispiel für einen Apache HTTP Server-VHOST via http:
# # git.tachtler.net (Git Repository Bare Remote Server) # <VirtualHost *:80> ServerAdmin webmaster@tachtler.net ServerName git.tachtler.net ServerAlias www.git.tachtler.net ServerPath / <Directory "/usr/libexec/git-core"> Options None AllowOverride None Require all granted </Directory> ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ SetEnv GIT_PROJECT_ROOT /srv/git SetEnv GIT_HTTP_EXPORT_ALL DocumentRoot "/srv/git" <Directory "/srv/git"> Options -Indexes +FollowSymLinks +ExecCGI AllowOverride None # LDAP AuthType Basic AuthName "Git Repository Bare Remote Server (git.tachtler.net)" AuthBasicProvider ldap AuthLDAPURL "ldaps://ldap.tachtler.net:636/dc=tachtler,dc=net?uid" AuthLDAPBindDN "cn=Ersatzbenutzer,dc=tachtler,dc=net" AuthLDAPBindPassword "geheim" <RequireAll> Require ldap-user klaus </RequireAll> </Directory> # Tachtler # Repository: homepage.git # ---------------------------------------------------------------------------------------------------- <Location /git/homepage.git> # LDAP AuthType Basic AuthName "Git Repository - homepage (git.tachtler.net/git/homepage.git)" AuthBasicProvider ldap AuthLDAPURL "ldaps://ldap.idmz.tachtler.net:636/dc=tachtler,dc=net?uid" AuthLDAPBindDN "cn=Ersatzbenutzer,dc=tachtler,dc=net" AuthLDAPBindPassword "geheim" <RequireAll> Require ldap-user klaus </RequireAll> </Location> ErrorLog logs/git_error.log CustomLog logs/git_access.log combined </VirtualHost>
Nachfolgend ein Beispiel für einen Apache HTTP Server-VHOST via https:
# # git.tachtler.net (Git Repository Bare Remote Server) # <VirtualHost *:443> ServerAdmin webmaster@tachtler.net ServerName git.tachtler.net ServerPath / SSLEngine on SSLProtocol all -SSLv2 -SSLv3 SSLHonorCipherOrder on SSLCipherSuite "ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4" SSLCertificateFile /etc/pki/httpd/certs/tachtler.net.crt SSLCertificateKeyFile /etc/pki/httpd/private/tachtler.net.key SSLCertificateChainFile /etc/pki/httpd/certs/CAcert_chain.pem SSLCACertificateFile /etc/pki/httpd/certs/CAcert_root.pem <Directory "/usr/libexec/git-core"> Options None AllowOverride None Require all granted </Directory> ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/ SetEnv GIT_PROJECT_ROOT /srv/git SetEnv GIT_HTTP_EXPORT_ALL DocumentRoot "/srv/git" <Directory "/srv/git"> Options -Indexes +FollowSymLinks +ExecCGI AllowOverride None # LDAP AuthType Basic AuthName "Git Repository Bare Remote Server (git.tachtler.net)" AuthBasicProvider ldap AuthLDAPURL "ldaps://ldap.idmz.tachtler.net:636/dc=tachtler,dc=net?uid" AuthLDAPBindDN "cn=Ersatzbenutzer,dc=tachtler,dc=net" AuthLDAPBindPassword "geheim" <RequireAll> # (enable for LDAP access) Require ldap-user klaus </RequireAll> </Directory> # Tachtler # Repository: homepage.git # ---------------------------------------------------------------------------------------------------- <Location /git/homepage.git> # LDAP AuthType Basic AuthName "Git Repository - homepage (git.tachtler.net/git/homepage.git)" AuthBasicProvider ldap AuthLDAPURL "ldaps://ldap.idmz.tachtler.net:636/dc=tachtler,dc=net?uid" AuthLDAPBindDN "cn=Ersatzbenutzer,dc=tachtler,dc=net" AuthLDAPBindPassword "geheim" <RequireAll> Require ldap-user klaus </RequireAll> </Location> <Files ~ "\.(cgi|shtml|phtml|php3?)$"> SSLOptions +StdEnvVars </Files> <Directory "/var/www/cgi-bin"> SSLOptions +StdEnvVars </Directory> BrowserMatch "MSIE [2-5]" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 ErrorLog logs/git_error.log CustomLog logs/git_access.log combined_ssl </VirtualHost>
Erklärungen zu den GitWeb bezogenen VHOST-Konfigurationen:
Nachfolgende Konfigurationen sind GitWeb spezifisch:
(Nur relevanter Ausschnitt):
...
Hier geht es weiter… / To be continued…