3.7 KiB
Running it on Debian Stretch
1. Install the required packages:
sudo apt install apache2 mariadb-server php7.0 php7.0-mysql php7.0-xml \
php7.0-intl php7.0-mbstring git curl
2. Clone the repository
You may install Monica by simply closing the repository. Consider cloning the repository into any folder, example here in /var/www/monica directory:
sudo git clone https://github.com/monicahq/monica.git /var/www/monica
You should check out a tagged version of Monica since master branch may not always be stable.
Find the latest official version on the release page
cd /var/www/monica
# Clone the desired version
sudo git checkout tags/v1.6.2
3. Change permissions on the new folder
sudo chown -R www-data:www-data /var/www/monica
4. Install nodejs (this is needed for npm)
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt install -y nodejs
5. Install composer
Download and install the binary by following the Command-line installation of composer.
Move it to the bin directory.
sudo mv composer.phar /usr/local/bin/composer
6. Setup the database
First make the database a bit more secure.
sudo mysql_secure_installation
Next log in with the root account to configure the database.
sudo mysql -uroot -p
Create a database called 'monica'.
CREATE DATABASE monica;
Create a user called 'monica' and its password 'strongpassword'.
CREATE USER 'monica'@'localhost' IDENTIFIED BY 'strongpassword';
We have to authorize the new user on the monica db so that he is allowed to change the database.
GRANT ALL ON monica.* TO 'monica'@'localhost';
And finally we apply the changes and exit the database.
FLUSH PRIVILEGES;
exit
7. Configure Monica
cd /var/www/monica then run these steps with sudo:
cp .env.example .envto create your own version of all the environment variables needed for the project to work.- Update
.envto your specific needs. Don't forget to setDB_USERNAMEandDB_PASSWORDwith the settings used behind. - Run
composer install --no-interaction --prefer-dist --no-suggest --optimize-autoloader --no-dev --ignore-platform-reqsto install all packages. - Run
npm installto install all the front-end dependencies and tools needed to compile assets. - Run
npm run productionto compile js and css assets. - Run
php artisan key:generateto generate an application key. This will setAPP_KEYwith the right value automatically. - Run
php artisan setup:productionto run the migrations, seed the database and symlink folders. - Optional: run
php artisan passport:installto create the access tokens required for the API (Optional).
8. Configure cron job
As recommended by the generic installation instructions we create a cronjob which runs artisan schedule:run every minute.
For this execute this command:
sudo crontab -e
And then add this line to the bottom of the window that opens.
* * * * * sudo -u www-data php /var/www/monica/artisan schedule:run
9. Configure Apache webserver
We need to enable the rewrite module of the Apache webserver:
sudo a2enmod rewrite
Edit /etc/apache2/sites-enabled/000-default.conf file.
- Update
DocumentRootproperty to:
DocumentRoot /var/www/monica/public
- and add a new
Directorydirective:
<Directory /var/www/monica/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Finally restart Apache.
sudo systemctl restart apache2
Monica will be up and running to http://localhost.