Installazione di Redmine su Ubuntu 18.04
In questo tutorial andremo a descrivere come installare il software di project management Redmine su Ubuntu 18.04.
Consideriamo di partire da una macchina preinstallata Ubuntu 18.04 (per l’installazione leggere il seguente articolo) ed aggiorniamola
sudo apt-get update
sudo apt-get upgrade
installiamo Mysql server
sudo apt-get install mysql-server
installiamo alcuni software per l’installazione di Redmine come ad esempio git per il versionamento dei progetti
sudo apt-get install curl mysql-server libmysqlclient-dev git-core subversion imagemagick libmagickwand-dev
sudo apt-get update
essendo Redmine un software basato su Ruby dovremo installare il Ruby Version Manager (RVM)
sudo command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L https://get.rvm.io | sudo bash -s stable
quindi otteniamo il seguente risultato
Creating group ‘rvm’
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:* First you need to add all users that will be using rvm to ‘rvm’ group,
and logout – login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
* Please do NOT forget to add your users to the rvm group.
The installer no longer auto-adds root or users to the rvm group. Admins must do this.
Also, please note that group memberships are ONLY evaluated at login time.
This means that users must log out then back in before group membership takes effect!
impostiamo che il caricamento dell’ RVM come variabile di ambiente ogni volta che ci colleghiamo
sudo source /usr/local/rvm/scripts/rvm
sudo echo '[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"' >> ~/.bashrc
adesso installiamo Ruby versione 2.3
sudo command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
sudo rvm get head
sudo rvm install ruby-2.3
Iniziamo con l’installazione di Redmine, essendo un’applicazione ha bisogno di un web server Nginx ed un software che per mette di gestire l’applicazione Ruby su Nginx cioè Phusion Passenger
sudo apt-get install libcurl4-gnutls-dev
sudo gem install passenger --no-ri --no-rdoc
sudo passenger-install-nginx-module
avremo
Welcome to the Phusion Passenger Nginx module installer, v5.3.7.
This installer will guide you through the entire installation process. It
shouldn’t take more than 5 minutes in total.Here’s what you can expect from the installation process:
1. This installer will compile and install Nginx with Passenger support.
2. You’ll learn how to configure Passenger in Nginx.
3. You’ll learn how to deploy a Ruby on Rails application.Don’t worry if anything goes wrong. This installer will advise you on how to
solve any problems.Press Enter to continue, or Ctrl-C to abort.
facciamo invio
——————————————–
Which languages are you interested in?
Use <space> to select.
If the menu doesn’t display correctly, press ‘!’‣ ⬢ Ruby
⬡ Python
⬡ Node.js
⬡ Meteor
facciamo invio perchè selezioniamo Ruby
Automatically download and install Nginx?
Nginx doesn’t support loadable modules such as some other web servers do,
so in order to install Nginx with Passenger support, it must be recompiled.Do you want this installer to download, compile and install Nginx for you?
1. Yes: download, compile and install Nginx for me. (recommended)
The easiest way to get started. A stock Nginx 1.14.0 with Passenger
support, but with no other additional third party modules, will be
installed for you to a directory of your choice.2. No: I want to customize my Nginx installation. (for advanced users)
Choose this if you want to compile Nginx with more third party modules
besides Passenger, or if you need to pass additional options to Nginx’s
‘configure’ script. This installer will 1) ask you for the location of
the Nginx source code, 2) run the ‘configure’ script according to your
instructions, and 3) run ‘make install’.Whichever you choose, if you already have an existing Nginx configuration file,
then it will be preserved.Enter your choice (1 or 2) or press Ctrl-C to abort:1
scegliamo il percorso, ma facendo invio e lasciando vuoto il campo utilizziamo la proposta di default (/opt/nginx)
Where do you want to install Nginx to?
Please specify a prefix directory [/opt/nginx]:
——————————————–
Wait! You are about to install a NEW Nginx installation!
Your system already has an Nginx installation at:
/usr/sbin/nginx
If you continue using this installer, then it will install an an entirely new
Nginx installation, at /opt/nginx/sbin/nginx.
Are you sure this is what you want?“Wait, what? Do you mean you’re not going to extend my existing Nginx with
Phusion Passenger support?”
We’re sorry, but no. Please read the following for more information, and for
advise on how to deal with this situation:
https://github.com/phusion/passenger/wiki/Why-can’t-Phusion-Passenger-extend-my-existing-Nginx%3FPress Enter to continue installing, or Ctrl-C to abort.
facendo invio compilerà il tutto per poter interpretare Ruby su Nginx
Nginx with Passenger support was successfully installed.
The Nginx configuration file (/opt/nginx/conf/nginx.conf)
must contain the correct configuration options in order for Phusion Pa
to function correctly.This installer has already modified the configuration file for you! Th
following configuration snippet was inserted:http {
…
passenger_root /usr/local/rvm/gems/ruby-2.3.8/gems/passenger-5.3
passenger_ruby /usr/local/rvm/gems/ruby-2.3.8/wrappers/ruby;
…
}After you start Nginx, you are ready to deploy any number of Ruby on R
applications on Nginx.Press ENTER to continue.
——————————————–
Deploying a web application
To learn how to deploy a web app on Passenger, please follow the deployment
guide:https://www.phusionpassenger.com/library/deploy/nginx/deploy/
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) 🙂
https://www.phusionpassenger.comPassenger® is a registered trademark of Phusion Holding B.V.
Scarichiamo ed installiamo lo script per l’avvio di Nginx allo startup
sudo systemctl stop nginx
sudo curl https://raw.githubusercontent.com/makevoid/nginx-passenger-ubuntu/master/nginx/nginx.service > /lib/systemd/system/nginx.service
sudo systemctl daemon-reload
sudo systemctl enable nginx
modifichiamo il file di configurazione di Nginx per l’applicazione Redmine
sudo vim /opt/nginx/conf/nginx.conf
modificare la configurazione del block per connessioni in HTTP
server {
listen 80;
server_name localhost;root /var/data/redmine/public;
passenger_enabled on;
client_max_body_size 10m;}
e riavviamo il web server
sudo systemctl restart nginx
Installiamo Redmine, creiamo una cartella per ospitare il progetto
sudo mkdir /var/data
sudo cd /var/data/
tramite svn scarichiamo il sorgente
sudo svn co http://svn.redmine.org/redmine/branches/3.4-stable redmine
cd /var/data/redmine
configuriamo il file database.yml per la connessione al database Mysql
sudo vim config/database.yml
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: password_a_scelta
encoding: utf8
installiamo i plugin presenti nella soluzione base
sudo gem install bundler --no-ri --no-rdoc
sudo bundle install
impostiamo i permessi dell’utente www-data all’interno delle cartelle di Redmine
sudo chown -R www-data:www-data files log tmp public/plugin_assets config.ru
sudo chmod -R 755 files log tmp public/plugin_assets
Creiamo il database all’interno di Mysql, accediamo tramite linea di comando
sudo mysql -u root -p
mysql>CREATE DATABASE redmine character SET utf8;
creiamo l’utente che dovrà accedere al database
mysql>CREATE user 'redmine'@'localhost' IDENTIFIED BY 'redmine';
forniamo i permessi
mysql>GRANT ALL privileges ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'password_a_scelta';
mysql>exit
Migriamo il database tramite rake eseguendo lo script db:migrate
cd /var/data/redmine
sudo bundle exec rake db:migrate
sudo bundle exec rake redmine:plugins
è possibile importare anche alcune funzionalità come worflow, tracker per la strutturazione di un progetto, attraverso il comando
sudo bundle exec rake redmine:load_default_data RAILS_ENV=production
ci verrà richiesta la lingua di riferimento
Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] it
generiamo un token
sudo bundle exec rake generate_secret_token
ed infine riavviamo il webserver
sudo systemctl restart nginx
adesso tramite un browser possiamo collegarci direttamente a Redmine tramite l’indirizzo http://ip_server/ e iniziare a creare un progetto
per poter accedere la prima volta inserire utente: admin e password: admin