In this tutorial, we will show you how to install and set up Apache CouchDB on a VPS running Ubuntu 18.04.
Apache CouchDB is a free and open-source NoSQL database solution. Apache CouchDB has a document-oriented NoSQL database architecture and is implemented in the concurrency-oriented language Erlang; Apache CouchDB uses JSON to store data with documents, it uses JavaScript as its query language using MapReduce, and it uses RESTful HTTP for its API. CouchDB works smoothly with all latest modern web and mobile applications. All of this makes for a pretty seamless database experience. Let’s get started with installing CouchDB.
Table of Contents
Prerequisites:
- A Server running Ubuntu 18.04. For the purposes of this tutorial, we’ll be using one of our Managed Ubuntu 18.04 VPSes with 2GB of memory.
- SSH access with an account that has root privileges, or access to the “root” user itself.
Step 1: Log in via SSH and Update Packages
Log in to your Ubuntu 18.04 VPS with SSH as the root user:
ssh root@IP_Address -p Port_number
Replace “root” with a user that has sudo privileges if necessary. Additionally, replace “IP_Address” and “Port_Number” with your server’s respective IP address and SSH port number. Next, let’s make sure that we’re on Ubuntu 18.04. You can do that like this:
# lsb_release -a
You should get this as the output:
Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic
Then, run the following command to make sure that all installed packages on the server are updated to their latest available versions:
# apt update && apt upgrade
Step 2: Install Apache CouchDB
Prior to installing Apache CouchDB, we have to add the official CouchDB PPA repository, this is because installing CouchDB using its PPA repository is the easiest method. We can do this by running these commands:
# curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | apt-key add -
# echo "deb https://apache.bintray.com/couchdb-deb bionic main" | tee -a /etc/apt/sources.list
The PPA repository has been added. Now we need to update the package list and finally proceed with the CouchDB installation.
# apt update # apt install couchdb
In this tutorial, we will choose standalone, choose <Ok> to proceed.
Since we are installing CouchDB with a standalone node, we can set it to listen on 127.0.0.1.
In this step, we need to create a password for our CouchDB “admin” user.
Repeat your password to start installing Apache CouchDB and complete the install process.
Congratulations! Apache CouchDB has been successfully installed. CouchDB will start automatically after installation. You can enable CouchDB to start on boot time using the following command:
# systemctl enable couchdb
You can check the status of CouchDB using the following command:
# systemctl status couchdb
At this point, you can access http://127.0.0.1:5984/_utils/
and log in using the credentials we created earlier in the previous step.
To make CouchDB accessible from outside of your local network, we can change the listening address. We need to edit /opt/couchdb/etc/local.ini file and add 0.0.0.0 to the bind address variable in that configuration file. Do not forget to restart Apache CouchDB after making changes. At this point, you should be able to access http://12.34.56.78:5984, replace 12.34.56.78 with your server actual IP address.
Step 3: Create a Database
Once logged into the Fauxton control panel at http://127.0.0.1:5984/_utils/
using the admin credentials we created during the installation, we should be able to create a database. We can click on the database icon on the left side of the screen, then click on Create Database button on the top-right of the screen. It is self-explanatory from there.
Note: It is not recommended to allow CouchDB to be accessible through the internet because this allows anyone to access all documents and databases. Note that this won’t allow them to edit or delete the files, as we made an admin account. So, if we need access to it remotely, it would be better to make use of SSH tunneling or allow a specific IP address to connect via iptables or any firewall program of your liking.
Of course, you don’t have to know how to install Apache CouchDB on Ubuntu 18.04 if you have an Ubuntu 18.04 VPS hosted with us. If you do, you can simply ask our support team to install Apache CouchDB on Ubuntu 18.04 for you. They are available 24/7 and will be able to help you with the installation of Apache CouchDB, as well as any additional requirements that you may have. You might also want to read our latest update on How to Install CouchDB on Ubuntu 20.04.
PS. If you enjoy reading this blog post on how to install Apache CouchDB on Ubuntu 18.04, feel free to share it on social networks by using the shortcuts below or simply leave a comment down in the comments section. Thank you.
that was very helpful, thank you very much