Cómo instalar Fork CMS en Ubuntu 20.04

Fork es un sistema de gestión de contenidos sencillo, ligero y fácil de usar. Está basado en Symfony y proporciona una interfaz web fácil de usar para gestionar todo tu contenido a través del navegador web. También ofrece potentes aplicaciones y temas que te permiten personalizar tu sitio web con más brillo. Tiene un mercado funcional con montones de apps y también ofrece potentes herramientas tanto para principiantes como para profesionales.

En este post, explicaremos cómo instalar Fork CMS con Apache y Let’s Encrypt SSL en Ubuntu 20.04.

Requisitos previos

  • Un servidor con Ubuntu 20.04.
  • Un nombre de dominio válido apuntado con la IP de tu servidor.
  • Una contraseña de root configurada en el servidor.

Instalar la pila LAMP

En primer lugar, tendrás que instalar el servidor web Apache, el servidor de bases de datos MariaDB, PHP y otras extensiones PHP necesarias en tu servidor. Puedes instalarlos todos ejecutando el siguiente comando:

apt-get install apache2 mariadb-server php libapache2-mod-php php-json php-xml php-cli php-zip php-common php-sqlite3 php-curl php-intl php-mbstring php-xmlrpc php-mysql php-gd wget unzip -y

Después de instalar todos esos paquetes, edita el archivo de configuración de PHP:

nano /etc/php/7.4/apache2/php.ini

Cambia los siguientes ajustes según tus necesidades:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
file_uploads = On
date.timezone = Asia/Kolkata

Guarda y cierra el archivo, luego reinicia el servicio Apache para aplicar los cambios de configuración:

systemctl restart apache2

Configurar la base de datos MariaDB

En primer lugar, debes asegurar MariaDB y establecer la contraseña raíz de MariaDB. Puedes ejecutar el siguiente script para asegurar la instalación de MariaDB:

mysql_secure_installation

Este script establecerá una contraseña de root, eliminará los usuarios anónimos, no permitirá el inicio de sesión de root de forma remota y eliminará la base de datos de prueba, como se muestra a continuación:

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
Once MariaDB is secured, log in to MariaDB shell:

A continuación, accede al shell de MariaDB con el siguiente comando:

mysql -u root -p

Introduce la contraseña de root y crea una base de datos y un usuario para Fork CMS:

MariaDB [(none)]> CREATE DATABASE forkcmsdb;
MariaDB [(none)]> CREATE USER 'forkcms'@'localhost' IDENTIFIED BY 'password';

A continuación, concede privilegios a la base de datos Fork CMS con el siguiente comando:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON forkcmsdb.* TO 'forkcms'@'localhost';

A continuación, ejecuta el comando FLUSH PRIVILEGES para que MariaDB recargue la tabla de privilegios:

MariaDB [(none)]> FLUSH PRIVILEGES;

Por último, sal del intérprete de comandos de MariaDB con el siguiente comando:

MariaDB [(none)]> EXIT;

Instalar Fork CMS

En primer lugar, tendrás que instalar el Compositor en tu sistema. Puedes instalarlo con el siguiente comando:

curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

Obtendrás la siguiente salida:

All settings correct for using Composer
Downloading...

Composer (version 2.3.3) successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

A continuación, navega hasta el directorio raíz de la web Apache y descarga el Fork CMS utilizando el Composer:

cd /var/www/html/
composer create-project forkcms/forkcms

Una vez finalizada la descarga, establece el permiso y la propiedad adecuados para el directorio FOrk CMS:

chown -R www-data:www-data /var/www/html/forkcms
chmod -R 775 /var/www/html/forkcms

Cuando hayas terminado, puedes pasar al siguiente paso.

Configurar Apache para Fork CMS

A continuación, tendrás que crear un archivo de configuración de host virtual Apache para servir Fork CMS a través de Internet. Puedes crearlo con el siguiente comando:

nano /etc/apache2/sites-available/forkcms.conf

Añade las siguientes líneas:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/forkcms
     ServerName forkcms.example.com
     ServerAlias www.example.com

     <Directory /var/www/html/forkcms/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Guarda y cierra el archivo y, a continuación, activa el Fork CMS y habilita el módulo de reescritura de Apache con el siguiente comando:

a2ensite forkcms.conf
a2enmod rewrite

A continuación, reinicia el servicio Apache para aplicar los cambios:

systemctl restart apache2

También puedes comprobar el estado del servicio Apache con el siguiente comando:

systemctl status apache2

Obtendrás la siguiente salida:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-04-02 08:04:06 UTC; 13s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 15441 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 15460 (apache2)
      Tasks: 6 (limit: 2348)
     Memory: 13.4M
     CGroup: /system.slice/apache2.service
             ??15460 /usr/sbin/apache2 -k start
             ??15461 /usr/sbin/apache2 -k start
             ??15462 /usr/sbin/apache2 -k start
             ??15463 /usr/sbin/apache2 -k start
             ??15464 /usr/sbin/apache2 -k start
             ??15465 /usr/sbin/apache2 -k start

Apr 02 08:04:06 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...

Una vez que hayas terminado, puedes continuar con el siguiente paso.

Accede a la Interfaz Web de Fork CMS

Ahora, abre tu navegador web y escribe la URL http://forkcms.example.com. Serás redirigido a la siguiente página:

Aquí, selecciona el idioma que desees y haz clic en el botón Siguiente. Deberías ver la siguiente página:

Selecciona el módulo que deseas instalar y pulsa el botón Siguiente. Deberías ver la página siguiente:

Proporciona los datos de tu base de datos y pulsa el botón Siguiente. Deberías ver la siguiente página:

Aquí, proporciona tu dirección de correo electrónico, nombre de usuario y contraseña de administrador, luego haz clic en el botón Finalizar la instalación. Deberías ver la siguiente página:

Ahora, haz clic en el botón Iniciar sesión en Fork CMS. Deberías ver la pantalla de inicio de sesión en Fork CMS en la siguiente página:

Ahora, proporciona tu nombre de usuario y contraseña de administrador, y haz clic en el botón Iniciar sesión. Serás redirigido al panel de control de Fork CMS como se muestra en la siguiente imagen:

Asegura Fork CMS con Let’s Encrypt SSL

A continuación, se recomienda asegurar tu sitio web con Let’s Encrypt SSL. En primer lugar, instala el cliente Certbot utilizando el siguiente comando:

apt-get install python3-certbot-apache -y

Una vez instalado, ejecuta el siguiente comando para asegurar tu sitio web con Let’s Encrypt SSL:

certbot --apache -d forkcms.example.com

Se te pedirá que proporciones tu correo electrónico y aceptes las condiciones del servicio, como se muestra a continuación:

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): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 forkcms.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/forkcms-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/forkcms-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/forkcms-le-ssl.conf

A continuación, selecciona si deseas o no redirigir el tráfico HTTP a HTTPS, como se muestra a continuación:

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

Escribe 2 y pulsa Intro para instalar Let’s Encrypt SSL en tu sitio web:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/forkcms.conf to ssl vhost in /etc/apache2/sites-available/forkcms-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://forkcms.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=forkcms.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/forkcms.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/forkcms.example.com/privkey.pem
   Your cert will expire on 2022-07-23. 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

Conclusión

Enhorabuena! has instalado con éxito Fork CMS con Apache y Let’s Encrypt SSL en el servidor Ubuntu 20.04. Ahora puedes explorar Fork CMS y empezar a crear tu propio sitio web desde la intuitiva interfaz web de Fork CMS.

Scroll al inicio