Monday, May 31, 2010

How to Setup Logo in Plone!

1. Logo
Go to the Zope Management Interface (Site Setup > Zope Management Interface)

Go to portal_skins > plone_images

Click logo.jpg and then click the customize button

Now replace the image by clicking the browse button and choosing your own image from your file system

Edit the Title field (this will ensure that the title attribute changes in the HTML)

Save your changes and refresh your browser to see the changes on your site


Go to the Zope Management Interface (Site Setup > Zope Management Interface)

Make sure that you've switched your css registry to debug mode (portal_css)

Go to portal_skins > custom and choose Image from the drop down list on the right

Upload your own image giving it an ID and a Title e.g.:

ID = MyLogo.jpg
Title = My Logo

Go to portal_skins > plone_styles, click base_properties and then click the customize button
You'll now have a customized version of base_properties in the custom folder of portal_skins which you can change as you like. Find the logoName field and replace the value logo.jpg with the ID you gave your image (if you gave your ID a .jpg or .gif suffix, make sure you include that, and remember that it is case-sensitive) e.g.:
logoName = MyLogo.jpg
Save your changes and refresh your browser

ZMI -> /portal_view_customizations -> plone.logo -> manage_main

How to install new Packages in Plone!

2. Installing a new Package in Plone

To install an egg-based product, first unpack your theme product (if in a .tgz, .tar.gz or zip archive). Copy the package to the src/ folder of your buildout. Then, edit your buildout.cfg and add the following information into the buildout, instance, and zcml sections. The actual buildout.cfg file will be much longer than the snippets below:

develop =
src/plonetheme.yourtheme (where yourtheme is the name of the theme you downloaded)

eggs =

zcml =

The last line tells buildout to generate a ZCML snippet (slug) that tells Zope to recognize your theme product, prefixed by the namespace (plonetheme is the default). The dots [...] indicate that you may have additional lines of ZCML code here. If another package depends on the theme egg or includes its ZCML directly, you do not need to specify anything in the buildout configuration; buildout will detect this automatically. This is considered a more advanced topic.

After updating the configuration you need to run the ''bin/buildout'', which will refresh your buildout.

Then, restart your site and go to the 'Site Setup' page in the Plone interface and click on the 'Add/Remove Products' link. The 'Site Setup' area is also known as plone_control_panel, as this is the URL used to get to 'Site Setup'.

Choose the product by selecting the checkbox next to it and click the 'Install' button.

To install older version of product simply copy the package after extracting into products directory....

typical location may be...
Then, restart your site and go to the 'Site Setup' page in the Plone interface and click on the 'Add/Remove Products' link.

SVN Configuration on Linux!

1. Install the Subversion

2. Create a new Repository:
Suppose to create a Repository at /usr/local/subversion/repository using fsfs database so execute the command:

mkdir -v /usr/local/subversion/
svnadmin create --fs-type fsfs /usr/local/subversion/repository

That should create a subversion repository under /usr/local/subversion/repository.

ls /usr/local/subversion/repository
conf/ dav/ db/ format hooks/ locks/ README.txt

Now, change the ownership of the newly created repository...
chown -R subversion:subversion /usr/local/subversion/repository/

Now, add the newly created member to the subversion group located in /etc/group

You should be able to see those files under the repository directory.

3. Edit the /home/svn/repository/conf/svnserve.conf and enable the following lines :
password-db = passwd
realm = repository_name

4. Edit the file /home/svn/repository/conf/passwd and add the following lines:

You can add as many users in the format USERNAME=PASSWORD. The passwords are not encrypted.

5. Set a text editor as the default SVN editor:
# export SVN_EDITOR=vim

Now that your Repository and authentication schemes are set, you need to import the development source tree to the server. You can use the file protocol or the SVN protocol to import the files. If you need to make the repository available in a network then you have to set up the svnserve.

Issue the command:
# svnserve -d -r /home/svn/
This will run the svn server in daemon mode.

6. You can now import the source tree with the following command:
$ svn import /usr/local/subversion/repository svn://yourhost/repository --username akshat
svn import /home/akshat/svn/IYA2009 svn://mutha/usr/local/subversion/IYA2009 --username akshat

7. You can checkout the source by using the command:
$ svn checkout svn://mutha/GMRTARchive
svn co svn+ssh://mutha/usr/local/subversion/IYA2009

Suppose we want to checkout a repository named GOSIP we need to do the following:

svn co svn://mutha/GOSIP
mkdir Database ; cp /home/akshat/ncra.sql Database/ncra.sql
svn add Database

Where ncra.sql is file that is sitting under Database directory.

akshat@akshat-laptop:~/GOSIP$ svn commit Database
Authentication realm: GOSIP
Password for 'akshat': ******
Adding Database
Adding Database/ncra.sql
Transmitting file data .
Committed revision 3.

svn ci Database
svn -m 'first checkin of Databse' ci Database
cd Database/
vim ncra.sql

akshat@akshat-laptop:~/GOSIP/Database$ svn stat => for checking the editing status
M ncra.sql

M=> shows that the file has been modified.

akshat@akshat-laptop:~/GOSIP/Database$ svn up
At revision 3.
up=> update

If we want to revert to a specific version than we have to use the following command:
svn merge -rHEAD:4 .
svn commit -m "Reverted to revision 3."\

==Adding SVN users:==
Since we are using svn with an apache server, and an apache basic authentication method.

We need to create a password file with the htpasswd binary provided with a standard apache installation.

htpasswd -cmd /usr/local/subversion/repository/conf/svn-auth-file {user-name}

-c option creates a new htpasswd file.
-m encrypts the password with an MD5 algorithm.
-d encrypts the password with a CRYPT algorithm.

Where {user-name} stands for an actual user name that will be used for authentication.

Warning: We should not use the -c option once we have added the first user. Using so will create and replace all existing user within the file.

htpasswd -md /usr/local/subversion/repository/conf/svn-auth-file {user-name}

Trac Installation On Linux!

Step by Step Installation of Trac on Linux:

Genshi Installation
python install

install setuptools

python build install (Trac Installation)

install svn


Now Install Mysql-python
$ tar -xfz MySQL-python-1.2.1.tar.gz
$ cd MySQL-python-1.2.1
$ # edit site.cfg if necessary
$ python build
$ sudo python install # or su first

If the error comes likes this during building:
error: command 'gcc' failed with exit status 1
then install the python-dev library.......
root@term146:~/Desktop/MySQL-python-1.2.2# sudo apt-get install python-dev

Install additional libraries like neon, neon-devel, python-devel, swig (Simplified Wrapper and Interface Generator)

After the installation, you have to setup the trac Environment Directory. For that create a folder any where in you system.
(mkdir myenv) and give full permission to that environment (chmod -R 777 myenv)

To make this directory as your trac environment , use the following command.
trac-admin /path/to/myenv initenv

It will ask for name of your project, mysql connection string, type of subverstion, repository path, and template of your trac.
1) Provide a name for your project
2) If you are not using mysql, the trac by default use Sqlite database . Just enter the option for blank


A proper database can be created with any MySQL client, like this:

To check character set settings for your database, issue the following commands:

mysql> USE trac;
Database changed

mysql> SHOW VARIABLES WHERE variable_name IN ('character_set_database', 'collation_database');
| Variable_name | Value |
| character_set_database | utf8 |
| collation_database | utf8_bin |
2 rows in set (0.01 sec)

To create a user and give this user access to the database created above:

GRANT ALL ON trac.* TO tracuser@localhost IDENTIFIED BY 'password';
The connection string will then be:


NOTE: If mysql socket is present at /tmp/mysql.sock then create the symbolic link as--

ncra@localhost:3306 root aksncra /tmp/mysql.sock
because trac will take the Connection String from /var/lib/mysql/mysql.sock

3) Enter type of subversion there. Just type ’svn’ if you are using svn subversion.

4) Enter the path to your repository

4. Tell Apache about trac.. Add the following lines to your Apache configuration file:

SetHandler mod_python
PythonHandler trac.web.mod python_frontend
PythonOption TracEnv $pathtoyourtracproject
PythonOption TracUriRoot /trac


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

Finally, restart httpd and try it out by going to:


5. Edit Trac.ini

6. trac-admin /usr/local/..... resync




Adding Authentication

To enable authentication with Apache is to create a password file. Use the htpasswd program to create the password file:

$ htpasswd -c /somewhere/trac.htpasswd admin
New password:
Re-type new password:
Adding password for user admin
After the first user, you dont need the "-c" option anymore:

$ htpasswd /somewhere/trac.htpasswd akshat
New password:
Re-type new password:
Adding password for user akshat

Now we can set their permissions using TracPermissions.
Now, you'll need to enable authentication against the password file in the Apache configuration:

AuthType Basic
AuthName "Trac"
AuthUserFile /somewhere/trac.htpasswd
Require valid-user
If you're hosting multiple projects you can use the same password file for all of them:

AuthType Basic
AuthName "Trac"
AuthUserFile /somewhere/trac.htpasswd
Require valid-user

For better security enable SSL or use the “digest” authentication instead of “Basic”.

LoadModule auth_digest_module /usr/lib/apache2/modules/
AuthType Digest
AuthName "trac"
AuthDigestDomain /trac
AuthUserFile /somewhere/trac.htpasswd
Require valid-user
and you'll have to create your .htpasswd file with htdigest instead of htpasswd as follows:

# htdigest /somewhere/trac.htpasswd trac admin
where the "trac" is the Realm.

Web Admin Plugin
This plugin is for administering Trac projects through the web interface.

Note: Don't forget to give permissions to your user.

trac-admin /path/to/my/project
permission add username-from-htpasswd TRAC_ADMIN
permission list username-from-htpasswd

Trac [/usr/local/trac/GMRTArchive]> permission add /usr/local/trac/trac.htpasswd/akshat TRAC_ADMIN
Trac [/usr/local/trac/GMRTArchive]> permission list akshat
-----> Add permission for each user and each project to have Admin Tab.............

Graphical Admin Tab

To access this tab, a user must have TRAC_ADMIN privileges. This can be performed as follows:

$ trac-admin /path/to/projenv permission add akshat TRAC_ADMIN
E.g. trac-admin -c /usr/local/trac/IYA2009/ permission add admin TRAC_ADMIN
-----> Add permission for each user and each project to have Admin Tab.............
Then, the user akshat will be able to see the Admin tab, and can then access the permissions menu. This menu will allow you to perform all the following actions, but from the browser without requiring root access to the server (just the correct permissions for your user account).


A user account management plugin for Trac.

== Installation ==
1. Run: python bdist_egg
2. If necessary create a folder called "plugins" in your Trac environment.
3. Copy the .egg file from the dist folder created by step 1 into the "plugins"
directory of your Trac environment.

== Configuration ==
Add one of the following sections to trac.ini to manage an Apache htpasswd or
htdigest file.

=== Htpasswd ===
password_format = htpasswd
password_file = /path/to/trac.htpasswd

=== Htdigest ===
password_format = htdigest
password_file = /path/to/trac.htdigest
htdigest_realm = TracDigestRealm

LDAP Authentication for Trac

VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
ErrorLog /var/log/apache2/error.trac.log
CustomLog /var/log/apache2/access.trac.log combined

SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /usr/local/trac
PythonOption TracUriRoot /trac
PythonOption PYTHON_EGG_CACHE /tmp

# use the following for one authorization for all projects
# (names containing "-" are not detected):
AuthType Basic
AuthName "Authorization Required for NCRA-TIFR Trac"
AuthBasicProvider ldap
AuthLDAPURL "ldap://localhost:389/ou=people,o=ncra,c=in?uid"
AuthLDAPGroupAttribute memberUid
AuthLDAPGroupAttributeIsDN off
AuthzLDAPAuthoritative on
Require valid-user