FedoraInstallation » History » Version 5
Jamie McPeek, 2014-08-16 23:10
| 1 | 1 | Jamie McPeek | h1. HowTo Install Redmine 2.5.x on Fedora 20 |
|---|---|---|---|
| 2 | |||
| 3 | {{toc}} |
||
| 4 | |||
| 5 | h2. System Requirements |
||
| 6 | |||
| 7 | No assumptions are made about the initial state of the system in this guide. The guide can be followed for either 32-bit or 64-bit systems - though all testing and the original installation was performed on a 64-bit system. |
||
| 8 | |||
| 9 | The hardware requirements are not significant, so a small VM with 10gb storage and 1GB ram and 1GB swap file should be sufficient. |
||
| 10 | |||
| 11 | This guide can be used on top of an already existing system or, from scratch, downloading from the Fedora website. |
||
| 12 | |||
| 13 | An ISO for installation can be downloaded from "here":http://fedoraproject.org/en/get-fedora. |
||
| 14 | |||
| 15 | The rest of the guide assumes that you have created a user account with wheel/administrator access and are logged in to the terminal directly or through SSH. |
||
| 16 | 2 | Jamie McPeek | |
| 17 | h2. Updating the System |
||
| 18 | |||
| 19 | Before beginning, you should ensure all of your installed packages are up-to-date. This can be done by issuing the following command: |
||
| 20 | |||
| 21 | <pre> |
||
| 22 | $ sudo yum update |
||
| 23 | </pre> |
||
| 24 | |||
| 25 | If the kernel was updated as part of this command, you should perform a restart to begin using it: |
||
| 26 | |||
| 27 | <pre> |
||
| 28 | $ sudo shutdown -r now |
||
| 29 | </pre> |
||
| 30 | |||
| 31 | h2. Installing Dependencies |
||
| 32 | 3 | Jamie McPeek | |
| 33 | Before beginning the installation of Redmine, there are a number of dependencies which need to be installed. |
||
| 34 | |||
| 35 | 4 | Jamie McPeek | Depending on your needs, some of these may not be necessary. Depending on your preferences, you may choose alternatives to some of these. |
| 36 | 3 | Jamie McPeek | |
| 37 | <pre> |
||
| 38 | apr-devel - For Passenger |
||
| 39 | apr-util-devel - For Passenger |
||
| 40 | curl-devel - For Passenger |
||
| 41 | gcc - For JSON |
||
| 42 | gcc-c++ - For Passenger |
||
| 43 | git - (Optional) For SCM Integration |
||
| 44 | httpd - Web Server |
||
| 45 | httpd-devel - For Passenger |
||
| 46 | ImageMagick-devel - For RMagick |
||
| 47 | mariadb-devel - For Redmine |
||
| 48 | mariadb-server - For Redmine |
||
| 49 | nano - Configuration Editor |
||
| 50 | ruby-devel - For Redmine |
||
| 51 | tar - For Decompression |
||
| 52 | wget - For Download |
||
| 53 | </pre> |
||
| 54 | |||
| 55 | All of these can be installed prior to starting with a single command: |
||
| 56 | |||
| 57 | <pre> |
||
| 58 | $ sudo yum install apr-devel apr-util-devel curl-devel gcc gcc-c++ git httpd httpd-devel ImageMagick-devel mariadb-devel mariadb-server nano ruby-devel tar wget |
||
| 59 | </pre> |
||
| 60 | |||
| 61 | h2. Disable SELinux |
||
| 62 | |||
| 63 | Some users have noted issues installing Redmine with SELinux active. This can be disabled via the following command: |
||
| 64 | |||
| 65 | <pre> |
||
| 66 | # sudo setenforce 0 |
||
| 67 | </pre> |
||
| 68 | |||
| 69 | Steps will be taken throughout the remainder of the guide to ensure that, if desired, SELinux can be re-enabled after and still maintain a fully functional Redmine installation. |
||
| 70 | |||
| 71 | h2. Enable Server Environment |
||
| 72 | |||
| 73 | With all of the dependencies installed, we need to ensure that the servers are setup, ready for use, and accessible external to the OS installation. |
||
| 74 | |||
| 75 | The first step is to open the standard port 80 in the firewall for the web server: |
||
| 76 | |||
| 77 | <pre> |
||
| 78 | $ sudo firewall-cmd --zone=public --add-service=http |
||
| 79 | $ sudo firewall-cmd --permanent --zone=public --add-service=http |
||
| 80 | </pre> |
||
| 81 | |||
| 82 | The first line opens the port in the current configuration. The second line ensures that, after a restart, that port will remain open and available. |
||
| 83 | |||
| 84 | The second step is to start the web server and database server: |
||
| 85 | |||
| 86 | <pre> |
||
| 87 | $ sudo systemctl start httpd mariadb |
||
| 88 | $ sudo systemctl enable httpd mariadb |
||
| 89 | </pre> |
||
| 90 | |||
| 91 | 1 | Jamie McPeek | Similar to the firewall commands, the first line starts the servers in the current configuration. The second line ensures that, after a restart, both servers come back online. |
| 92 | 4 | Jamie McPeek | |
| 93 | h2. Configuring MariaDB |
||
| 94 | |||
| 95 | Now that you have a database server up and running, it needs to be configured for use. The initial setup can be performed with the following command: |
||
| 96 | |||
| 97 | <pre> |
||
| 98 | $ mysql_secure_installation |
||
| 99 | </pre> |
||
| 100 | |||
| 101 | This will prompt you to create a password for the root account as well as a number of other choices. For a standard setup, the default choice for each question is acceptable. |
||
| 102 | |||
| 103 | Advanced usages or installations may opt for different answers; however, that is beyond the scope of this guide. |
||
| 104 | |||
| 105 | h3. Creating a Redmine Database and Account |
||
| 106 | |||
| 107 | Now that you have MariaDB configured, it is time to create a database and user for use with your Redmine installation. |
||
| 108 | |||
| 109 | First, connect to the server: |
||
| 110 | |||
| 111 | <pre> |
||
| 112 | $ mysql -u root -p |
||
| 113 | </pre> |
||
| 114 | |||
| 115 | You will be prompted to enter the root password. Once provided, you will be able to issue the following commands: |
||
| 116 | |||
| 117 | <pre><code class="sql"> |
||
| 118 | CREATE DATABASE redmine CHARACTER SET utf8; |
||
| 119 | CREATE USER 'redmine'@'localhost' IDENTIFIED BY '<user_password>'; |
||
| 120 | GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; |
||
| 121 | </code></pre> |
||
| 122 | |||
| 123 | The above commands will create the database, create a user with a defined password, and ensure the created user has full access on the newly created database. |
||
| 124 | |||
| 125 | Once those commands have been entered, issue the following command to return to the command line: |
||
| 126 | |||
| 127 | <pre> |
||
| 128 | quit |
||
| 129 | </pre> |
||
| 130 | |||
| 131 | h2. Obtaining Redmine |
||
| 132 | |||
| 133 | Now that all the dependencies are installed and the servers are up and running it's time to get the stable release of Redmine and begin its installation. |
||
| 134 | |||
| 135 | In this example, we'll use wget to download the file from the Redmine server and tar to extract its contents: |
||
| 136 | |||
| 137 | <pre> |
||
| 138 | $ wget http://www.redmine.org/releases/redmine-2.5.2.tar.gz |
||
| 139 | $ tar xfzv redmine-2.5.2.tar.gz |
||
| 140 | </pre> |
||
| 141 | |||
| 142 | h2. Redmine Database Configuration |
||
| 143 | |||
| 144 | To ensure proper functionality, the Redmine installation will need to communicate with the database that has just been created. This can be done by performing the following: |
||
| 145 | |||
| 146 | <pre> |
||
| 147 | $ cd redmine-2.5.2/config |
||
| 148 | $ cp database.yml.example database.yml |
||
| 149 | $ nano -w database.yml |
||
| 150 | </pre> |
||
| 151 | |||
| 152 | Once the file has been opened, the @production@ definition needs to be updated to match the database and account used above. It should look as follows: |
||
| 153 | |||
| 154 | <pre><code class="yaml"> |
||
| 155 | production: |
||
| 156 | adapter: mysql2 |
||
| 157 | database: redmine |
||
| 158 | host: localhost |
||
| 159 | username: redmine |
||
| 160 | password: "<user_password>" |
||
| 161 | encoding: utf8 |
||
| 162 | </code></pre> |
||
| 163 | |||
| 164 | This replaces the user @root@ and the blank password in the example configuration file. |
||
| 165 | |||
| 166 | h2. Redmine Installation Directory |
||
| 167 | |||
| 168 | With most of the precursor work completed, it's time to move the installation to a folder more accessible than a user's home directory. |
||
| 169 | |||
| 170 | For the purposes of this guide, Redmine will be moved to @/var/www/redmine@; however, this could be moved to a variety of over locations based on personal needs. |
||
| 171 | |||
| 172 | This can be don with the following commands: |
||
| 173 | |||
| 174 | <pre> |
||
| 175 | $ cd /var/www |
||
| 176 | $ sudo cp -R ~/redmine-2.5.2 redmine |
||
| 177 | $ cd redmine |
||
| 178 | </pre> |
||
| 179 | |||
| 180 | To ensure proper functionality and access rights, the @public/plugin_assets@ folder needs to be created: |
||
| 181 | |||
| 182 | <pre> |
||
| 183 | $ sudo mkdir public/plugin_assets |
||
| 184 | </pre> |
||
| 185 | |||
| 186 | To allow read/write access to the folders, the user @apache@ needs to have access: |
||
| 187 | |||
| 188 | <pre> |
||
| 189 | $ sudo chown apache:apache -R files log public/plugin_assets tmp |
||
| 190 | </pre> |
||
| 191 | |||
| 192 | h3. Optional SELinux Configuration |
||
| 193 | |||
| 194 | If you plan to re-enable SELinux after installation, the following steps should be taken to ensure smooth execution. |
||
| 195 | |||
| 196 | <pre> |
||
| 197 | $ sudo chcon -R --reference=/var/www/html /var/www/redmine |
||
| 198 | </pre> |
||
| 199 | |||
| 200 | This command applies SELinux directory permissions typically for a web server to all sub-directories under the redmine top-level folder. |
||
| 201 | |||
| 202 | <pre> |
||
| 203 | $ sudo chcon -t httpd_sys_content_rw_t -R files log public/plugin_assets tmp |
||
| 204 | </pre> |
||
| 205 | |||
| 206 | This command enables the specific folders listed to have read/write access while SELinux is active. Under a normal configuration with SELinux, all web directories are read-only. |
||
| 207 | 5 | Jamie McPeek | |
| 208 | h2. Ruby Gem Installation |
||
| 209 | |||
| 210 | The ruby dependencies for Redmine are managed by bundler, so that must be installed first to determine what else must be downloaded and installed. |
||
| 211 | |||
| 212 | <pre> |
||
| 213 | $ sudo gem install bundler |
||
| 214 | </pre> |
||
| 215 | |||
| 216 | With bundler installed, the Redmine ruby dependencies can be sorted: |
||
| 217 | |||
| 218 | <pre> |
||
| 219 | $ sudo /usr/local/bin/bundle install --without development test |
||
| 220 | </pre> |
||
| 221 | |||
| 222 | *Note 1:* By default @/usr/local/bin@ is not on @$PATH@ for the @root@ user, so the absolute path must be provided. |
||
| 223 | |||
| 224 | *Note 2:* Bundle will complain about installing gems via sudo making them only usable by @root@. This is not true - by installing as @root@, these gems are available to all users. |
||
| 225 | |||
| 226 | h2. Native Extension Fixes |
||
| 227 | |||
| 228 | When running @bundler@ as root, the @mysql2@ and @rmagick@ native extensions get installed, but to a folder not on ruby's path. To correct this, the following steps should be taken: |
||
| 229 | |||
| 230 | <pre> |
||
| 231 | $ sudo mkdir -p /usr/local/lib64/ruby/site_ruby/mysql2 |
||
| 232 | </pre> |
||
| 233 | |||
| 234 | This creates the path that ruby expects to find the @mysql2.so@ file at. |
||
| 235 | |||
| 236 | <pre> |
||
| 237 | $ cd /usr/local/share/gems/gems/mysql2-0.3.16/ext/mysql2 |
||
| 238 | $ sudo ruby extconf.rb |
||
| 239 | $ sudo make |
||
| 240 | $ sudo make install |
||
| 241 | </pre> |
||
| 242 | |||
| 243 | The above steps complete the install to the expected directory using default compile options. Special options are beyond the scope of this guide. |
||
| 244 | |||
| 245 | The same should now be performed for the @rmagick@ native extension: |
||
| 246 | |||
| 247 | <pre> |
||
| 248 | $ cd /usr/local/share/gems/gems/rmagick-2.13.3/ext/RMagick |
||
| 249 | $ sudo ruby extconf.rb |
||
| 250 | $ sudo make |
||
| 251 | $ sudo make install |
||
| 252 | </pre> |
||
| 253 | |||
| 254 | Once again, the above steps complete the install to the expected directory using default compile options. |
||
| 255 | |||
| 256 | Finally, return to the installation directory to finish the remaining steps: |
||
| 257 | |||
| 258 | <pre> |
||
| 259 | $ cd /var/www/redmine |
||
| 260 | </pre> |
||
| 261 | |||
| 262 | h2. Redmine Database Initialization |
||
| 263 | |||
| 264 | We're on to the final steps of completing the Redmine installation now that everything else has been taken care of. |
||
| 265 | |||
| 266 | The first step is to generate the secret key for session management: |
||
| 267 | |||
| 268 | <pre> |
||
| 269 | $ sudo /usr/local/bin/rake generate_secret_token |
||
| 270 | </pre> |
||
| 271 | |||
| 272 | Next, the database needs to be setup: |
||
| 273 | |||
| 274 | <pre> |
||
| 275 | $ sudo RAILS_ENV=production /usr/local/bin/rake db:migrate |
||
| 276 | </pre> |
||
| 277 | |||
| 278 | Finally, the database needs to be populated with default data: |
||
| 279 | |||
| 280 | <pre> |
||
| 281 | $ sudo RAILS_ENV=production /usr/local/bin/rake redmine:load_default_data |
||
| 282 | </pre> |
||
| 283 | |||
| 284 | This will prompt you to pick your language, which defaults to [en]. |
||
| 285 | |||
| 286 | h3. WEBRick Test Execution |
||
| 287 | |||
| 288 | Once this step has been completed, you have a fully functional Redmine installation and can run this for testing via WEBRick: |
||
| 289 | |||
| 290 | <pre> |
||
| 291 | $ sudo ruby script/rails server webrick -e production |
||
| 292 | </pre> |