Files
pronature-platform/.docs/server-installation.md
T
2024-12-16 16:51:46 +02:00

44 lines
2.8 KiB
Markdown

# ProNature Server and Application Installation
## Services to install
### [Mongo DB Community 8+ ](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/)
> sudo apt-get install gnupg curl
> curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
--dearmor
> echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
> sudo apt-get update
> sudo apt-get install -y mongodb-org
> sudo systemctl start mongod
> sudo systemctl status mongod
> sudo systemctl enable mongod
### NodeJS
> curl -fsSL https://fnm.vercel.app/install | bash
> source ~/.bashrc
> fnm use --install-if-missing 22
> node -v # should print `v22.11.0`
> npm -v # should print `10.9.0`
### PM2
> npm install pm2 -g
> pm2 startup
2. NGINX. Important config - set redirect from http to https. Virtual host config example - [**nginx.`your_dl_name`.conf** ](./nginx.your_dl_name.conf)
3. PM2. Install and enable the process manager for nodejs (after NodeJS and NPM are installed). Config and run using the nonroot user.
4. SPHINX. Install in **/opt/sphinx**. Create a service using config in sphinx.service. Copy to sphinx bin/ folder and configure FTS indexes in [**sphinx.conf**](./sphinx.conf) template. Make sure all paths are available. **/opt/sphinx** should be owned by the nonroot user.
## Tools to install
1. Let's Encrypt CertBot, for certificates issuing and renewal. The certificate is installed using the following command: `certbot certonly -d your.server.name`. Use `--nginx` or `--apache` in order to have automatic renewal
1. ffmpeg - for converting video and audio content
1. ghostscript - for creating thumbnails for PDF files
1. OpenSSH Server - to be able to access the server remotely
1. UFW - Firewall, configure to allow access only on 443, 80, and 22 (if possible, only for specific hosts)
1. rsync - for backup
1. fail2ban - to protect from SSH attacks
1. postfix - in order to get CRON jobs notifications
1. mailutils - CRON jobs mail notifications
1. In order to enable web server monitoring you can install and run:
- Linux Dash using this [instruction](https://github.com/afaqurk/linux-dash). You can run it using `pm2 start ecosystem.config.js` (on https://your.server.name/host-monitor/) OR
<!-- - Netdata (`app install netdata`) and https://your.server.name/netdata/ -->
- [Netdata](https://learn.netdata.cloud/docs/installing/one-line-installer-for-all-linux-systems) - `wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh --stable-channel`