| Server IP : 104.129.129.72 / Your IP : 216.73.216.229 Web Server : LiteSpeed System : Linux 123answers 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : answe8064 ( 1002) PHP Version : 8.2.28 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /opt/installer/apps/ |
Upload File : |
#!/bin/bash
# Add this at the beginning of all scripts.
if [ -f "include/startup.sh" ]; then
. include/startup.sh
elif [ -f "../include/startup.sh" ]; then
. ../include/startup.sh
fi
# Update system and install required packages
apt-get update
apt-get install -y libmariadb-dev-compat apt-transport-https
# Variables
DB_REDMINE_PASS="redmine"
REPO_URL="https://www.redmine.org/releases/redmine-5.1.3.tar.gz"
REPO_DIR="/opt/redmine"
WEBAPP_CONF="/etc/apache2/sites-available"
# Secure MySQL and set up Redmine database
echo "Creating redmine database..." | log
mysql -u root <<_EOF_
-- Set the root password to empty and use mysql_native_password for authentication
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';
FLUSH PRIVILEGES;
-- Delete anonymous users for security reasons
DELETE FROM mysql.user WHERE User='';
-- Create the Redmine database and user
CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY '${DB_REDMINE_PASS}';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;
_EOF_
# Continue with Redmine setup or other steps
echo "Database setup completed successfully." | log
# Install Redmine
echo "Creating redmine dir ${REPO_DIR}..." | log
mkdir -p ${REPO_DIR}
echo "Downloading from ${REPO_URL} to ${REPO_DIR}..." | log
curl -s ${REPO_URL} | sudo tar xz -C ${REPO_DIR} --strip-components=1
echo "Download Complete." | log
# Configuring permissions
echo "Configuring permissions..." | log
chown -R www-data:www-data /opt/redmine/
cd ${REPO_DIR}
# Configure database connection
echo "Configure database connection..." | log
cat <<_EOF_ > ${REPO_DIR}/config/database.yml
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "${DB_REDMINE_PASS}"
encoding: utf8mb4
_EOF_
# Install gems
gem install bundler
bundle config set --local without 'development test' | log
bundle install
# Prepare the database
bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data
# Install ImageMagic for Redmine
echo "Installing ImageMagic & ghostscript..." | log
apt update
apt install -y imagemagick libmagickwand-dev
convert -version
apt install -y ghostscript
echo "Writing apache configuration file..."
cat <<_EOF_ > $WEBAPP_CONF/redmine.conf
<VirtualHost *:80>
ServerName _
DocumentRoot ${REPO_DIR}/public
<Directory ${REPO_DIR}/public>
Allow from all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName _
DocumentRoot ${REPO_DIR}/public
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
<Directory ${REPO_DIR}/public>
Allow from all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
</IfModule>
_EOF_
# Enable Redmine site, disable default site
echo "Enabling redmine site & disabling defaults..."
a2ensite redmine
a2dissite installProgress
systemctl reload apache2
echo "Adding descriptions" | log
descriptionAppend "Redmine default admin user: Admin"
descriptionAppend "Redmine default admin password: admin"
echo "Redmine installation is complete."