Monica CRM, Part Two
Configure Operating System
So I am back at it today from where I left off yesterday. Next up I'm going to work on configuring SSH.
Steps performed on desktop via Windows Terminal
ssh-keygen -t ed25519
Move-Item -Path c:\Users\david\filename* -Destination c:\Users\david\.ssh -Force
I then open Windows Terminal's Settings
and open the JSON
file and add the following:
{
"colorScheme": "Ubuntu-ColorScheme",
"commandline": "ssh -i \"~/.ssh/monica-01\" [email protected]",
"experimental.retroTerminalEffect": false,
"font":
{
"face": "Cascadia Code"
},
"guid": "{0caa0dad-35be-5f56-a8ff-XXXXXXXXXXXX}",
"hidden": false,
"name": "Monica-01",
"tabTitle": "Monica-01"
},
and make certain that the GUID
is unique before I save.
Steps performed on MONICA-01 via SSH
mkdir ~/.ssh
nano ~/.ssh/authorized_keys
I can then paste in the public key I generated in Windows Terminal and Save the new file.
chmod 600 ~/.ssh/authorized_keys
sudo nano /etc/ssh/sshd_config
PermitRootLogin no
PubkeyAuthentication yes
PubkeyAcceptedKeyTypes ssh-ed25519
PasswordAuthentication no
AuthorizedKeysFile /home/david/.ssh/authorized_keys
sudo sshd -t
sudo systemctl restart ssh
Next I can start working on setting up LAMP.
sudo apt update && apt install apache2 mysql-server mysql-client mysql-common php php-mysqli
But my command fizzles out. Why? Ahhh! I need to add the repository for MySQL.
wget https://dev.mysql.com/get/mysql-apt-config_0.8.22-1_all.deb
sudo apt install ./mysql-apt-config_0.8.22-1_all.deb
apt update && apt install apache 2 mysql-server mysql-client mysql-common php php-mysqli
I set up my MySQL root password and saved it to my password manager. Now let's work on securing MySQL.
mysql_secure_installation
- Set strong password validation
- Remove anonymous user
- Restrict root user access
- Removed the test database
- Reload the privilege tables
Next I need to install Git, Composer, Node.js, and Yarn.
sudo apt install git
wget -q -O - https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin/ --filename=composer
wget -q -O - https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt install -y nodejs
npm install --global yarn
Now I can begin to install Monica itself. First they have me clone the repository. Then setup the database, followed by configuring Monica.
cd /var/www/
sudo git clone https://github.com/monicahq/monica.git
cd /var/www/monica
sudo git fetch
git checkout tags/v2.18.0
mysql -uroot -p
CREATE DATABASE monica CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'monica'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL ON monicca.*TO 'monica'@'localhost';
FLUSH PRIVILEGES;
Exit
cd /va/www/monica
cp .env.example .env
nano .env
- Set
DB_Username
- Set
DB_Password
- Set
APP_ENV
toproduction
- Set
composer install --no-interaction --no-dev
Your lock file does not contain a compatible set of packages. Please run composer update.
composer update
Composer is operating significantly slower than normal because you do not have the PHP curl extension enabled.
"" ext-bcmath
"" ext-gd
"" ext-gmp
"" ext-intl
"" ext-redis
"" ext-dom
"" Laravel/framework >5.8
"" Tijsverkoyen/css-to-inline-styles 2.2.2
"" Asbiin/laravel-webauthn 0.8
I apparently missed the part in their walkthrough about PHP extensions.
sudo apt install php-bcmath php-curl php-gd php-gmp php-intl php-mbstring php-mysql php-redis php-xml php-zip
composer install --no-interaction --no-dev
A much smaller list of errors this time. It suggests running composer update again.
composer update
Your requirements could not be resolved to an installable set of packages.
Composer.json requires laravel/cashier ~10.0
Laravel/cashier requirs dompdf/dompdf 0.8.0.
Ok I'll try to get dompdf now.
composer require dompdf/dompdf
Installation failed.
The error message suggests "composer require dompdf/dompdf." Huh. What if I try to install it with git?
git clone https://github.com/dompdf/dompdf.git
cd dompdf/lib
git clone https://github.com/PhenX/php-font-lib.git php-font-lib
cd php-font-lib
git checkout 0.5.1
cd ..
git clone https://github.com/PhenX/php-svg-lib.git php-svg-lib
cd php-svg-lib
git checkout v0.3.2
cd ..
git clone https://github.com/sabberworm/PHP-CSS-Parser.git php-css-parser
cd php-css-parser
git checkout 8.1.0
composer update
Success!
composer install --no-interaction --no-dev
Success!
yarn install
Success!
yarn run production
While running it says to run yarn update
next, and then completes in success!
yarn upgrade
Success!
php artisan key:generate
PHP Fatal error: require(): Failed opening required '/var/www/monica/vendor/autoload.php'
Looks like I installed this in the wrong directory. Let's see if I can fix it.
/var/www/monica/dompdf/dompdf/lib/php-css-parser/vendor/autoload.php
Trying to fix this by rn -rf
the dompdf directory. But this doesn't even load the autoload.php in the same structure, it's in a completely different folder not called vendor.
/var/www/monica/dompdf/lib/php-svg-lib/srv/autoload.php
It did not work. Digging around online I find a thread on stackflow. It looks like I've borked the hell out of the composer install. Trying to repair it:
composer dump-autoload
This throws out a different error but it has rebuilt the vendor folder.
composer update --no-scripts
This throws out conflict errors.
composer update
Error: Class 'IlluminateFoundationComposerScripts' not found.
I have clearly messed up the installation big time. I went astray somewhere. Oh I know, it probably has to do with missing those PHP modules. I'm just going to wipe the virtual drive and start fresh since I've put in as much time troubleshooting as I had to get there.