Linux: Difference between revisions
Line 9: | Line 9: | ||
[[PHP Module]] | [[PHP Module]] | ||
=== Apache Svn Server=== | === Apache Svn Server=== | ||
1: Install Apache HTTP server and required modules: | 1: Install Apache HTTP server and required modules: | ||
<syntaxhighlight lang="bash">sudo apt-get install libapache2-svn apache2</syntaxhighlight> | <syntaxhighlight lang="bash">sudo apt-get install libapache2-svn apache2</syntaxhighlight> | ||
2: Enable SSL | 2: Enable SSL | ||
sudo a2enmod ssl | <syntaxhighlight lang="bash">sudo a2enmod ssl</syntaxhighlight> | ||
sudo | <syntaxhighlight lang="bash">sudo vi /etc/apache2/ports.conf</syntaxhighlight> | ||
Add or check that the following is in the file: | Add or check that the following is in the file: | ||
<pre> | |||
<IfModule mod_ssl.c> | <IfModule mod_ssl.c> | ||
Listen 443 | Listen 443 | ||
</IfModule> | </IfModule> | ||
</pre> | |||
3: Generate an SSL certificate: | 3: Generate an SSL certificate: | ||
sudo apt-get install ssl-cert | <syntaxhighlight lang="bash">sudo apt-get install ssl-cert</syntaxhighlight> | ||
sudo mkdir /etc/apache2/ssl | <syntaxhighlight lang="bash">sudo mkdir /etc/apache2/ssl</syntaxhighlight> | ||
sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem | <syntaxhighlight lang="bash">sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem</syntaxhighlight> | ||
4: Create virtual host | 4: Create virtual host | ||
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/svnserver | <syntaxhighlight lang="bash">sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/svnserver</syntaxhighlight> | ||
sudo kate /etc/apache2/sites-available/svnserver | <syntaxhighlight lang="bash">sudo kate /etc/apache2/sites-available/svnserver</syntaxhighlight> | ||
Change (in ports.conf): | Change (in ports.conf): | ||
<pre> | |||
"NameVirtualHost *" to "NameVirtualHost *:443" | "NameVirtualHost *" to "NameVirtualHost *:443" | ||
</pre> | |||
and (in svnserver) | and (in svnserver) | ||
<pre> | |||
<VirtualHost *> to <VirtualHost *:443> | <VirtualHost *> to <VirtualHost *:443> | ||
</pre> | |||
Add, under ServerAdmin (also in file svnserver): | Add, under ServerAdmin (also in file svnserver): | ||
<pre> | |||
SSLEngine on | SSLEngine on | ||
SSLCertificateFile /etc/apache2/ssl/apache.pem | SSLCertificateFile /etc/apache2/ssl/apache.pem | ||
SSLProtocol all | SSLProtocol all | ||
SSLCipherSuite HIGH:MEDIUM | SSLCipherSuite HIGH:MEDIUM | ||
</pre> | |||
5: Enable the site: | 5: Enable the site: | ||
sudo a2ensite svnserver | <syntaxhighlight lang="bash">sudo a2ensite svnserver</syntaxhighlight> | ||
sudo /etc/init.d/apache2 restart | <syntaxhighlight lang="bash">sudo /etc/init.d/apache2 restart</syntaxhighlight> | ||
To overcome warnings: | To overcome warnings: | ||
<syntaxhighlight lang="bash">sudo vi /etc/apache2/apache2.conf</syntaxhighlight> | |||
" | |||
sudo | |||
</ | |||
Add: "ServerName $your_server_name" | |||
Add, under ServerAdmin (also in file svnserver): | Add, under ServerAdmin (also in file svnserver): | ||
<pre> | |||
SSLEngine on | SSLEngine on | ||
SSLCertificateFile /etc/apache2/ssl/apache.pem | SSLCertificateFile /etc/apache2/ssl/apache.pem | ||
SSLProtocol all | SSLProtocol all | ||
SSLCipherSuite HIGH:MEDIUM | SSLCipherSuite HIGH:MEDIUM | ||
</pre> | |||
6: Adding repository(ies): The following setup assumes we want to host multiple repositories. Run this for creating the first repository: | 6: Adding repository(ies): The following setup assumes we want to host multiple repositories. Run this for creating the first repository: | ||
sudo mkdir /var/svn | <syntaxhighlight lang="bash">sudo mkdir /var/svn</syntaxhighlight> | ||
<syntaxhighlight lang="bash">sudo svnadmin create /var/svn/mysvnrepository</syntaxhighlight> | |||
<syntaxhighlight lang="bash">sudo chown -R www-data:www-data /var/svn/mysvnrepository</syntaxhighlight> | |||
sudo svnadmin create /var/svn/ | <syntaxhighlight lang="bash">sudo chmod -R g+ws /var/svn/mysvnrepository</syntaxhighlight> | ||
sudo chown -R www-data:www-data /var/svn/ | |||
sudo chmod -R g+ws /var/svn/ | |||
6.a. For more repositories: do step 6 again (changing | 6.a. For more repositories: do step 6 again (changing mysvnrepository Name) | ||
7: Add an authenticated user | 7: Add an authenticated user | ||
sudo htpasswd -c -m /etc/apache2/dav_svn.passwd $user_name | <syntaxhighlight lang="bash">sudo htpasswd -c -m /etc/apache2/dav_svn.passwd $user_name</syntaxhighlight> | ||
8: Enable and configure WebDAV and SVN: | 8: Enable and configure WebDAV and SVN: | ||
sudo | <syntaxhighlight lang="bash">sudo vi /etc/apache2/mods-available/dav_svn.conf</syntaxhighlight> | ||
Add or uncomment: | Add or uncomment: | ||
<pre> | |||
<Location /svn> | <Location /svn> | ||
DAV svn | DAV svn | ||
Line 176: | Line 105: | ||
SSLRequireSSL | SSLRequireSSL | ||
</Location> | </Location> | ||
</pre> | |||
9: Restart apache server: | 9: Restart apache server: | ||
sudo /etc/init.d/apache2 restart | <syntaxhighlight lang="bash">sudo /etc/init.d/apache2 restart</syntaxhighlight> | ||
10: Validation: | 10: Validation: | ||
Line 190: | Line 120: | ||
Commit something: | Commit something: | ||
svn import --username $user_name anyfile.txt https://localhost/svn/$REPOS/anyfile.txt -m “Testing” | <syntaxhighlight lang="bash">svn import --username $user_name anyfile.txt https://localhost/svn/$REPOS/anyfile.txt -m “Testing”</syntaxhighlight> | ||
Accept the certificate and enter password. Check out what you've just committed: | Accept the certificate and enter password. Check out what you've just committed: | ||
svn co --username $user_name https://localhost/svn/$REPOS | <syntaxhighlight lang="bash">svn co --username $user_name https://localhost/svn/$REPOS</syntaxhighlight> | ||
=== Server Setup === | === Server Setup === |
Revision as of 17:45, 2 December 2014
Command Line
Vi
Configuration
Php
Apache Svn Server
1: Install Apache HTTP server and required modules:
sudo apt-get install libapache2-svn apache2
2: Enable SSL
sudo a2enmod ssl
sudo vi /etc/apache2/ports.conf
Add or check that the following is in the file:
<IfModule mod_ssl.c> Listen 443 </IfModule>
3: Generate an SSL certificate:
sudo apt-get install ssl-cert
sudo mkdir /etc/apache2/ssl
sudo /usr/sbin/make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem
4: Create virtual host
sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/svnserver
sudo kate /etc/apache2/sites-available/svnserver
Change (in ports.conf):
"NameVirtualHost *" to "NameVirtualHost *:443"
and (in svnserver)
<VirtualHost *> to <VirtualHost *:443>
Add, under ServerAdmin (also in file svnserver):
SSLEngine on SSLCertificateFile /etc/apache2/ssl/apache.pem SSLProtocol all SSLCipherSuite HIGH:MEDIUM
5: Enable the site:
sudo a2ensite svnserver
sudo /etc/init.d/apache2 restart
To overcome warnings:
sudo vi /etc/apache2/apache2.conf
Add: "ServerName $your_server_name"
Add, under ServerAdmin (also in file svnserver):
SSLEngine on SSLCertificateFile /etc/apache2/ssl/apache.pem SSLProtocol all SSLCipherSuite HIGH:MEDIUM
6: Adding repository(ies): The following setup assumes we want to host multiple repositories. Run this for creating the first repository:
sudo mkdir /var/svn
sudo svnadmin create /var/svn/mysvnrepository
sudo chown -R www-data:www-data /var/svn/mysvnrepository
sudo chmod -R g+ws /var/svn/mysvnrepository
6.a. For more repositories: do step 6 again (changing mysvnrepository Name)
7: Add an authenticated user
sudo htpasswd -c -m /etc/apache2/dav_svn.passwd $user_name
8: Enable and configure WebDAV and SVN:
sudo vi /etc/apache2/mods-available/dav_svn.conf
Add or uncomment:
<Location /svn> DAV svn # for multiple repositories - see comments in file SVNParentPath /var/svn AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd Require valid-user SSLRequireSSL </Location>
9: Restart apache server:
sudo /etc/init.d/apache2 restart
10: Validation:
Fired up a browser:
http://localhost/svn/$REPOS https://localhost/svn/$REPOS
Commit something:
svn import --username $user_name anyfile.txt https://localhost/svn/$REPOS/anyfile.txt -m “Testing”
Accept the certificate and enter password. Check out what you've just committed:
svn co --username $user_name https://localhost/svn/$REPOS