| Home |
| About Keith's Code |
| Blog |
| Tutorials |
| Windows Gadgets |
| Joomla! Resources |
| Online Documents |
| User Forums |
| Installing Subversion on a Home Ubuntu Server |
Page 3 of 4
10. Setup the log files First, create a directory for the logs. These should go with the Apache logs since we will be using Apache to access the repository. sudo mkdir /var/log/apache2/svn.example.comNext, add the log directory to the log rotate script. sudo vi /etc/logrotate.d/apache2Add the following lines to the file: /var/log/apache2/svn.example.com/*.log {weekly missingok rotate 52 compress delaycompress notifempty } 11. Generate a self-signed server key/certificate for Apache If you have not yet generated a self-signed certificate, you need to do this for the SSL to work. Since you probably don't have a dedicated IP address for your home server, and you're more than likely to be using this for personal use, I assume you're not going to want to pay for an SSL certificate. Although you will recieve a warning when you visit your repository through a web browser when using a self-signed certificate, it will still be an encrypted connection. That means your password won't be transmitted in plain text through the internet for everyone to grab. This is good. If you aren't sure if you already have a certificate on you system, check for the directory /etc/apache2/ssl and look for a file called apache.pem. If you don't find it, you probably need to generate one. Granted, yours could be in a different location, but it won't hurt to have this one on the system if it is. To generate the certificate enter the following commands (the second command which begins sudo openssl and ends apache.pem should go on a single line): sudo mkdir /etc/apache2/sslsudo openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.pem You will be asked a series of questions. Answer them to the best of your ability. There is only one that you should pay special attention to, the one that asks for Common Name (CN). You should enter than name of your server for that question. If you are unsure what the name of your server is, type the following command and make note of the output before you issue the openssl command: hostnameOnce you finish answering the questions, your certificate will be on the server. 12. Add the virtual host definition and configure Apache For this tutorial, we'll assume the server is at internal IP address 192.168.1.100. You now need to choose a port number for your subversion repository. Generally, since you are using SSL to access the server, you would put the repository on port 443. However, most residential ISPs block all incoming ports less than 1024, so we need to pick a different port. Personally, I chose 8088. You are welcome to choose whatever you like. First, to make sure that apache will be listening on that port, you need to edit the ports configuration: sudo vi /etc/apache2/ports.confAdd the following line directly below the line Listen 443, replacing 8088 with the port number that you chose: Listen 8088Next, you need to create the Virtual Host file: sudo vi /etc/apache2/sites-available/svn.example.comThe following text should go in the Virtual Host file, replacing the IP address with your server IP address and the port number with the port that you chose: <VirtualHost 192.168.1.100:8088>ServerName svn.example.com <Location /> DAV svn SVNPath /usr/local/svn/svn.example.com AuthType Basic AuthName "svn.example.com" AuthUserFile /usr/local/svn/svn.example.com/conf/passwd AuthzSVNAccessFile /usr/local/svn/svn.example.com/conf/authz Require valid-user </Location> CustomLog /var/log/apache2/svn.example.com/access.log combined ErrorLog /var/log/apache2/svn.example.com/error.log SSLEngine on SSLCertificateFile /etc/apache2/ssl/apache.pem # Add this once there is a real (non self-signed) certificate. # SSLCertificateKeyFile /etc/apache2/ssl/server.key </VirtualHost> <VirtualHost *> ServerName svn.example.com Redirect / https://svn.example.com:8088/ LogLevel warn CustomLog /var/log/apache2/svn.example.com/access.log combined ErrorLog /var/log/apache2/svn.example.com/error.log </VirtualHost> 13. Enable the site and restart Apache Before Apache will recognize the site and include it in the configuration, you must enable the site using the a2ensite command: sudo a2ensite svn.example.comNow you must restart Apache for the changes to take effect: sudo /etc/init.d/apache2 restart
|
||||||