Tag Archives: ubuntu

Installing Net::Amazon::S3 Perl module on an Ubuntu server

The following is the same on recent Ubuntu releases, including Karmic, Lucid and Maverick.

What will not work

There seems to be a problem if you install Net::Amazon::S3 from CPAN. This will not work:

sudo cpan Net::Amazon::S3

Just about every dependency in the world installs, but fails in the home stretch when XML::LibXML::XPathContext and XML::LibXML fail to install.

What will work

sudo aptitude install libnet-amazon-s3-perl
sudo cpan Net::Amazon::S3::Client

Test your install with this

After throwing some data into S3 with S3Fox, test your installation. You will need to set values for aws_access_key_id and aws_secret_access_key, of course.

#!/usr/bin/perl
use warnings;
use strict;
use Net::Amazon::S3;
use Net::Amazon::S3::Client;

my %s3_hash = (
				aws_access_key_id     => "XXXXXXXXXXXXXXXXX",
				aws_secret_access_key => "YYYYYYYYYYYYYYYYYYYYYYYYYY",
				retry                 => 1,
);

my $s3 = Net::Amazon::S3->new( \%s3_hash );
my $client = Net::Amazon::S3::Client->new( s3 => $s3 );

my @buckets = $client->buckets;
foreach my $bucket (@buckets) {
	print $bucket->name . "\n";
}

Installing Trac and Subversion on Ubuntu Ibex

These are basically my notes from installing Trac and Subversion on an Ubuntu Intrepid Ibex server.

Install Software Packages

sudo aptitude install libapache2-mod-python libapache2-svn python-setuptools subversion python-subversion
sudo easy_install Trac

Create the Trac Environments Directory

sudo mkdir /var/lib/trac
sudo chown www-data:www-data /var/lib/trac

Setup Apache2

Using the default Ubuntu Apache virtual server setup, create a virtual server instance for
Trac. This single instance will be used for all Trac projects on the server.

sudo vi /etc/apache2/sites-available/trac.websitename.com

Your file will look a lot like the following. Use your website name instead of websitename.com and use a valid e-mail addressinstead of webmaster@websitename.com.


	ServerAdmin it@sitename.com
	ServerName trac.sitename.com
	DocumentRoot /hkm/var/www/trac.sitename.com/public
	LogLevel warn
	ErrorLog /hkm/var/www/trac.sitename.com/logs/error.log
	CustomLog /hkm/var/www/trac.sitename.com/logs/combined.log combined
	# DirectoryIndex index.html
 
	
		SetHandler mod_python
		PythonInterpreter main_interpreter
		PythonHandler trac.web.modpython_frontend
		PythonOption TracEnvParentDir /var/lib/trac
		PythonOption TracUriRoot /projects
		PythonOption PYTHON_EGG_CACHE /tmp
	
 
	# use the following for one authorization for all projects 
	# (names containing "-" are not detected):
	
		AuthType Basic
		AuthName "trac"
		AuthUserFile /path/htpasswd_filename_here
		Require valid-user
	

Now, use the Debian/Ubuntu utility a2ensite to create a link in apache2/sites-enabled to the file you just created in apache2/sites-available. Then, reload apache2 to enable the new subdomain.

sudo a2ensite trac
sudo  /etc/init.d/apache2 reload

You will also need to create a DNS A record to point to the server for this subdomain, but this is outside the scope of this blog entry.

Create Trac and Subversion Environments

Here we will make directories and create the Subversion repositories.

sudo mkdir /var/lib/svn
sudo mkdir /usr/share/trac
sudo svnadmin create /var/lib/svn/project1
sudo svnadmin create /var/lib/svn/project2

Set some permissions:

sudo chown -R www-data /var/lib/svn
sudo chown -R www-data /usr/share/trac
sudo  /etc/init.d/apache2 reload

Set up Trac

sudo mkdir /var/lib/trac

Initialize Trac for one of your projects.

sudo trac-admin /var/lib/trac/project1 initenv

The utility will ask for:

Project Name [My Project]>: project1
Database connection string [sqlite:db/trac.db]>:
Repository type [svn]>:
Path to repository [/path/to/repos]>: /var/lib/svn/project1

Repeat the above for the following, substituting the project code for each:

sudo trac-admin /var/lib/trac/project2 initenv
sudo chown -R www-data /var/lib/trac

Get Subversion Running

Modify /etc/apache2/mods-available/dav_svn.conf

sudo vi /etc/apache2/mods-available/dav_svn.conf
<Location /svn>
  DAV svn
 
  SVNParentPath /var/lib/svn
  SVNListParentPath On
 
  AuthType Basic
  AuthName "Subversion Repository"
  AuthUserFile /path/htpasswd_filename_here
 
  # To enable authorization via mod_authz_svn
  #AuthzSVNAccessFile /etc/apache2/dav_svn.authz
 
  <LimitExcept GET PROPFIND OPTIONS REPORT>
    Require valid-user
  </LimitExcept> 
 
</Location>

Install More aptitude packages for Trac plugins

Install some packages that will be needed.

sudo aptitude install build-essential graphviz
sudo aptitude install enscript
sudo aptitude install htmldoc

Using easy_install to Install more Trac Plugins

Because these are installed, you will be able to turn these on easily as Trac administrator.

sudo easy_install http://svn.edgewall.org/repos/genshi/trunk/
sudo easy_install http://trac-hacks.org/svn/accountmanagerplugin/trunk
sudo easy_install http://trac-hacks.org/svn/customfieldadminplugin/0.11
sudo easy_install http://trac-hacks.org/svn/eclipsetracplugin/tracrpcext/0.10
sudo easy_install http://trac-hacks.org/svn/iniadminplugin/0.11
sudo easy_install http://trac-hacks.org/svn/masterticketsplugin/0.11
sudo easy_install http://trac-hacks.org/svn/pagetopdfplugin/0.10/
sudo easy_install http://trac-hacks.org/svn/progressmetermacro/0.11
sudo easy_install http://trac-hacks.org/svn/ticketdeleteplugin/0.11
sudo easy_install http://trac-hacks.org/svn/tracwysiwygplugin/0.11
sudo easy_install http://wikinotification.ufsoft.org/svn/trunk

Ubuntu: Open Terminal from Nautilus

This will allow you to open a Terminal instance in context in Nautilus.

sudo aptitude install nautilus-open-terminal

You will need to restart Gnome for it to take effect. Note that all you user programs will be terminated…so save data first. Then either use , or:

sudo /etc/init.d/gdm restart

And Bob’s your uncle. Now you can right-click and open a Terminal.

Nautilus as Root in Ubuntu

Firstly, you can just run Nautilus as root from the command line with:

gksudo nautilus

The following procedure will add a root file browser to the Applications | System Tools menu.

I got this from http://ubuntuforums.org/archive/index.php/t-256998.html.

Create a text file with:

gksudo gedit /usr/share/applications/Nautilus-root.desktop

Add these lines to the file:

[Desktop Entry]
Name=File Browser (Root)
Comment=Browse the filesystem with the file manager
Exec=gksudo "nautilus --browser %U"
Icon=file-manager
Terminal=false
Type=Application
Categories=Application;System;

Open Nautilus with: Applications -> System Tools -> File Browser (Root)

An Alternative

This is from a comment by Cerebrux to this post:

1) Open Synaptic and install the “nautilus-gksu”

2) Logout- Login

3) And now do right-click on a folder and “open as administrator”.

P.S. If you want the “open terminal here” in your right-click, then just install “nautilus-open-terminal”

Firstly, you can just run Nautilus as root from the command line with:

gksudo nautilus

The following procedure will add a root file browser to the Applications | System Tools menu.

I got this from http://ubuntuforums.org/archive/index.php/t-256998.html.

Create a text file with:

gksudo gedit /usr/share/applications/Nautilus-root.desktop

Add these lines to the file:

[Desktop Entry]
Name=File Browser (Root)
Comment=Browse the filesystem with the file manager
Exec=gksudo "nautilus --browser %U"
Icon=file-manager
Terminal=false
Type=Application
Categories=Application;System;

Open Nautilus with: Applications -> System Tools -> File Browser (Root)

An Alternative

This is from a comment by Cerebrux to this post:

1) Open Synaptic and install the “nautilus-gksu”

2) Logout- Login

3) And now do right-click on a folder and “open as administrator”.

P.S. If you want the “open terminal here” in your right-click, then just install “nautilus-open-terminal”