Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

How to Install Redmine with Apache on Ubuntu 24.04

How to Install Redmine with Apache on Ubuntu 24.04

Setting up Redmine with Apache on Ubuntu 24.04 provides a powerful and flexible project management environment suitable for teams of all sizes. This guide walks you through the entire process, from installing prerequisites to configuring your server for optimal performance. Before starting, ensure you have a clean Ubuntu 24.04 server with root or sudo privileges, a stable internet connection, and a basic understanding of Linux command line operations. Having a domain name configured is optional but recommended for easier access.

What You’ll Need

  • Ubuntu 24.04 server with sudo privileges
  • Root or sudo user access
  • Domain name (optional but recommended)
  • Basic knowledge of Linux terminal commands
  • Firewall access to open necessary ports (80, 443, 3000)

Step-by-Step

  1. Update Your System – Start by updating your package list and upgrading existing packages:
    sudo apt update && sudo apt upgrade -y
  2. Install Required Dependencies – Install essential packages including Apache, MySQL, Ruby, and other dependencies:
    sudo apt install apache2 libapache2-mod-passenger mysql-server mysql-client libmysqlclient-dev git curl gnupg2 -y
  3. Create a Database for Redmine – Secure MySQL and set up a dedicated database:
    sudo mysql -e "CREATE DATABASE redmine CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
    sudo mysql -e "CREATE USER 'redmineuser'@'localhost' IDENTIFIED BY 'your_password';"
    sudo mysql -e "GRANT ALL PRIVILEGES ON redmine.* TO 'redmineuser'@'localhost';"
    sudo mysql -e "FLUSH PRIVILEGES;"
  4. Install Ruby and Dependencies – Use RVM or system Ruby. Here, we’ll use system Ruby for simplicity:
    sudo apt install ruby-full build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev -y
  5. Download Redmine – Get the latest stable version from the official repository:
    cd /opt
    sudo git clone https://github.com/redmine/redmine.git -b 4.2-stable redmine
  6. Configure Redmine – Set up the configuration files:
    cd /opt/redmine
    sudo cp config/database.yml.example config/database.yml
    

    Edit the database configuration:

    sudo nano config/database.yml

    Update with your database credentials:

    production:
      adapter: mysql2
      database: redmine
      host: localhost
      username: redmineuser
      password: "your_password"
  7. Install Dependencies with Bundler – Install the necessary Ruby gems:
    sudo gem install bundler
    sudo bundle install --without development test
  8. Generate Secret Token and Database Migration – Prepare Redmine:
    sudo bundle exec rake generate_secret_token
    sudo RAILS_ENV=production bundle exec rake db:migrate
  9. Precompile Assets – Optimize static assets:
    sudo RAILS_ENV=production bundle exec rake assets:precompile
  10. Configure Apache – Set up a virtual host for Redmine:
    sudo nano /etc/apache2/sites-available/redmine.conf

    Insert:

    
        ServerName yourdomain.com
        DocumentRoot /opt/redmine/public
    
        
            Require all granted
            Options -MultiViews
        
    
        ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
        CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined
    

    Enable the site and Passenger module:

    sudo a2ensite redmine.conf
    sudo a2enmod passenger
    sudo systemctl restart apache2
  11. Secure Your Installation – Optionally, set up SSL with Let’s Encrypt:
    sudo apt install certbot python3-certbot-apache
    sudo certbot --apache -d yourdomain.com
  12. Access Redmine – Open your browser and navigate to http://yourdomain.com or http://server-ip. Log in with default credentials (admin/admin) and change your password immediately.

Common Mistakes

  • Failing to update system packages before starting, leading to dependency issues.
  • Using incorrect database credentials or forgetting to grant privileges in MySQL.
  • Not installing the required Ruby dependencies, causing bundle install failures.
  • Misconfiguring Apache virtual hosts, leading to inaccessible Redmine pages.
  • Neglecting to restart Apache after configuration changes.
  • Forgetting to precompile assets, resulting in missing CSS or JavaScript files.
  • Not securing the server with SSL, leaving data vulnerable.

Tips

  • Use a dedicated user for running Redmine for better security.
  • Back up your database regularly, especially before upgrades or migrations.
  • Use a domain name with SSL for production environments to ensure security and trust.
  • Monitor your server logs for errors and performance issues.
  • Automate backups and updates to streamline maintenance.

Troubleshooting

If Redmine does not load or you encounter errors, follow these steps:

  • Check Apache error logs:
    sudo tail -f /var/log/apache2/redmine_error.log
  • Ensure the Passenger module is enabled:
    sudo a2enmod passenger
  • Verify your database connection settings in config/database.yml.
  • Ensure all dependencies are installed correctly, especially Ruby gems:
    bundle check
  • Restart Apache after configuration changes:
    sudo systemctl restart apache2
  • Test database connectivity separately to rule out MySQL issues.

Frequently Asked Questions

Can I install Redmine without root access?

Installing as a non-root user is possible but requires more setup, such as local Ruby and database installations. It’s recommended to have root privileges for a smoother setup.

How do I upgrade Redmine later?

Backup your database, download the new Redmine version, replace the application files, run migrations, and restart the server. Always test upgrades in a staging environment first.

Is it necessary to use Apache, or can I use other web servers?

Redmine supports other web servers like Nginx, but Apache with Passenger is the most straightforward setup for beginners on Ubuntu.

How do I enable HTTPS on my Redmine server?

Use Certbot with Let’s Encrypt to generate and install free SSL certificates, then configure your Apache virtual host to redirect HTTP to HTTPS.

What are common security considerations?

Secure your database, use strong passwords, enable SSL, keep your system updated, and restrict server access to trusted IPs.

Can I run Redmine with multiple users?

Yes, Redmine supports multiple users with role-based permissions, making it suitable for teams of any size.

Related

How to Install Redmine with Apache on Ubuntu 24.04
Scroll to top