After getting everything setup how I want on my web server I want to record how I did it. I know the right thing to do would be to create an image, but I’m just going to write it down instead. That way you can use it if you ever need it.

Install Trac and SVN

Thanks to Anant Garg for this part. I’m only going to make a few changes to update things and such.


sudo apt-get install apache2 libapache2-mod-python libapache2-svn python-setuptools subversion python-subversion
sudo easy_install http://ftp.edgewall.com/pub/trac/Trac-0.11.4.tar.gz
sudo mkdir /svn
sudo mkdir /trac
sudo htpasswd -cm /etc/svnauth myname
sudo htpasswd -m /etc/svnauth myfriendsname

Create a permissions file, “/etc/svnaccess”


[groups]
developers = myname, myfriendsname
[ / ]
@developers = rw
* = r

Now create the Apache config file, “/etc/apache2/sites-available/svntrac”




 ServerAdmin your@email.com
 ServerName 

 DocumentRoot /var/www/
 
 Options FollowSymLinks
 AllowOverride None
 
 
 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 

 ErrorLog /var/log/apache2/error.log
 LogLevel warn
 CustomLog /var/log/apache2/access.log combined
 ServerSignature On



 DAV svn
 SVNParentPath /svn

 AuthType Basic
 AuthName "Subversion Repository"
 AuthUserFile /etc/svnauth


 Require valid-user


AuthzSVNAccessFile /etc/svnaccess




 SetHandler mod_python
 PythonHandler trac.web.modpython_frontend
 PythonOption TracEnvParentDir /trac
 PythonOption TracUriRoot /trac




 AuthType Basic
 AuthName "Trac"
 AuthUserFile /etc/svnauth
 Require valid-user




Now I have to activate the new config file and change the permissions.


sudo a2ensite svntrac
sudo /etc/init.d/apache2 reload
sudo chown -R www-data /trac

Now create, “/etc/trac.ini”


[header_logo]
alt = Logo
height = -1
link =
src = /trac-files/logo.png
width = -1

The logo.png file will go in “/var/www/trac-files”.

Now I create a perl script called init.pl. I wouldn’t have done this, but it was on the tutorial and it is actually really handy.


#!/usr/bin/perl
$sName = $ARGV[0];
$lName = $ARGV[1];
if ($lName eq "") {
 $lName = $sName;
}
$sName =~ tr/A-Z/a-z/;
$path = "sudo svnadmin create /svn/$sName";
system ($path);
$path = "sudo chown -R www-data /svn/$sName";
system ($path);
$path = "sudo trac-admin /trac/$sName initenv '$lName' 'sqlite:db/trac.db' 'svn' '/svn/$sName' --inherit=/etc/trac.ini";
system ($path);
$path = "sudo chown -R www-data /trac/$sName";
system ($path);
$path = "sudo trac-admin /trac/$sName permission add yourusername TRAC_ADMIN permission list yourusername";
system ($path);
print "Done!nn";

Now, when you run this it will look something like this.


sudo perl init.pl 'short' 'long'

The ‘short is obviously the short name and the ‘long’ is the long name. If you don’t have a long name you can leave that part out, the script will just use the short name.

Thanks to Anant Garg, for this part of the tutorial. My only real reason for posting this part is to make sure I don’t lose it.

Finishing the LAMP setup

The first thing I want to do now is make the IP address static. I can’t forget to do that. So I have to open the “/etc/network/interfaces” file.

Change this:


auto eth0
iface eth0 inet dhcp

to this:


auto eth0
iface eth0 inet static
 address 192.168.1.100
 netmask 255.255.255.0
 network 192.168.1.0
 broadcast 192.168.1.255
 gateway 192.168.1.1

Make sure to change “dhcp” to “static”. Then restart networking.


sudo /etc/init.d/networking restart

Now Let’s install the MP part of LAMP.


sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo apt-get install mysql-server
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

Now let’s add the following to “/etc/apache2/apache2.conf”:


# Include phpmyadmin configuration
Include /etc/phpmyadmin/apache.conf

and restart apache. Then finish setting upu phpMyAdmin:


sudo apt-get install php5-mysql mysql-client

and add “extensions=mysql.so” to “/etc/php5/apache2/php.ini” and restart apache 1 last time.

Finally, Let’s add an FTP server:


sudo apt-get install proftpd ucf

Select ‘standalone‘ when asked to chose between ‘inetd’ and ‘standalone’.

Add the “DefaultChdir” as “/var/www” and restart the web server.

Thanks to HowtoForge for this part of the tutorial.