Come installare Neos CMS su Ubuntu 22.04
Questo tutorial esiste per queste versioni del sistema operativo
- Ubuntu 22.04 (Jammy Jellyfish)
- Ubuntu 18.04 (Bionic Beaver)
Su questa pagina
- Prerequisiti
- Per iniziare
- Installa Apache, MariaDB e PHP
- Crea un database per Neos CMS
- Installa Neos CMS
- Configura Apache per Neos CMS
- Accedi a Neos CMS
- Proteggi Neos CMS con Lets Encrypt
- Conclusione
Neos CMS è un sistema di gestione dei contenuti gratuito, open source e innovativo che ti aiuta a gestire siti Web e blog senza alcuna conoscenza di codifica. È semplice, sicuro e progettato per la facilità d'uso che aiuta gli imprenditori a collaborare con gli utenti su più dispositivi. Offre funzionalità molto utili, tra cui il supporto Unicode completo, l'internazionalizzazione completa, la SEO, l'editing in linea e altro ancora. L'idea alla base del progetto è consentire agli editor di modificare i contenuti nel modo più fluido possibile pur mantenendone la struttura.
In questo tutorial, ti mostreremo come installare Neos CMS con Apache e Lets Encrypt SSL su server Ubuntu 22.04.
Prerequisiti
- Un server che esegue Ubuntu 22.04.
- Un nome di dominio valido viene indicato con l'IP del tuo server.
- Sul server è configurata una password di root.
Iniziare
Innanzitutto, esegui i seguenti comandi per aggiornare tutti i tuoi pacchetti di sistema alle versioni aggiornate:
apt update -y
apt upgrade -y
Una volta terminato, puoi procedere al passaggio successivo.
Installa Apache, MariaDB e PHP
Successivamente, dovrai installare Apache, MariaDB, PHP e altri pacchetti richiesti sul tuo sistema. Esegui il seguente comando per installarli tutti:
apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-mysql php-gmp php-curl php-intl php-mbstring php-xmlrpc php-gd php-bcmath php-xml php-cli php-gmagick php-zip curl unzip git -y
Dopo aver installato tutti i pacchetti, modifica il file php.ini e apporta alcune modifiche:
nano /etc/php/8.1/apache2/php.ini
Modifica le seguenti righe:
short_open_tag = On memory_limit = 256M upload_max_filesize = 150M max_execution_time = 360 date.timezone = UTC
Salva e chiudi il file, quindi riavvia il servizio Apache per applicare le modifiche:
systemctl restart apache2
Crea un database per Neos CMS
Innanzitutto, dovrai impostare una password di root MariaDB e proteggere l'installazione. Puoi farlo usando il seguente comando:
mysql_secure_installation
Rispondi a tutte le domande come mostrato di seguito:
Enter current password for root (enter for none): Set root password? [Y/n]: N Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Al termine, accedi a MariaDB con il seguente comando:
mysql -u root -p
Una volta effettuato l'accesso, crea un database e un utente per Neos CMS utilizzando il seguente comando:
MariaDB [(none)]> CREATE DATABASE neosdb;
MariaDB [(none)]> CREATE USER 'neos'@'localhost' IDENTIFIED BY 'mypassword';
Quindi, concedi tutti i privilegi al database Neos con il seguente comando:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON neosdb.* TO 'neos'@'localhost' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
Quindi, modifica il set di caratteri del database in utf8mb4, cancella i privilegi ed esci da MariaDB con il seguente comando:
MariaDB [(none)]> ALTER DATABASE neosdb charset=utf8mb4;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
Successivamente, modifica il file di configurazione di MariaDB e apporta alcune modifiche:
nano /etc/mysql/mariadb.conf.d/50-server.cnf
Aggiungi le seguenti righe:
innodb_file_format = Barracuda innodb_large_prefix = 1 innodb_file_per_table = 1 innodb_default_row_format = dynamic
Salva e chiudi il file, quindi riavvia il servizio MariaDB per applicare le modifiche:
systemctl restart mariadb
Una volta terminato, puoi procedere al passaggio successivo.
Installa Neos CMS
Prima di iniziare, dovrai installare Composer sul tuo sistema. Composer è un gestore delle dipendenze utilizzato per l'installazione delle dipendenze PHP.
Eseguire il seguente comando per installare Composer:
curl -sS https://getcomposer.org/installer | php
Dovresti ottenere il seguente output:
All settings correct for using Composer Downloading... Composer (version 2.4.1) successfully installed to: /root/composer.phar Use it: php composer.phar
Successivamente, sposta il file Composer nella posizione di sistema:
mv composer.phar /usr/local/bin/composer
Quindi, cambia la directory nella root web di Apache e scarica Neos CMS con il seguente comando:
cd /var/www/html/
git clone https://github.com/neos/neos-base-distribution.git
Successivamente, rinomina la directory scaricata ed esegui il comando composer per installare tutte le dipendenze PHP:
mv neos-base-distribution neoscms
cd neoscms
composer install
Quindi, imposta l'autorizzazione e la proprietà appropriate per la directory Neos:
chown -R www-data:www-data /var/www/html/neoscms/
chmod -R 755 /var/www/html/neoscms/
Una volta terminato, puoi procedere al passaggio successivo.
Configura Apache per Neos CMS
Successivamente, dovrai creare un file di configurazione dell'host virtuale Apache per ospitare Neos CMS. Puoi crearlo con il seguente comando:
nano /etc/apache2/sites-available/neoscms.conf
Aggiungi le seguenti righe:
<VirtualHost *:80> ServerAdmin DocumentRoot /var/www/html/neoscms/Web ServerName neos.example.com <Directory /var/www/html/neoscms/Web/> Options FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog ${APACHE_LOG_DIR}/neos_error.log CustomLog ${APACHE_LOG_DIR}/neos_access.log combined <Directory /var/www/html/neoscms/Web/> RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*) index.php [PT,L] </Directory> </VirtualHost>
Salvare e chiudere il file, quindi attivare l'host virtuale e abilitare il modulo di riscrittura Apache con il seguente comando:
a2ensite neoscms.conf
a2enmod rewrite
Successivamente, riavvia il servizio Apache per applicare le modifiche:
systemctl restart apache2
Puoi anche controllare lo stato del servizio Apache con il seguente comando:
systemctl status apache2
Dovresti ottenere il seguente output:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2022-09-04 08:07:38 UTC; 8s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 22571 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 22577 (apache2) Tasks: 6 (limit: 4579) Memory: 14.7M CPU: 128ms CGroup: /system.slice/apache2.service ??22577 /usr/sbin/apache2 -k start ??22578 /usr/sbin/apache2 -k start ??22579 /usr/sbin/apache2 -k start ??22580 /usr/sbin/apache2 -k start ??22581 /usr/sbin/apache2 -k start ??22582 /usr/sbin/apache2 -k start Sep 04 08:07:38 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...
A questo punto, il web server Apache è configurato per servire Neos CMS. Ora puoi procedere al passaggio successivo.
Accedi a Neos CMS
Ora apri il tuo browser web e accedi a Neos CMS utilizzando l'URL http://neos.example.com. Verrai reindirizzato alla seguente pagina:
Fare clic su Vai alla configurazione. Dovresti vedere la seguente pagina:
Fornire la password di configurazione dal file SetupPassword.txt e fare clic sul pulsante Accedi. Dovresti vedere la seguente pagina:
Assicurati che tutte le estensioni PHP richieste siano installate, quindi fai clic sul pulsante Avanti. Dovresti vedere la seguente pagina:
Fornire il nome del database, il nome utente del database, l'host del database, la password e fare clic sul pulsante Avanti. Dovresti vedere la seguente pagina:
Fornisci il tuo nome, nome utente amministratore, password e fai clic sul pulsante Avanti. Dovresti vedere la seguente pagina:
Fai clic su Vai al back-end. Dovresti vedere la pagina di accesso di Neos CMS:
Fornisci il nome utente e la password dell'amministratore e fai clic sul pulsante Accedi. Dovresti vedere la dashboard di Neos CMS nella pagina seguente:
Proteggi Neos CMS con Lets Encrypt
È una buona idea proteggere il tuo sito web con Lets Encrypt Free SSL. Innanzitutto, installa il client Certbot per installare e gestire SSL. Puoi installarlo con il seguente comando:
apt-get install python3-certbot-apache -y
Una volta installato, esegui il seguente comando per proteggere il tuo sito web con Lets Encrypt SSL:
certbot --apache -d neos.example.com
Ti verrà chiesto di fornire la tua email e di accettare i termini di servizio come mostrato di seguito:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer None Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Plugins selected: Authenticator apache, Installer apache Obtaining a new certificate Performing the following challenges: http-01 challenge for neos.example.com Enabled Apache rewrite module Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/neos-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/neos-le-ssl.conf Enabling available site: /etc/apache2/sites-available/neos-le-ssl.conf
Successivamente, seleziona se reindirizzare o meno il traffico HTTP su HTTPS come mostrato di seguito:
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Digita 2 e premi Invio per installare Lets Encrypt SSL per il tuo sito web:
Enabled Apache rewrite module Redirecting vhost in /etc/apache2/sites-enabled/neos.conf to ssl vhost in /etc/apache2/sites-available/neos-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://neos.example.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=neos.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/neos.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/neos.example.com/privkey.pem Your cert will expire on 2022-12-07. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Conclusione
Congratulazioni! hai installato con successo Neos CMS con Apache e Lets Encrypt SSL sul server Ubuntu 22.04. Ora puoi facilmente creare e modificare il tuo sito web tramite il browser web. Non esitate a chiedermi se avete domande.