Update Debian local installation instructions

So now we install a specific version of Node.js and use the packages
required for Debian Bookworm.

For consistency, we're also making them similar to the Ubuntu
instructions and installing rbenv instead of RVM. Since we now suggest
rbenv in both cases as well as in the macOS instructions, we're also
listing rbenv as the first option in the generic local installation
instructions.
This commit is contained in:
Javi Martín
2024-08-06 15:30:20 +02:00
parent 7845c7f78d
commit b686489652
4 changed files with 77 additions and 195 deletions

View File

@@ -1,24 +1,31 @@
# Configuration for development and test environments (Debian GNU/Linux 9.8)
# Configuration for development and test environments (Debian GNU/Linux 12 - Bookworm)
## Superuser
Note that 'sudo' is not installed by default in Debian. It's possible to install and configure it, you can find information [here](https://wiki.debian.org/sudo). But we don't recommend it cause you may have other problems. We recommend running the following commands as a superuser, so make sure the very first command you run is:
By default, in Debian no user can use `sudo` if a password for the root user was provided during the installation.
So, in order to install the project dependencies, we've got two options. The first option is opening a root shell. Run:
```bash
su
```
> For [Vagrant](/en/installation/vagrant.md) run:
> ```
> sudo su -
> ```
You'll be asked to introduce the password for the root user.
The second option is adding a regular user to the `sudo` group. For that, after opening a root shell, run:
```bash
gpasswd -a <your_username> sudo
```
You'll have to log out and log in again for these changes to take effect.
## System update
Run a general system update:
```bash
apt-get update
sudo apt update
```
## Git
@@ -26,103 +33,55 @@ apt-get update
Git is officially maintained in Debian:
```bash
apt-get install git
```
## Curl
Curl is officially maintained in Debian:
```bash
apt-get install curl
sudo apt install git
```
## Ruby version manager
Ruby versions packaged in official repositories are not suitable to work with Consul Democracy, so we'll have to install it manually.
One possible tool is rvm:
### As a local user
First, we need to install Ruby's development dependencies:
```bash
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
curl -L https://get.rvm.io | bash -s stable
sudo apt install libssl-dev autoconf bison build-essential libyaml-dev libreadline-dev zlib1g-dev libncurses-dev libffi-dev libgdbm-dev
```
then add rvm script source to user's bash (~/.bashrc) (this step is only necessary if you can't execute the rvm command)
```bash
[[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm
```
and finally, reload .bashrc to be able to run RVM
The next step is installing a Ruby version manager, like rbenv:
```bash
wget -qO- https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer | bash
source ~/.bashrc
```
## Node.js
## CMake and pkg-config
To compile the assets, you'll need a JavaScript runtime. Node.js is the preferred option. As with Ruby, we don't recommend installing Node from your distro's repositories.
To install it, you can use [n](https://github.com/tj/n)
Run the following command on your terminal:
In order to compile some of the project dependencies, we need CMake and pkg-config:
```bash
curl -L https://git.io/n-install | bash -s -- -y lts
sudo apt install cmake pkg-config
```
And it will install the latest LTS (Long Term Support) Node version on your `$HOME` folder automatically (This makes use of [n-install](https://github.com/mklement0/n-install))
## Node.js version manager
Reload .bashrc to be able to run node
To compile the assets, you'll need a JavaScript runtime. Node.js is the preferred option. To install Node.js, we will install a Node.js version manager, like NVM:
```bash
source /root/.bashrc
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
```
Check it's correctly installed by running:
## PostgreSQL
Install postgresql and its development dependencies with:
```bash
node -v
```
## PostgreSQL (>=9.4)
PostgreSQL version 9.4 is not official in debian 9.
So you have to add a repository, the official postgresql works fine.
Add the repository to apt, for example creating file */etc/apt/sources.list.d/pgdg.list* with:
```text
deb http://security.debian.org/debian-security jessie/updates main
```
afterwards you'll have to download the key, and install it, by:
```bash
wget https://www.postgresql.org/media/keys/ACCC4CF8.asc
apt-key add ACCC4CF8.asc
```
and install postgresql
```bash
apt-get update
apt-get install postgresql-9.4 postgresql-server-dev-9.4 postgresql-contrib-9.4
sudo apt install postgresql libpq-dev
```
You also need to configure a user for your database. As an example, we'll choose the username "consul":
```bash
su - postgres
createuser consul --createdb --superuser --pwprompt
exit
sudo -u postgres createuser consul --createdb --superuser --pwprompt
```
## Imagemagick
@@ -130,34 +89,15 @@ exit
Install Imagemagick:
```bash
apt-get install imagemagick
sudo apt install imagemagick
```
## ChromeDriver
## Chrome or Chromium
To run E2E integration tests, we use Selenium along with Headless Chrome.
To get it working, install the chromedriver package:
In order to run the system tests, we need to install Chrome or Chromium.
```bash
apt-get install chromedriver
ln -s /usr/lib/chromedriver /usr/local/bin/
sudo apt install chromium
```
Make sure it's working as expected by running the following command:
```bash
chromedriver --version
```
You should receive an output with the latest version of ChromeDriver. If that's the case, you're good to go!
If you are using an Arch-based distro, installing `chromium` from the `extra` repository should be sufficient.
You also have the option of just installing ChromeDriver from AUR. If you use `pacaur`, run the following command:
```bash
pacaur -S chromedriver
```
Now you're ready to go get Consul Democracy [installed](local_installation.md)!!
Now you're ready to go [get Consul Democracy installed](local_installation.md)!

View File

@@ -12,8 +12,8 @@ cd consuldemocracy
2. Install the Ruby version we need with your Ruby version manager. Here are some examples:
```bash
rvm install `cat .ruby-version` # If you're using RVM
rbenv install `cat .ruby-version` # If you're using rbenv
rvm install `cat .ruby-version` # If you're using RVM
asdf install ruby `cat .ruby-version` # If you're using asdf
```

View File

@@ -1,24 +1,31 @@
# Configuración para los entornos de desarrollo y pruebas (Debian GNU/Linux 9.8)
# Configuración para los entornos de desarrollo y pruebas (Debian GNU/Linux 12 - Bookworm)
## Superusuario
El programa 'sudo' no viene instalado en Debian por defecto. Su instalación y configuración es posible, se puede encontrar información al respecto [aquí](https://wiki.debian.org/es/sudo). Pero no lo recomendamos porque puede causar otros problemas. Recomendamos que se ejecuten las siguientes instrucciones como un super usuario, así que asegúrate de que la primera instrucción que ejecutes sea:
Por defecto, en Debian ningún usuario puede utilizar `sudo` si se ha proporcionado una contraseña para el usuario root durante la instalación.
Por tanto, para instalar las dependencias del proyecto, tendremos dos opciones. La primera opción es abrir un terminal de superusuario. En un terminal, ejecuta:
```bash
su
```
> Para [Vagrant](/es/installation/vagrant.md) ejecutar:
> ```
> sudo su -
> ```
Te pedirá introducir la contraseña del usuario root.
La segunda opción es añadir un usuario regular al grupo `sudo`. Para ello, tras abrir un terminal de superusuario, ejecuta:
```bash
gpasswd -a <your_username> sudo
```
Tendrás que cerrar sesión y volverla abrir para que los cambios tengan efecto.
## Actualización de sistema
Ejecuta una actualización general de las librerías de sistema:
```bash
apt-get update
sudo apt update
```
## Git
@@ -26,101 +33,55 @@ apt-get update
Git es mantenido oficialmente en Debian:
```bash
apt-get install git
```
## Curl
Curl es mantenido oficialmente en Debian:
```bash
apt-get install curl
sudo apt install git
```
## Gestor de versiones de Ruby
Las versiones de Ruby empaquetadas en repositorios oficiales no son aptas para trabajar con Consul Democracy, así que debemos instalar manualmente.
Las versiones de Ruby empaquetadas en repositorios oficiales no son aptas para trabajar con Consul Democracy, así que debemos instalarlo manualmente.
Una opción es utilizar rvm:
### Como usuario local
En primer lugar, necesitamos los siguiente paquetes para poder instalar Ruby:
```bash
command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
curl -L https://get.rvm.io | bash -s stable
sudo apt install libssl-dev autoconf bison build-essential libyaml-dev libreadline-dev zlib1g-dev libncurses-dev libffi-dev libgdbm-dev
```
después añadimos el script rvm a nuestro bash (~/.bashrc) (este paso sólo es necesario si no puedes ejecutar el comando rvm)
```bash
[[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm
```
por úlitmo, volvemos a cargar el .bashrc para poder ejecutar RVM
A continuación instalaremos un gestor de versiones de Ruby, como rbenv:
```bash
wget -qO- https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-installer | bash
source ~/.bashrc
```
## Node.js
## CMake y pkg-config
Para compilar los archivos estáticos (JS, CSS, imágenes, etc.), es necesario un _runtime_ de JavaScript. Node.js es la opción recomendada. Al igual que como ocurre con Ruby, no es recomendable instalar Node directamente de los repositorios de tu distribución Linux.
Para instalar Node, puedes usar [n](https://github.com/tj/n)
Ejecuta el siguiente comando en tu terminal:
Para compilar algunas de las dependencias del proyecto, necesitamos CMake y pkg-config:
```bash
curl -L https://git.io/n-install | bash -s -- -y lts
sudo apt install cmake pkg-config
```
Y este instalará automáticamente la versión LTS (_Long Term Support_, inglés para "Soporte a largo plazo") más reciente de Node en tu directorio `$HOME` (Este comando hace uso de [n-install](https://github.com/mklement0/n-install))
## Gestor de versiones de Node.js
vuelve a cargar el .bashrc para poder ejecutar node
Para compilar los archivos estáticos (JS, CSS, imágenes, etc.), es necesario un _runtime_ de JavaScript. Node.js es la opción recomendada. Para instalar Node.js, instalaremos un gestor de versiones de Node.js, como NVM:
```bash
source /root/.bashrc
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
```
Comprueba que está correctamente instalado ejecutando:
## PostgreSQL
Instala postgresql y sus dependencias de desarrollo con:
```bash
node -v
sudo apt install postgresql libpq-dev
```
## PostgreSQL (>=9.4)
La versión 9.4 de PostgreSQL no es oficial en Debian 9.
Así que debemos añadir el respositorio oficial de postgresql a apt, por ejemplo creando el fichero */etc/apt/sources.list.d/pgdg.list* con:
```text
deb http://security.debian.org/debian-security jessie/updates main
```
después deberás descargar la key e instalarla:
Para el correcto funcionamiento de Consul Democracy, necesitas configurar un usuario para tu base de datos. Como ejemplo, crearemos un usuario llamado "consul":
```bash
wget https://www.postgresql.org/media/keys/ACCC4CF8.asc
apt-key add ACCC4CF8.asc
```
y finalmente instalar postgresql
```bash
apt-get update
apt-get install postgresql-9.4 postgresql-server-dev-9.4 postgresql-contrib-9.4
```
Para el correcto funcionamiento de Consul Democracy, necesitas confgurar un usuario para tu base de datos. Como ejemplo, crearemos un usuario llamado "consul":
```bash
su - postgres
createuser consul --createdb --superuser --pwprompt
exit
sudo -u postgres createuser consul --createdb --superuser --pwprompt
```
## Imagemagick
@@ -128,34 +89,15 @@ exit
Instala Imagemagick:
```bash
apt-get install imagemagick
sudo apt install imagemagick
```
## ChromeDriver
## Chrome o Chromium
Para realizar pruebas de integración, usamos Selenium junto a Headless Chrome.
Para ello, primero instala el siguiente paquete:
Para poder ejecutar los tests de sistema, necesitaremos tener instalado Chrome o Chromium.
```bash
apt-get install chromedriver
ln -s /usr/lib/chromedriver /usr/local/bin/
sudo apt install chromium
```
Asegúrate de que todo funciona como es debido ejecutando el siguiente comando:
```bash
chromedriver --version
```
Deberías recibir un mensaje indicando la última versión de ChromeDriver. Si ese es el caso, está todo listo
Si te encuentras usando una distro basada en Arch, instalando `chromium` desde el repositorio `extra` debería ser suficiente
También tienes la opción de solo instalar ChromeDriver desde AUR. Si usas `pacaur`, ejecuta el siguiente comando:
```bash
pacaur -S chromedriver
```
Ya estás listo para [instalar Consul Democracy](local_installation.md)!!
¡Ya estás listo para [instalar Consul Democracy](local_installation.md)!

View File

@@ -12,8 +12,8 @@ cd consuldemocracy
2. Instala la versión de Ruby necesaria con el gestor de versiones de tu elección. Algunos ejemplos:
```bash
rvm install `cat .ruby-version` # Si usas RVM
rbenv install `cat .ruby-version` # Si usas rbenv
rvm install `cat .ruby-version` # Si usas RVM
asdf install ruby `cat .ruby-version` # Si usas asdf
```