Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Installing Rails and Redmine in Ubuntu 16.04 LTS / Linux Mint 18
# Make sure you have already installed apache and mysql;
# see
# for instructions.
# install rails
sudo apt install rails
# install comman dependencies
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev make libmysqlclient-dev imagemagick \
libmagickcore-dev libmagickwand-dev
#install passenger mod for apache to run rails
sudo apt-get install libapache2-mod-passenger
sudo mkdir -p /opt/redmine
# download redmine and move it (e.g `sudo mv /download/path/redmine-3.3.1 /opt/redmine/`) to
# /opt/redmine so we get some thing like /opt/redmine/redmine-3.3.1
# then cd /opt/redmine/redmine-3.3.1
# Run the SQL statement below; Don't forget to replace your_password_here with the password that you specified in the
# config/database.yml file while you were configuring the database for Redmine.
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'your_password_here';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
sudo mv ./config/database.yml.example ./config/database.yml
# edit ./config/database.yml with the correct db credential values
sudo gem install bundler
bundle install --without development test
# create a secret token for the Redmine session
bundle exec rake generate_secret_token
# Next, we need to create the structure (tables, indexes, and so on) of the Redmine database:
RAILS_ENV=production bundle exec rake db:migrate
# Finally, we need to insert initial data (such as trackers, the administrator account, and so on) into the database:
RAILS_ENV=production bundle exec rake redmine:load_default_data
# Now Configure Apache
cd /etc/apache2
# Now, create the redmine.conf file in the sites-available subdirectory with the following content (do this under root):
<VirtualHost *:3000>
RailsEnv production
DocumentRoot /opt/redmine/redmine-3.2.0/public
<Directory "/opt/redmine/redmine-3.2.0/public">
Allow from all
Require all granted
# This is the configuration of the virtual host that will run Redmine. However, this is not the only virtual host that we currently have.
# Please note that Redmine, which is installed and configured this way, is going to run from your user account.
# If you prefer to use another user, www-data, for example, you need to add PassengerDefaultUser www-data
# to your virtual host configuration, and change the owner of the redmine-3.2.0 directory by executing
# chown www-data:www-data /opt/redmine/redmine-3.2.0 -R.
# enable the redmine.conf
sudo a2ensite redmine
# add port 3000 to the /etc/apache2/ports.conf file like so:
Listen 3000
# restart apache
sudo service apache2 reload
# Good books for redmine:
# Follow instructions here
# then login into Redmine with the following use and password
# admin admin
# Change http to https (ssl) (letsencrypt)
# goto :
# and install certbot
sudo certbot --apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): email
Starting new HTTPS connection (1):
Please read the Terms of Service at You must
agree in order to register with the ACME server at
(A)gree/(C)ancel: A
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
(Y)es/(N)o: Yes
Starting new HTTPS connection (1):
No names were found in your configuration files. Please enter in your domain
name(s) (comma and/or space separated) (Enter 'c' to cancel):
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
We were unable to find a vhost with a ServerName or Address of
Which virtual host would you like to choose?
(note: conf files with multiple vhosts are not yet supported)
1: 000-default.conf | | | Enabled
2: redmine.conf | | | Enabled
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Created an SSL vhost at /etc/apache2/sites-available/redmine-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/redmine-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/redmine-le-ssl.conf
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/redmine.conf to ssl vhost in /etc/apache2/sites-available/redmine-le-ssl.conf
Congratulations! You have successfully enabled
You should test your configuration at:
# Add sudo certbot --apache to crontab (monthly)
cat /etc/cron.d/certbot
0 0 1 * * sudo certbot --apache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.