+4 votes
257 views
How to install Apache CouchDB on CentOS 7

in Linux / Unix by (552k points)
reopened | 257 views

1 Answer

+5 votes
Best answer

1. Install the EPEL and Apache CouchDB repositories in CentOs 7
2. Verify CouchDB service and ports in CentOs 7
3. Enable Apache CouchDB HTTP server in CentOs 7
4. Access and configure administrator account in Apache CouchDB

One of the most significant potentials of Linux distributions is the ability to expand their potential to much higher levels than the system brings by default due to being free code..

We have mentioned the thousands of options of applications, programs and utilities that we find in every type of category to make a more productive server and today we will focus on Apache CouchDB which is a free code application of noSQL software.

We will perform this analysis in CentOS 7..

What is Apache CouchDB?
Apache CouchDB is a free software resource which allows us to access data from where it is necessary by defining the Coach Replication Protocol, which was implemented by a variety of projects and products that cover all IT environments, from clusters of globally distributed servers , or mobile phones to web browsers. Software that is compatible with the Couch Replication Protocol includes: PouchDB, Cloudant and Couchbase Lite.

Apache CouchDB was developed in 2005 and became part of the Apache Software Foundation in 2008.
CouchDB has a simple query language for the developer, and can optionally include MapReduce for a simple, efficient and complete data recovery.

Apache CouchDB Features
Within the different features of Apache CouchDB we have:
  • Single-node database: CouchDB has an excellent single-node database that works like any other database using an application server, the best thing is that it can be extended at any time.
  • Cluster: Apache CouchDB is a grouped database that allows us to run a single logical database server on any number of servers or virtual machines. A CouchDB cluster improves the configuration of a single node by granting it greater capacity and high availability without changing any internal API.
  • CouchDB makes use of the HTTP protocol and JSON data format and is compatible with any software that supports them.
  • It includes Offline First Data Sync, which is an exclusive CouchDB duplication protocol, being the basis of a whole new generation of "Offline First" applications for mobile applications and other environments with current network infrastructure.
  • Apache CouchDB is designed for servers (from Raspberry Pi to large cloud installations), while PouchDB is designed for mobile and desktop web browsers and Couchbase Lite is designed for native iOS and Android applications covering all areas of IT.
  • Individual nodes use a fault-resistant only annex data structure. A multi-node CouchDB cluster saves all data redundantly, so it is always available for when necessary.

1. Install the EPEL and Apache CouchDB repositories in CentOs 7


Before installing Apache CouchDB on CentOS 7, it will be necessary to add a new EPEL repository (Extra Package for Enterprise Linux).
Step 1

We can add the EPEL repository with the following command:
 yum -y install epel-release 

image

Step 2

To install Apache CouchDB, we have rpm packages for installation in RedHat or CentOS, so for that, we will install CouchDB from the Apache repository, going to the /etc/yum.repos.dy directory and create a new repos file called " apache-couchdb.repo "using the nano editor:
 cd /etc/yum.repos.d/ nano apache-couchdb.repo 
Step 3

In the new deployed file we will paste the following:
 [bintray - apache-couchdb-rpm] name = bintray - apache-couchdb-rpm baseurl = http: //apache.bintray.com/couchdb-rpm/el$releasever/$basearch/ gpgcheck = 0 repo_gpgcheck = 0 enabled = 1 

image

Step 4

We save the changes using the following key combination:

+ O Ctrl + O

We leave the editor using:

+ X Ctrl + X

Step 5

We proceed to install Apache CouchDB by running the following line:
 yum -y install couchdb 

image

Step 6

There we expect all packages to be downloaded in installed correctly. After the installation finishes, we will start the service and enable it to run at system startup:
 systemctl start couchdb systemctl enable couchdb 

image


2. Verify CouchDB service and ports in CentOs 7

Step 1

We can verify the current status of the CouchDB service by running the following line:
 systemctl status couchdb 

image

Step 2

It is important to verify on which ports the Apache CouchDB communication is established to enable them in the firewall. To verify this we execute the following:
 netstat -plntu 
Note
In case of not having netstat we must install it by executing the following. By default Apache CouchDB will use port 5984.
 yum install net-tools 

3. Enable Apache CouchDB HTTP server in CentOs 7


Apache CouchDB provides the HTTP server for administrator access on the default port, as already mentioned, 5984. It has a web user interface of the administration panel called 'Fauxton'.
Step 1

To enable the Apache CouchDB HTTP server we must go to the apache couchdb / opt / couchdb installation directory and edit the configuration file called default.ini in the etc / directory:
 cd / opt / couchdb nano etc / default.ini 
Step 2

In the deployed file we will go to the "[chttpd]" section and there we enter our IP address in the "bind_address" field:

image

Step 3

We save the changes and leave the file. We proceed to restart the Apache CouchDB service with the following line:
 systemctl restart couchdb 
Step 4

We proceed to enable the Apache CouchDB port by running the following lines:
 firewall-cmd --add-port = 5984 / tcp --permanent firewall-cmd –reload 

image


4. Access and configure administrator account in Apache CouchDB

Step 1

Now, to access Apache CouchDB, we go to a browser and enter the following syntax. This will be the initial Apache CouchDB environment in CentOS 7.
 http: // IP Address: 5984 / _utils / 

image

Step 2

This point is vital for security and privacy since at this time access to the CouchDB web platform is direct and does not require credentials, so any user is able to create, edit or delete objects.
To do this, click on the two-way arrow icon in the upper right and then click on the "Databases" icon:

image

Step 3

There, we click on the "Admin Party!" And in the new window we will create the administrator user with the respective credentials. Click on the Create Admin button to create the user.

image

Step 4

With this method, the next time we try to access again it will be necessary to enter the defined credentials:

image

Step 5

Apache CouchDB offers an API to manage the CouchDB system, we can use the 'curl' command utility to manage the CouchDB system in general.
Hello CouchDB
To obtain information about the couchdb server installed in CentOS 7, we can use the GET parameter as follows:
 curl -X GET http: // localhost: 5984 / or curl -X GET http: // IP: 5984 / 

image

We can see that the installed version is 2.1.1..

Create a new database
The essence of Apache CouchDB is the databases, to create a new database, it will be necessary to have administrator privileges. Then, we will use the PUT parameter. We are going to create a new database called solvetic_db:
 curl -X PUT http://192.168.0.8:5984/solvetic_db 
When executing this line we may see a permission error, we can try using the following line:
 curl -X PUT http: // user: [email protected]: 5984 / solvetic_db 

image

We can see that the database has been created correctly:

image

List the database and its information
To obtain information about a database, it will be necessary to use the GET parameter as follows:
 curl -X GET http: // user: password @ localhost: 5984 / _all_dbs 
This will display all the databases created at the time. Now, we will execute the following to obtain the information of any of the deployed databases:
 curl -X GET http: // user: password @ localhost: 5984 / solvetic_db 

image

Delete a database
At the moment we want to delete an Apache CouchDB database we can execute the following:
 curl -X DELETE http: // user: password @ localhost: 5984 / solvetic_db 
We can validate that it has been removed by running:
 curl -X GET http: // user: password @ localhost: 5984 / _all_dbs 

image

We can understand the diversity of tasks that allows us to carry out Apache CouchDB for the management of our databases in a simple way.


by (3.5m points)
edited

Related questions

+5 votes
1 answer
asked Nov 1, 2019 in Linux / Unix by backtothefuture (552k points) | 269 views
+3 votes
1 answer
+3 votes
1 answer
asked Oct 1, 2019 in Linux / Unix by backtothefuture (552k points) | 249 views
+4 votes
1 answer
asked Oct 10, 2019 in Linux / Unix by backtothefuture (552k points) | 294 views
+4 votes
1 answer
asked Oct 3, 2019 in Linux / Unix by backtothefuture (552k points) | 248 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users