Installing a plugin

After finding the plugin and before using it, we need to install it. The installation procedure may differ for some plugins, but all of them have common steps, which we will review in this topic. Anyway, before going with the steps reviewed, here, you should check the plugin documentation to ensure you won't miss anything.

Note

This topic is intended for administrators, who have access to the file system of the server, on which Redmine runs. Also plugin installation may require root access.

Redmine plugins usually come in archived files. Usually, these archives have a single directory, which should be copied into the plugins directory of Redmine (that is, into /opt/redmine/plugins if you installed Redmine into /opt/redmine).

Tip

What if the plugin directory is missing or seems to have an invalid name?

The plugin should come with a init.rb file in the main plugin directory (therefore, if this file is in the root, the plugin directory is missing, and if it's in one of the subdirectories, the plugin directory is the corresponding subdirectory). And a init.rb file should have the following line:

Redmine::Plugin.register :plugin_name do

Here, plugin_name is the name of the plugin, and the plugin directory must have exactly the same name.

If the plugin requires migration, that means that some changes must be made to the Redmine database in order for the plugin to work-we need to execute the following command on the Redmine server:

$ rake redmine:plugins:migrate RAILS_ENV=production

If you are not sure whether migration is required, just execute this command anyway.

Tip

Database migration files come in the db subdirectory of the main plugin directory, so if a such directory is there and contains files, migration is needed.

Now to activate the plugin, you need to restart Redmine using the following command (this command may differ for your installation):

$ sudo service apache2 reload

That's, actually, all you need to do to install an ordinary plugin.

Tip

You can check if Redmine sees the plugin by going to Administration | Plugins.

Uninstalling a plugin

I assume, that you will want to try many plugins to decide which one best fits your needs (unfortunately, some plugins do not provide enough information to make the decision without trying them). So, in this case you will need to learn how to uninstall plugins correctly.

Tip

Do not play with plugins on the production server! Set up a test server (can be a virtual machine) for this purpose.

First, we need to roll back the database changes, which were made during the installation. Thus, to remove the plugin_name plugin we need to execute:

$ rake redmine:plugins:migrate NAME=plugin_name VERSION=0 RAILS_ENV=production

Of course, you need to execute this command only if the plugin comes with migration scripts. However, it is safe to do this even if it does not.

The rest of the uninstallation is simple.

Now remove the plugin directory (named after plugin_name) in the plugins subdirectory of the Redmine root directory (which is /opt/redmine, if you installed Redmine into this directory).

After that, just restart Redmine (the command depends on the Linux distribution that you use to run Redmine):

$ sudo service apache2 reload
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset