Mastering Redmine(Second Edition)
上QQ阅读APP看书,第一时间看更新

Installing Redmine and MySQL server

So let's execute the following command from the console:

$ sudo apt-get install redmine redmine-mysql mysql-server

Instead of redmine-mysql and mysql-server, you can use redmine-pgsql and postgresql or redmine-sqlite and sqlite3. But remember that neither PostgreSQL nor SQLite3 is reviewed in this section.

This command will install Redmine and MySQL as well as many dependency packages, including Ruby on Rails. Before doing this, the apt-get package manager will ask you to confirm, as follows:

Installing Redmine and MySQL server

Here, type y and then press Enter. This will make it download all the packages and start the installation process.

Configuring the MySQL server package

After unpacking the packages, apt-get will configure them. When it gets to the MySQL server, you will see the following dialog:

Configuring the MySQL server package

This dialog asks you to enter a new password for the MySQL superuser. In other words, this is the password that you will use to administer your MySQL server. The same password is to be used later to set up the Redmine database.

After you have entered the password, press Tab to move the cursor to the Ok button and then press Enter. Afterwards, you will need to repeat these steps in the password confirmation dialog.

Now it will take some time to configure other packages.

Configuring the Redmine package

The Debian/Ubuntu Redmine package supports multiple instances of this application. Thus, several instances can be used to run Redmine in production and development modes at the same time and on the same server (for example, on different ports). The configurator of the package, however, can help you to configure only a single default instance (if you want to configure more instances, you will need to do this manually).

After MySQL, it will not take long for apt-get to start configuring Redmine. When it does, the following dialog will be shown:

Configuring the Redmine package

Here, the configurator offers assistance in creating and configuring the database for Redmine. Unless you wish to do this manually, just press Enter.

Configuring the Redmine package

The next dialog that opens immediately asks you to select the database back-end. It lists all the supported (Linux) backends, as it is going to configure the database client for Redmine (the database server can potentially run on another machine).

As we have decided to use MySQL, we just press Enter here. And now comes the dialog that has already been mentioned:

Configuring the Redmine package

This window asks for the MySQL superuser password that you specified before. It is going to be used to create, configure, and populate the Redmine database.

So, we specify the password, press Tab to move to the Ok button, and press Enter.

Next, the final screen of the Redmine database configuration shows up:

Configuring the Redmine package

This dialog asks for a new password that will be used by Redmine to access its database. As this password is not going to be used anywhere except in Redmine, it is perhaps a good idea to press Enter here and just let the configurator generate a random password for you. However, note that the generated password is not going to be displayed to you during this installation process (it will be stored in the configuration file).

Tip

You may also need to specify this password in the Apache configuration files for advanced SCM integration. If you need it, you can find it in /etc/redmine/default/database.yml.

Thereafter, the package manager will configure the rest of the packages and return to the shell prompt.

That's it! Redmine has been installed and configured and it is actually ready to be run. But the system is not yet ready to run it.

Installing Apache and Passenger

To run Redmine, the system needs a web server. We are going to use Apache for this web server. Besides a web server, as you should remember from Chapter 1, Getting Familiar with Redmine, we need something to run Ruby applications on. This is going to be the Passenger module for Apache.

So let's install them:

$ sudo apt-get install apache2 libapache2-mod-passenger

As before, you will be asked to type y and press Enter. After this, the package manager will download the specified packages and their dependencies, install them, and start the Apache web server.

Installing Apache and Passenger

Now, if you request the index page of the newly installed web server using the URL http://127.0.0.1, for example (only from the same computer), you should see something like this:

Installing Apache and Passenger

This is the default welcome page of the Apache web server on Debian.

Connecting Redmine and Apache

But wait. Where is Redmine? At the moment, it is not connected to Apache. Unfortunately, despite the power of the Debian package management, this part should be configured manually. Luckily, it's not complicated. The Debian Redmine package comes with sample configuration files for Redmine under the /usr/share/doc/redmine/examples directory. In this directory, you can find sample configurations for Apache and FastCGI or Passenger, Lighttpd, Nginx, and Thin. There, you can see two sample files for Apache and Passenger: apache2-passenger-alias.conf and apache2-passenger-host.conf. The former should be used if you want to run Redmine under an additional URL path, for example, www.yourdomain.com/redmine. The latter is to be used if you want to run Redmine under a subdomain or as the main website on your domain.

It is assumed that you have installed a clean Debian/Ubuntu (as I did), especially for Redmine; that is, you want to use the server only for Redmine or for Redmine as the primary application. So let's copy apache2-passenger-host.conf to /etc/apache2/sites-available (the path for site configurations on Debian/Ubuntu):

$ sudo cp /usr/share/doc/redmine/examples/apache2-passenger-host.conf /etc/apache2/sites-available/

As it is clear from its name, this directory stores the configuration files of the available sites. For enabled sites, there is another directory—/etc/apache2/sites-enabled/. So, we need to move our new configuration into the latter. Let's do this in the correct Debian/Ubuntu way:

$ sudo a2ensite apache2-passenger-host

The e2ensite script is used to create symbolic links in /etc/apache2/sites-enabled/ that point to configuration files from /etc/apache2/sites-available/. A similar script, e2dissite, can be used to disable configuration files (that is, to remove symbolic links). And we need to execute the latter script to disable the default welcome page that comes with Apache in Debian/Ubuntu:

$ sudo a2dissite 000-default

Next, reload Apache to apply the new configuration:

$ sudo service apache2 reload

Now, if we load the site, we get the following:

Connecting Redmine and Apache

Congratulations! You have successfully installed Redmine. But still, there are a few things we need to do before we take a break for coffee and go ahead.