How to install openproject version (14.0) in Ubuntu 22.04
How to install openproject version (14.0) in Ubuntu 22.04
How to Install PostgreSQL 13
Step1:
We always work on the latest OS release to ensure there are no old dependency issues. Login to your Ubuntu server and run the following commands to update all the packages installed.
sudo apt update && sudo apt -y full-upgrade
Install required dependency packages
Step2:
sudo apt install curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates
Now that we have updated and rebooted our system, let’s add the APT repository required to pull the packages form the PostgreSQL repository.
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc%7Csudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
After importing GPG key, add repository contents to your Ubuntu 22.04|20.04|18.04 system:
The repository added contains many different packages including third-party addons. They include:
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee /etc/apt/sources.list.d/pgdg.list
Step3:
We can install the PostgreSQL 13 packages with the repository added to our Ubuntu 22.04|20.04|18.04 Linux server. But first, update the package index so that the version is available at the OS level.
sudo apt update
Step4:
The run the commands below to install PostgreSQL 13 on Ubuntu 22.04|20.04|18.04 Linux system.
sudo apt install postgresql-13 postgresql-client-13
Step5:
The PostgreSQL service is started and set to come up after every system reboot.
systemctl status postgresql
Step6:
During installation, a postgres user is created automatically. This user has full superadmin access to your entire PostgreSQL instance. Before you switch to this account, your logged-in system user should have sudo privileges.
sudo su - postgres
Step7:
Let’s reset this user password to a strong password we can remember.
psql -c "alter user postgres with password 'StrongAdminP@ssw0rd'"
Step8:
Start PostgreSQL prompt by using the command:
psql
Step9:
\conninfo
Step10:
Let’s create a test database and user to see if it’s working.
CREATE DATABASE openproject; CREATE USER openproject WITH ENCRYPTED PASSWORD 'ragupathi@123'; GRANT ALL PRIVILEGES ON DATABASE openproject to openproject;
Step1:
List created databases:
\l
Step11:
\q
Step12:
Installation of PostgreSQL 13 on Ubuntu only accepts connections from localhost. In ideal production environments, you’ll have a central database server and remote clients connecting to it – But of course within a private network (LAN).
To enable remote connections, edit PostgreSQL configuration file:
Vi /etc/postgresql/13/main/postgresql.conf
Uncomment line 59 and change the Listen address to accept connections within your networks.
# Listen on all interfaces listen_addresses = '*' # Listen on specified private IP address listen_addresses = '192.168.10.11'
Step13:
Also, set PostgreSQL to accept remote connections from allowed hosts.
vi /etc/postgresql/13/main/pg_hba.conf
Step14:
After the change, restart Postgresql service.
sudo systemctl restart postgresql
Confirm Listening addresses.
netstat -tunelp | grep 5432
Step15:
Please follow the below command to restore the dump file to the database
psql -U openproject -d openproject < openproject_backup_2024-09-22-0000.sql
How to Install OpenProject
Step1:
Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates wget
Step2:
Import the PGP key used to sign our packages:
sudo wget -O /etc/apt/trusted.gpg.d/openproject.asc https://dl.packager.io/srv/opf/openproject/key
Step3:
Add the OpenProject package source:
sudo wget -O /etc/apt/sources.list.d/openproject.list \ https://dl.packager.io/srv/opf/openproject/stable/14/installer/ubuntu/22.04.repo
Step4:
Download the OpenProject package:
sudo apt-get update sudo apt-get install openproject
Step5:
To start the configuration wizard, please run the following command with sudo, or as root:
sudo openproject configure
Step6:
Click the default openproject option in openproject edition box
Click the use an existing PostgreSQL database and click ok
Click the Install apache2 server
In the server/Hostname box, you give the respective domain name.
In Server_path_prefix their leave it empty.
Server/SSL give no
Click the skip
Enter you respective admin email ID
Click the install new Memcached server
Click the language as English
After that, It will take some time and get below errors
Step7:
The psql command doesn't use the -u option for specifying the username. Instead, you should use the -U option (uppercase U) to specify the username and the -d option to specify the database name.
psql -U openproject -d openproject
he migration is failing because it's likely encountering a nil value where it's expecting a valid setting. Check the settings table in your database for any missing or improperly serialized settings related to LDAP.
Run a query on your PostgreSQL database to inspect the settings table:
SELECT * FROM settings WHERE name = 'ldap_tls_options';
INSERT INTO settings (name, value) VALUES ('ldap_tls_options', '{}');
You can alter the migration file to skip the migration if the setting is nil. For instance, edit the migration file to add a check like this:
ldap_setting = Setting.find_by(name: 'ldap_tls_options')
if ldap_setting.present?
# Continue with migration
else
Rails.logger.warn("LDAP setting missing, skipping migration for 'ldap_tls_options'")
end
Step8:
Run the migration using Bundler: After installing Bundler, you can use the following command to run the migration:
bundle exec rake db:migrate
Step9:
Go to the below directory.
cd /opt/openproject/
Install Bundler: If Bundler is not installed, you can install it using the following command:
gem install bundler
Step10:
The psql command doesn't use the -u option for specifying the username. Instead, you should use the -U option (uppercase U) to specify the username and the -d option to specify the database name.
psql -U openproject -d openproject
It's possible that certain settings expected by the migration do not exist. You can check for existing settings in the settings table:
SELECT * FROM settings;
Check the Structure of the Settings–– Table: First, let's check the current structure of the settings table to see which columns are available. You can do this with the following command:
\d settings
Insert with Available Columns: Based on the output of the above command, modify your INSERT statement to only include the columns that exist in the settings table. For example, if the settings table only has name and value columns, your insert should look like this:
INSERT INTO settings (name, value)
VALUES ('ldap_tls_options', );
Step11:
You need to install Ruby 3.3.4. You can use a version manager like rbenv or rvm to manage Ruby versions. Here’s how to do it using rbenv:
Install rbenv and ruby-build
If you don’t have rbenv installed, you can set it up as follows:
git clone https://github.com/rbenv/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc exec $SHELL git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Step12:
The build failure you're encountering while installing Ruby 3.3.4 may be related to missing dependencies, particularly for compiling OpenSSL or other libraries required by Ruby.
To resolve this, you can install the necessary dependencies before retrying the Ruby installation.
1. Install Dependencies
Run the following command to install the required libraries for building Ruby:
sudo apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev libffi-dev libyaml-dev libgdbm-dev libgmp-dev libncurses5-dev libsqlite3-dev Install Ruby 3.3.4
Once rbenv is set up, install Ruby 3.3.4:
rbenv install 3.3.4
Install the PostgreSQL Development Library Run the following command to install the required package:
apt-get install libpq-dev
Step13:
After switching to the correct Ruby version, you may need to reinstall the gems specified in your Gemfile:
cd /opt/openproject bundle install bundle exec rake db:migrate:status bundle exec rake db:migrate RAILS_ENV=production
Step14:
The error you're encountering suggests that the PostgreSQL connection requires authentication, but no password is provided in the database.yml configuration file for the production environment. To fix this, you'll need to update the database.yml file with the correct credentials for connecting to your PostgreSQL database.
Here’s how you can update the database.yml file:
1. Open the database.yml file (typically located in /opt/openproject/config/database.yml).
2. Ensure the production configuration looks similar to the following, replacing YOUR_DB_USERNAME, YOUR_DB_PASSWORD, YOUR_DB_HOST, and YOUR_DB_NAME with the actual values:
vi /opt/openproject/config/database.yml
production: adapter: postgresql encoding: unicode database: openproject pool: 5 username: openproject password: ragupathi@123 host: 127.0.0.1
Step15:
Generate the secret_key_base Manually
If the rake secret task is unavailable, you can generate a random string manually with Ruby. Run this command to generate a secure random key:
bundle exec ruby -e "require 'securerandom'; puts SecureRandom.hex(64)"
Set the secret_key_base
Once you have the key, you can follow one of the two methods to set it:
Environment Variable:
export SECRET_KEY_BASE=65ee5ca8cfe7582dd08b068482e598aa0577d9df284a64120e7cb21f599107d49ba30aff1dd5fe0549d69eb03e6fe0e1ec3ec528b7ea986787f0ef73e6932e7a
Add it to config/secrets.yml:
vi config/secrets.yml
production: secret_key_base: your_generated_secret_key
Step16:
The error you're encountering suggests that the migration script is failing when trying to access or deserialize a Setting object that is nil, likely because the ldap_tls_options setting doesn't exist or is not initialized.
To resolve this, you can modify the migration to handle this situation more gracefully by checking if the setting exists before attempting to migrate the ldap_settings. Here's what you can try:
Step 16: Modify the Migration File
Edit the migration file /opt/openproject/db/migrate/20221115082403_add_ldap_tls_options.rb to include a check for the existence of the setting before trying to process it. You can add a condition like this:
Open the migration file for editing:
cd /opt/openproject/db/migrate/
Back to the old file to another name
cp 20221115082403_add_ldap_tls_options.rb 20221115082403_add_ldap_tls_options.rb_bk-25-09-24
Open the file
Modify the migrate_ldap_settings method:
Change the migrate_ldap_settings method to look like this:
vi 20221115082403_add_ldap_tls_options.rb
class AddLdapTlsOptions < ActiveRecord::Migration[7.0]
class MigratingAuthSource < ApplicationRecord
self.table_name = "auth_sources"
end
def change
change_table :auth_sources, bulk: true do |t|
t.boolean :verify_peer, default: true, null: false
t.text :tls_certificate_string
end
reversible do |dir|
dir.up do
MigratingAuthSource.reset_column_information
begin
ldap_settings = Setting.find_by(name: "ldap_tls_options")&.value
migrate_ldap_settings(ldap_settings) if ldap_settings
rescue => e
Rails.logger.error("Error during LDAP settings migration: #{e.message}")
end
end
end
end
private
def migrate_ldap_settings(ldap_settings)
return if ldap_settings.blank?
parsed = Setting.deserialize_hash(ldap_settings) rescue nil
return if parsed.blank?
verify_peer = parsed["verify_mode"] == OpenSSL::SSL::VERIFY_PEER
MigratingAuthSource.update_all(verify_peer: verify_peer)
rescue StandardError => e
Rails.logger.error("Failed to set LDAP verify_mode from settings: #{e.message}. Please double check your LDAP configuration.")
end
end
Step17:
Run the migration
bundle exec rake db:migrate RAILS_ENV=production
It shows output as successfully
Step18:
Again reconfigure the openproject. Use step 6
sudo openproject reconfigure
Here output 6000 port has run on your server. Please Check
Step19:
Install Certbot (if it’s not already installed) and the Certbot Apache plugin:
sudo apt update sudo apt install certbot python3-certbot-apache -y Run Certbot to issue the certificate: Use the following command to issue an SSL certificate for your domain: sudo certbot --apache -d testjira.pheonixsolutions.com
Step20:
Browse your respective domain
Referred the document
Install OpenProject with DEB/RPM packages
Install PostgreSQL 13 on Ubuntu 22.04|20.04|18.04 | ComputingForGeeks Invalid Host Name Fix (chatgpt.com)