GNU/Linux >> Linux Esercitazione >  >> Debian

Come installare Apache CouchDB su Debian 9

In questo articolo, ti mostreremo come installare Apache CouchDB su un VPS Debian 9.

Apache CouchDB è una soluzione di database orientata ai documenti NoSQL gratuita e open source che utilizza JSON per archiviare i dati. CouchDB è comunemente usato nei dispositivi mobili di replica e sincronizzazione in quanto non blocca i file di database al momento della scrittura. CouchDB viene fornito con una console di amministrazione basata sul Web di facile gestione e supporta backup a caldo banali, un motore tollerante ai guasti, la protezione dei dati degli utenti e molto altro. Iniziamo con l'installazione.

Fase 1:accedi tramite SSH e aggiorna il sistema

Accedi al tuo VPS Debian 9 tramite SSH come utente root (o come utente con privilegi sudo):

ssh root@Server_IP_Address -p Port_Number

ovviamente, dovrai sostituire Server_IP_Address e Port_Number con l'indirizzo IP del tuo server effettivo e il numero di porta SSH.

Eseguendo il comando seguente, tutti i pacchetti attualmente installati sul tuo sistema verranno aggiornati e aggiornati alle ultime versioni disponibili:

apt update && apt upgrade -y

Fase 2:installa un server Web

Innanzitutto, è necessario installare un server Web per eseguire CouchDB. Puoi scegliere qualsiasi server web disponibile per Debian 9 e quindi installarlo sul tuo server, tuttavia, in questo tutorial useremo e installeremo Nginx come nostro server web. Eseguendo il comando seguente, puoi installare il server Web Nginx sul tuo VPS.

apt install nginx

Al termine dell'installazione, puoi avviare Nginx e anche consentirne l'avvio all'avvio del server con questi comandi.

systemctl start nginx
systemctl enable nginx

Ora installeremo anche diverse dipendenze necessarie per installare CouchDB correttamente e con successo.

apt-get install apt-transport-https curl -y

Fase 3:scarica/abilita il repository CouchDB

Sfortunatamente, CouchDB non è disponibile nei repository preinstallati che si trovano in Debian 9. Aggiungeremo invece il repository ufficiale di Apache CouchDB con il seguente comando:

echo "deb https://apache.bintray.com/couchdb-deb stretch main" \
| sudo tee -a /etc/apt/sources.list

Fatto ciò, possiamo quindi aggiungere la chiave del repository con il seguente comando:

curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc \
| sudo apt-key add -

Ora possiamo installare CouchDB usando il nostro repository appena installato.

Fase 4:installa CouchDB

Poiché abbiamo abilitato il repository CouchDB nel passaggio precedente, ora dobbiamo aggiornare la cache del repository e installare il pacchetto Apache CouchDB:

apt-get update && apt-get install couchdb

Durante l'installazione, ti verrà chiesto quale tipo di installazione preferisci:standalone o in cluster:

 
 ┌──────────────────────────┤ Configuring couchdb ├──────────────────────────┐
 │                                                                           │ 
 │ Please select the CouchDB server configuration type that best meets your  │  
 │ needs.                                                                    │  
 │                                                                           │  
 │ For single-server configurations, select standalone mode. This will set   │  
 │ up CouchDB to run as a single server.                                     │  
 │                                                                           │  
 │ For clustered configuration, select clustered mode. This will prompt for  │  
 │ additional parameters required to configure CouchDB in a clustered        │  
 │ configuration.                                                            │  
 │                                                                           │  
 │ If you prefer to configure CouchDB yourself, select none. You will then   │  
 │ need to edit /opt/couchdb/etc/vm.args and /opt/couchdb/etc/local.d/*.ini  │  
 │ yourself. Be aware that this will bypass *all* configuration steps,       │  
 │ including setup of a CouchDB admin user - leaving CouchDB in "admin       │  
 │                                                                           │  
 │                  General type of CouchDB configuration:                   │ 
 │                                                                           │ 
 │                                standalone                                 │ 
 │                                clustered                                  │ 
 │                                none                                       │ 
 │                                                                           │ 
 │                                 <Ok>                                      │
 |                                                                           |
 └───────────────────────────────────────────────────────────────────────────┘  

Sceglieremo il tipo autonomo per questo tutorial. Tieni presente che potresti dover scegliere "in cluster", a seconda del tuo caso d'uso specifico. Nella maggior parte dei casi, è necessaria solo una versione "autonoma" di CouchDB. Selezionalo e premi il tasto [Invio] per continuare. Successivamente, ti verrà chiesto di scegliere un indirizzo di collegamento dell'interfaccia. Selezioneremo l'opzione di installazione predefinita.

  
  ┌─────────────────────────┤ Configuring couchdb ├──────────────────────────┐
  │ A CouchDB node must bind to a specific network interface. This is done   │ 
  │ via IP address. Only a single address is supported at this time.         │ 
  │                                                                          │ 
  │ The special value '0.0.0.0' binds CouchDB to all network interfaces.     │ 
  │                                                                          │ 
  │ The default is 127.0.0.1 (loopback) for standalone nodes, and 0.0.0.0    │ 
  │ (all interfaces) for clustered nodes. In clustered mode, it is not       │ 
  │ allowed to bind to 127.0.0.1.                                            │ 
  │                                                                          │ 
  │ CouchDB interface bind address:                                          │ 
  │                                                                          │ 
  │ 127.0.0.1_______________________________________________________________ │ 
  │                                                                          │ 
  │                                 <Ok>                                     │ 
  │                                                                          │ 
  └──────────────────────────────────────────────────────────────────────────┘ 

Ora dovremo scegliere una nuova password per l'utente amministratore di CouchDB:

   ┌─────────────────────┤ Configuring couchdb ├────────────────────────┐
   │ It is highly recommended that you create a CouchDB admin user,     │
   ││
   │ which takes CouchDB out of the insecure "admin party" mode. │
   ││
   │ Entering a password here will take care of this step for you.      │
   │                                                                    │                     
   │ If this field is left blank, an admin user will not be created.    │                   
   │                                                                    │                      
   │ A pre-existing admin user will not be overwritten by this package. │                     
   │                                                                    │                  
   │ Password for the CouchDB "admin" user:                             │                
   │                                                                    │                
   │ *************_____________________________________________________ │
   │                                                                    │                
   │                              <Ok>                                  │            
   │                                                                    │                
   └────────────────────────────────────────────────────────────────────┘

Reinserire la password ancora una volta:

    ┌────────────┤ Configuring couchdb ├─────────────┐
    │                                                │
    │                                                │
    │ Repeat password for the CouchDB "admin" user:  │
    │                                                │
    │ ************__________________________________ │
    │                                                │
    │                     <Ok>                       │
    │                                                │
    └────────────────────────────────────────────────┘

Una volta terminata l'installazione, avvieremo la nostra nuova istanza CouchDB e ne consentiremo l'avvio all'avvio:

systemctl start couchdb
systemctl enable couchdb

Fase 5:configurazione di Nginx

Per accedere ad Apache CouchDB sul tuo browser con un dominio o sottodominio, dovrai creare un file di configurazione Nginx con un proxy inverso. Useremo nano come editor di testo e creeremo il file di configurazione di CouchDB:

nano /etc/nginx/sites-available/couchdb.conf

Inserisci la seguente configurazione nel nuovo file couchdb.conf. Ricordati di cambiare nome-dominio.com con il tuo dominio attuale.

server {
    listen 80;
        server_name  domain-name.com;

        server_name_in_redirect off;
        proxy_set_header Host $host:$server_port;

location / {
        proxy_pass  http://127.0.0.1:5984;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

}

Al termine della modifica, salva e chiudi il file. Per abilitare questa configurazione, esegui il comando seguente:

ln -s /etc/nginx/sites-available/couchdb.conf /etc/nginx/sites-enabled/

Puoi testare la sintassi corretta del file di configurazione di Nginx con il comando:

nginx -t

o

service nginx configtest

Se il test ha esito positivo, riavvia il server web per includere le modifiche apportate.

systemctl restart nginx

Fase 6:accedi all'interfaccia Web di CouchDB

Se hai seguito attentamente i passaggi precedenti, dovresti essere in grado di accedere a http://domain-name.com/_utils/ Interfaccia basata sul Web di CouchDB denominata "Fauxton" nel tuo browser Web preferito.

Per accedere alla tua istanza CouchDB puoi utilizzare le credenziali che hai definito durante l'installazione. Questo è tutto! Ora hai configurato un server CouchDB completamente funzionante.

Ovviamente, non devi installare CouchDB su Debian 9 se utilizzi uno dei nostri piani di hosting VPS Linux, nel qual caso puoi semplicemente chiedere ai nostri esperti amministratori Linux di configurare tutto per te. Sono disponibili 24 ore su 24, 7 giorni su 7 e si prenderanno immediatamente cura della tua richiesta.

PS. Se ti è piaciuto questo post su come installare CouchDB su Debian 9, condividilo con i tuoi amici attraverso i social network usando i pulsanti qui sotto, o semplicemente lascia un commento nella sezione commenti. Grazie.


Debian
  1. Come installare Apache su Debian 9

  2. Come installare Apache Cassandra su Debian 9

  3. Come installare Apache Maven su Debian 10

  4. Come installare Apache Maven su Debian 11

  5. Come installare Apache Cassandra su Debian 11 / Debian 10

Come installare Apache NetBeans su Debian 11 / Debian 10

Come installare Apache Subversion su Debian 9

Come installare Apache Kafka su Debian 9

Come installare Apache CouchDB su Debian 10 Buster

Come installare Apache Cassandra su Debian 10

Come installare Apache CouchDB su Debian 10