📋 Commit iniziale con: - ✅ Documentazione unificata in docs/ - ✅ Codice Laravel in netgescon-laravel/ - ✅ Script automazione in scripts/ - ✅ Configurazione sync rsync - ✅ Struttura organizzata e pulita 🔄 Versione: 2025.07.19-1644 🎯 Sistema pronto per Git distribuito
387 lines
8.7 KiB
Markdown
387 lines
8.7 KiB
Markdown
# NetGesCon Laravel - Guida Installazione Linux
|
|
|
|
## 🐧 Compatibilità Sistema Operativo
|
|
**⚠️ IMPORTANTE**: NetGesCon Laravel è progettato ESCLUSIVAMENTE per sistemi Linux.
|
|
- ✅ **Linux**: Ubuntu 22.04+, Debian 11+, CentOS 8+, RHEL 8+
|
|
- ✅ **WSL2**: Windows Subsystem for Linux (per sviluppo)
|
|
- ❌ **Windows**: Non supportato nativamente
|
|
- ❌ **macOS**: Non testato/supportato
|
|
|
|
## 📋 Prerequisiti Sistema
|
|
|
|
### 1. Server Requirements
|
|
```bash
|
|
# Sistema operativo
|
|
Ubuntu 22.04 LTS o successivo (raccomandato)
|
|
Debian 11+ / CentOS 8+ / RHEL 8+
|
|
|
|
# Hardware minimo
|
|
CPU: 2 core
|
|
RAM: 4GB (8GB raccomandato)
|
|
Storage: 20GB liberi
|
|
```
|
|
|
|
### 2. Software Prerequisites
|
|
```bash
|
|
# PHP 8.2+
|
|
php >= 8.2
|
|
php-extensions: mbstring, xml, json, zip, curl, gd, mysql, redis
|
|
|
|
# Database
|
|
MySQL 8.0+ o MariaDB 10.6+
|
|
|
|
# Web Server
|
|
Apache 2.4+ con mod_rewrite
|
|
o Nginx 1.18+
|
|
|
|
# Composer
|
|
Composer 2.0+
|
|
|
|
# Node.js (per asset building)
|
|
Node.js 18+ con npm/yarn
|
|
|
|
# Redis (per cache e sessioni)
|
|
Redis 6.0+
|
|
|
|
# Git
|
|
Git 2.25+
|
|
```
|
|
|
|
## ⚡ Installazione Rapida (Ubuntu/Debian)
|
|
|
|
### Step 1: Aggiornamento Sistema
|
|
```bash
|
|
sudo apt update && sudo apt upgrade -y
|
|
```
|
|
|
|
### Step 2: Installazione PHP 8.2+
|
|
```bash
|
|
# Aggiungere repository PHP
|
|
sudo apt install software-properties-common
|
|
sudo add-apt-repository ppa:ondrej/php -y
|
|
sudo apt update
|
|
|
|
# Installare PHP e estensioni
|
|
sudo apt install php8.2 php8.2-cli php8.2-fpm php8.2-mysql php8.2-xml \
|
|
php8.2-mbstring php8.2-curl php8.2-zip php8.2-gd \
|
|
php8.2-json php8.2-redis php8.2-bcmath -y
|
|
```
|
|
|
|
### Step 3: Installazione Database MySQL
|
|
```bash
|
|
sudo apt install mysql-server -y
|
|
sudo mysql_secure_installation
|
|
|
|
# Configurazione utente NetGesCon
|
|
sudo mysql -e "CREATE USER 'netgescon'@'localhost' IDENTIFIED BY 'PASSWORD_SICURA';"
|
|
sudo mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'netgescon'@'localhost' WITH GRANT OPTION;"
|
|
sudo mysql -e "FLUSH PRIVILEGES;"
|
|
```
|
|
|
|
### Step 4: Installazione Web Server (Apache)
|
|
```bash
|
|
sudo apt install apache2 -y
|
|
sudo a2enmod rewrite ssl headers
|
|
sudo systemctl enable apache2
|
|
sudo systemctl start apache2
|
|
```
|
|
|
|
### Step 5: Installazione Composer
|
|
```bash
|
|
curl -sS https://getcomposer.org/installer | php
|
|
sudo mv composer.phar /usr/local/bin/composer
|
|
composer --version
|
|
```
|
|
|
|
### Step 6: Installazione Node.js
|
|
```bash
|
|
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
|
sudo apt install nodejs -y
|
|
npm --version && node --version
|
|
```
|
|
|
|
### Step 7: Installazione Redis
|
|
```bash
|
|
sudo apt install redis-server -y
|
|
sudo systemctl enable redis-server
|
|
sudo systemctl start redis-server
|
|
```
|
|
|
|
## 🚀 Installazione NetGesCon
|
|
|
|
### Step 1: Clone Repository
|
|
```bash
|
|
# Andare nella directory web
|
|
cd /var/www/
|
|
|
|
# Clone progetto
|
|
sudo git clone https://github.com/TUOREPO/netgescon-laravel.git
|
|
sudo chown -R www-data:www-data netgescon-laravel
|
|
cd netgescon-laravel
|
|
```
|
|
|
|
### Step 2: Installazione Dipendenze
|
|
```bash
|
|
# Composer
|
|
composer install --optimize-autoloader --no-dev
|
|
|
|
# NPM assets
|
|
npm install
|
|
npm run production
|
|
```
|
|
|
|
### Step 3: Configurazione Environment
|
|
```bash
|
|
# Copiare file di configurazione
|
|
cp .env.example .env
|
|
|
|
# Generare Application Key
|
|
php artisan key:generate
|
|
```
|
|
|
|
### Step 4: Configurazione Database (.env)
|
|
```bash
|
|
# Editare .env con i tuoi dati
|
|
nano .env
|
|
```
|
|
|
|
```env
|
|
# Database principale
|
|
DB_CONNECTION=mysql
|
|
DB_HOST=127.0.0.1
|
|
DB_PORT=3306
|
|
DB_DATABASE=netgescon_master
|
|
DB_USERNAME=netgescon
|
|
DB_PASSWORD=TUA_PASSWORD_SICURA
|
|
|
|
# Cache Redis
|
|
CACHE_DRIVER=redis
|
|
SESSION_DRIVER=redis
|
|
QUEUE_CONNECTION=redis
|
|
|
|
REDIS_HOST=127.0.0.1
|
|
REDIS_PASSWORD=null
|
|
REDIS_PORT=6379
|
|
|
|
# Mail (configurare per invio email)
|
|
MAIL_MAILER=smtp
|
|
MAIL_HOST=smtp.tuodominio.com
|
|
MAIL_PORT=587
|
|
MAIL_USERNAME=noreply@tuodominio.com
|
|
MAIL_PASSWORD=password_email
|
|
MAIL_ENCRYPTION=tls
|
|
|
|
# NetGesCon specifico
|
|
NETGESCON_SISTEMA_MULTI_DB=true
|
|
NETGESCON_CARTELLE_DATI_BASE=/var/www/netgescon-data
|
|
NETGESCON_BACKUP_PATH=/var/www/netgescon-backup
|
|
NETGESCON_LOG_LEVEL=info
|
|
```
|
|
|
|
### Step 5: Setup Database
|
|
```bash
|
|
# Creare database master
|
|
mysql -u netgescon -p -e "CREATE DATABASE netgescon_master CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
|
|
|
|
# Eseguire migrazioni
|
|
php artisan migrate
|
|
|
|
# Popolare dati iniziali
|
|
php artisan db:seed
|
|
```
|
|
|
|
### Step 6: Configurazione Permessi
|
|
```bash
|
|
# Directory dati NetGesCon
|
|
sudo mkdir -p /var/www/netgescon-data
|
|
sudo mkdir -p /var/www/netgescon-backup
|
|
sudo chown -R www-data:www-data /var/www/netgescon-data
|
|
sudo chown -R www-data:www-data /var/www/netgescon-backup
|
|
|
|
# Permessi Laravel
|
|
sudo chown -R www-data:www-data storage bootstrap/cache
|
|
sudo chmod -R 775 storage bootstrap/cache
|
|
```
|
|
|
|
### Step 7: Configurazione Apache Virtual Host
|
|
```bash
|
|
sudo nano /etc/apache2/sites-available/netgescon.conf
|
|
```
|
|
|
|
```apache
|
|
<VirtualHost *:80>
|
|
ServerName tuodominio.com
|
|
DocumentRoot /var/www/netgescon-laravel/public
|
|
|
|
<Directory /var/www/netgescon-laravel/public>
|
|
AllowOverride All
|
|
Require all granted
|
|
</Directory>
|
|
|
|
ErrorLog ${APACHE_LOG_DIR}/netgescon_error.log
|
|
CustomLog ${APACHE_LOG_DIR}/netgescon_access.log combined
|
|
</VirtualHost>
|
|
|
|
# Per HTTPS (raccomandato)
|
|
<VirtualHost *:443>
|
|
ServerName tuodominio.com
|
|
DocumentRoot /var/www/netgescon-laravel/public
|
|
|
|
SSLEngine on
|
|
SSLCertificateFile /path/to/certificate.crt
|
|
SSLCertificateKeyFile /path/to/private.key
|
|
|
|
<Directory /var/www/netgescon-laravel/public>
|
|
AllowOverride All
|
|
Require all granted
|
|
</Directory>
|
|
|
|
ErrorLog ${APACHE_LOG_DIR}/netgescon_ssl_error.log
|
|
CustomLog ${APACHE_LOG_DIR}/netgescon_ssl_access.log combined
|
|
</VirtualHost>
|
|
```
|
|
|
|
```bash
|
|
# Attivare sito
|
|
sudo a2ensite netgescon.conf
|
|
sudo a2dissite 000-default
|
|
sudo systemctl reload apache2
|
|
```
|
|
|
|
### Step 8: Setup Cron Jobs
|
|
```bash
|
|
sudo crontab -e -u www-data
|
|
```
|
|
|
|
```cron
|
|
# NetGesCon - Laravel Scheduler
|
|
* * * * * cd /var/www/netgescon-laravel && php artisan schedule:run >> /dev/null 2>&1
|
|
|
|
# Backup automatico (ogni notte alle 2:00)
|
|
0 2 * * * cd /var/www/netgescon-laravel && php artisan netgescon:backup:auto
|
|
|
|
# Cleanup log e temp files (ogni domenica alle 3:00)
|
|
0 3 * * 0 cd /var/www/netgescon-laravel && php artisan netgescon:cleanup
|
|
```
|
|
|
|
## 🔐 Configurazione Sicurezza
|
|
|
|
### 1. Firewall (UFW)
|
|
```bash
|
|
sudo ufw enable
|
|
sudo ufw allow ssh
|
|
sudo ufw allow 'Apache Full'
|
|
sudo ufw status
|
|
```
|
|
|
|
### 2. SSL Certificate (Let's Encrypt)
|
|
```bash
|
|
sudo apt install certbot python3-certbot-apache -y
|
|
sudo certbot --apache -d tuodominio.com
|
|
```
|
|
|
|
### 3. Database Security
|
|
```bash
|
|
# Backup regolari
|
|
sudo crontab -e
|
|
# 0 1 * * * mysqldump -u netgescon -p netgescon_master > /var/www/netgescon-backup/db_$(date +\%Y\%m\%d).sql
|
|
|
|
# Configurare accesso limitato
|
|
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
|
|
# bind-address = 127.0.0.1
|
|
```
|
|
|
|
## 🎯 Primo Accesso
|
|
|
|
1. **Aprire browser**: `https://tuodominio.com`
|
|
2. **Login Super Admin**:
|
|
- Email: `superadmin@netgescon.local`
|
|
- Password: `SuperAdminNetGesCon2025!`
|
|
3. **Cambiare password** del super admin immediatamente
|
|
4. **Creare primo amministratore** per test
|
|
|
|
## 🔧 Manutenzione Sistema
|
|
|
|
### Aggiornamenti
|
|
```bash
|
|
cd /var/www/netgescon-laravel
|
|
git pull origin main
|
|
composer install --optimize-autoloader --no-dev
|
|
npm run production
|
|
php artisan migrate
|
|
php artisan config:cache
|
|
php artisan route:cache
|
|
php artisan view:cache
|
|
sudo systemctl reload apache2
|
|
```
|
|
|
|
### Backup
|
|
```bash
|
|
# Backup database
|
|
php artisan netgescon:backup:create
|
|
|
|
# Backup files
|
|
tar -czf netgescon_backup_$(date +%Y%m%d).tar.gz \
|
|
/var/www/netgescon-laravel \
|
|
/var/www/netgescon-data \
|
|
/var/www/netgescon-backup
|
|
```
|
|
|
|
### Monitoring
|
|
```bash
|
|
# Log Laravel
|
|
tail -f storage/logs/laravel.log
|
|
|
|
# Log Apache
|
|
sudo tail -f /var/log/apache2/netgescon_error.log
|
|
|
|
# Status servizi
|
|
sudo systemctl status apache2
|
|
sudo systemctl status mysql
|
|
sudo systemctl status redis-server
|
|
```
|
|
|
|
## 🐛 Troubleshooting
|
|
|
|
### 1. Errore Permessi
|
|
```bash
|
|
sudo chown -R www-data:www-data /var/www/netgescon-laravel
|
|
sudo chmod -R 775 storage bootstrap/cache
|
|
```
|
|
|
|
### 2. Database Connection Error
|
|
```bash
|
|
# Verificare servizio MySQL
|
|
sudo systemctl status mysql
|
|
sudo systemctl restart mysql
|
|
|
|
# Test connessione
|
|
mysql -u netgescon -p -e "SHOW DATABASES;"
|
|
```
|
|
|
|
### 3. Cache Issues
|
|
```bash
|
|
php artisan config:clear
|
|
php artisan cache:clear
|
|
php artisan route:clear
|
|
php artisan view:clear
|
|
```
|
|
|
|
### 4. Asset Issues
|
|
```bash
|
|
npm run development
|
|
# o
|
|
npm run production
|
|
```
|
|
|
|
## 📞 Supporto
|
|
|
|
- **Documentazione**: `README.md` e `TECHNICAL_SPECS.md`
|
|
- **Log Progressivo**: `PROGRESS_LOG.md`
|
|
- **Issues GitHub**: [Repository Issues]
|
|
- **Email**: supporto@netgescon.com
|
|
|
|
---
|
|
|
|
*Ultima modifica: 7 Luglio 2025*
|