|
| 1 | +Installation on Ubuntu 18.04 |
| 2 | +============================ |
| 3 | + |
| 4 | +This guide is also working with Ubuntu 20.04 LTS. |
| 5 | + |
| 6 | +# 1. Install LAMP & dependencies |
| 7 | + |
| 8 | +## 1.1. Install system dependencies |
| 9 | + |
| 10 | +```bash |
| 11 | +$ sudo apt-get install zip unzip git gettext curl |
| 12 | +``` |
| 13 | + |
| 14 | +Some might already be installed. |
| 15 | + |
| 16 | +## 1.2. Install MariaDB |
| 17 | + |
| 18 | +```bash |
| 19 | +$ sudo apt-get install mariadb-client mariadb-server |
| 20 | +``` |
| 21 | + |
| 22 | +### Secure the MariaDB installation |
| 23 | + |
| 24 | +```bash |
| 25 | +$ sudo mysql_secure_installation |
| 26 | +``` |
| 27 | + |
| 28 | +Especially by setting a strong root password. |
| 29 | + |
| 30 | +## 1.3. Install Apache2 |
| 31 | + |
| 32 | +```bash |
| 33 | +$ sudo apt-get install apache2 |
| 34 | +``` |
| 35 | + |
| 36 | +### Enable modules, settings, and default of SSL in Apache |
| 37 | + |
| 38 | +```bash |
| 39 | +$ sudo a2dismod status |
| 40 | +$ sudo a2enmod ssl |
| 41 | +$ sudo a2enmod rewrite |
| 42 | +$ sudo a2enmod headers |
| 43 | +``` |
| 44 | + |
| 45 | +### Apache Virtual Host |
| 46 | + |
| 47 | +```conf |
| 48 | + <VirtualHost _default_:80> |
| 49 | + ServerAdmin admin@localhost.lu |
| 50 | + ServerName monarc.local |
| 51 | + DocumentRoot /var/lib/monarc/fo/public |
| 52 | +
|
| 53 | + <Directory /var/lib/monarc/fo/public> |
| 54 | + DirectoryIndex index.php |
| 55 | + AllowOverride All |
| 56 | + Require all granted |
| 57 | + </Directory> |
| 58 | +
|
| 59 | + <IfModule mod_headers.c> |
| 60 | + Header always set X-Content-Type-Options nosniff |
| 61 | + Header always set X-XSS-Protection "1; mode=block" |
| 62 | + Header always set X-Robots-Tag none |
| 63 | + Header always set X-Frame-Options SAMEORIGIN |
| 64 | + </IfModule> |
| 65 | +
|
| 66 | + SetEnv APP_ENV "development" |
| 67 | + </VirtualHost> |
| 68 | +``` |
| 69 | + |
| 70 | + |
| 71 | +## 1.4. Install PHP and dependencies |
| 72 | + |
| 73 | +```bash |
| 74 | +$ sudo apt-get install php apache2 libapache2-mod-php php-curl php-gd php-mysql php-pear php-xml php-mbstring php-intl php-imagick php-zip php-bcmath |
| 75 | +``` |
| 76 | + |
| 77 | + |
| 78 | +## 1.5 Apply all changes |
| 79 | + |
| 80 | +```bash |
| 81 | +$ sudo systemctl restart apache2.service |
| 82 | +``` |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +# 2. Installation of MONARC |
| 87 | + |
| 88 | +```bash |
| 89 | +PATH_TO_MONARC='/var/lib/monarc/fo' |
| 90 | +PATH_TO_MONARC_DATA='/var/lib/monarc/fo-data' |
| 91 | +MONARC_VERSION=$(curl --silent -H 'Content-Type: application/json' https://api.github.com/repos/monarc-project/MonarcAppFO/releases/latest | jq -r '.tag_name') |
| 92 | +MONARCFO_RELEASE_URL="https://github.com/monarc-project/MonarcAppFO/releases/download/$MONARC_VERSION/MonarcAppFO-$MONARC_VERSION.tar.gz" |
| 93 | + |
| 94 | +$ mkdir -p /var/lib/monarc/releases/ |
| 95 | +# Download release |
| 96 | +$ curl -sL $MONARCFO_RELEASE_URL -o /var/lib/monarc/releases/`basename $MONARCFO_RELEASE_URL` |
| 97 | +# Create release directory |
| 98 | +$ mkdir /var/lib/monarc/releases/`basename $MONARCFO_RELEASE_URL | sed 's/.tar.gz//'` |
| 99 | +# Unarchive release |
| 100 | +$ tar -xzf /var/lib/monarc/releases/`basename $MONARCFO_RELEASE_URL` -C /var/lib/monarc/releases/`basename $MONARCFO_RELEASE_URL | sed 's/.tar.gz//'` |
| 101 | +# Create release symlink |
| 102 | +$ ln -s /var/lib/monarc/releases/`basename $MONARCFO_RELEASE_URL | sed 's/.tar.gz//'` $PATH_TO_MONARC |
| 103 | +# Create data and caches directories |
| 104 | +$ mkdir -p $PATH_TO_MONARC_DATA/cache $PATH_TO_MONARC_DATA/DoctrineORMModule/Proxy $PATH_TO_MONARC_DATA/LazyServices/Proxy |
| 105 | +# Create data directory symlink |
| 106 | +$ ln -s $PATH_TO_MONARC_DATA $PATH_TO_MONARC/data |
| 107 | +``` |
| 108 | + |
| 109 | + |
| 110 | +## 2.2. Databases |
| 111 | + |
| 112 | +### Create a MariaDB user for MONARC |
| 113 | + |
| 114 | +With the root MariaDB user create a new user for MONARC: |
| 115 | + |
| 116 | +```sql |
| 117 | +MariaDB [(none)]> CREATE USER 'monarc'@'%' IDENTIFIED BY 'password'; |
| 118 | +MariaDB [(none)]> GRANT ALL PRIVILEGES ON * . * TO 'monarc'@'%'; |
| 119 | +MariaDB [(none)]> FLUSH PRIVILEGES; |
| 120 | +``` |
| 121 | + |
| 122 | +### Create 2 databases |
| 123 | + |
| 124 | +In your MariaDB interpreter: |
| 125 | + |
| 126 | +```sql |
| 127 | +MariaDB [(none)]> CREATE DATABASE monarc_cli DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; |
| 128 | +MariaDB [(none)]> CREATE DATABASE monarc_common DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; |
| 129 | +``` |
| 130 | + |
| 131 | +* monarc_common contains models and data created by CASES; |
| 132 | +* monarc_cli contains all client risk analyses. Each analysis is based on CASES |
| 133 | + model of monarc_common. |
| 134 | + |
| 135 | +### Initializes the database |
| 136 | + |
| 137 | +```bash |
| 138 | +$ mysql -u monarc -ppassword monarc_common < db-bootstrap/monarc_structure.sql |
| 139 | +$ mysql -u monarc -ppassword monarc_common < db-bootstrap/monarc_data.sql |
| 140 | +``` |
| 141 | + |
| 142 | +### Database connection |
| 143 | + |
| 144 | +Create the configuration file: |
| 145 | + |
| 146 | +```bash |
| 147 | +$ sudo cp ./config/autoload/local.php.dist ./config/autoload/local.php |
| 148 | +``` |
| 149 | + |
| 150 | +And configure the database connection: |
| 151 | + |
| 152 | +```php |
| 153 | + return [ |
| 154 | + 'doctrine' => [ |
| 155 | + 'connection' => [ |
| 156 | + 'orm_default' => [ |
| 157 | + 'params' => [ |
| 158 | + 'host' => 'localhost', |
| 159 | + 'user' => 'monarc', |
| 160 | + 'password' => 'password', |
| 161 | + 'dbname' => 'monarc_common', |
| 162 | + ], |
| 163 | + ], |
| 164 | + 'orm_cli' => [ |
| 165 | + 'params' => [ |
| 166 | + 'host' => 'localhost', |
| 167 | + 'user' => 'monarc', |
| 168 | + 'password' => 'password', |
| 169 | + 'dbname' => 'monarc_cli', |
| 170 | + ], |
| 171 | + ], |
| 172 | + ], |
| 173 | + ], |
| 174 | + ]; |
| 175 | +``` |
| 176 | + |
| 177 | +# 3. Migrating MONARC DB |
| 178 | + |
| 179 | +```bash |
| 180 | +$ php ./vendor/robmorgan/phinx/bin/phinx migrate -c module/Monarc/FrontOffice/migrations/phinx.php |
| 181 | +$ php ./vendor/robmorgan/phinx/bin/phinx migrate -c module/Monarc/Core/migrations/phinx.php |
| 182 | +``` |
| 183 | + |
| 184 | + |
| 185 | +# 4. Create initial user |
| 186 | + |
| 187 | +```bash |
| 188 | +$ php ./vendor/robmorgan/phinx/bin/phinx seed:run -c ./module/Monarc/FrontOffice/migrations/phinx.php |
| 189 | +``` |
| 190 | + |
| 191 | + |
| 192 | +The username is *admin@admin.localhost* and the password is *admin*. |
| 193 | + |
| 194 | + |
| 195 | +# 5. Statistics for Global Dashboard |
| 196 | + |
| 197 | +If you would like to use the global dashboard stats feature, you need to |
| 198 | +configure a Stats Service instance on your server. |
| 199 | + |
| 200 | +The architecture, installation instructions and GitHub project can be found here: |
| 201 | + |
| 202 | +- https://www.monarc.lu/documentation/stats-service/master/architecture.html |
| 203 | +- https://www.monarc.lu/documentation/stats-service/master/installation.html |
| 204 | +- https://github.com/monarc-project/stats-service |
| 205 | + |
| 206 | +The communication of access to the StatsService is performed on each instance of |
| 207 | +FrontOffice (clients). |
0 commit comments