Unable to install CouchBase server

Hi,

I am trying to set up couchbase server by following - https://developer.couchbase.com/documentation/server/4.1/install/ubuntu-apt.html

in AWS server. In one server I was able to install but in 2nd server I am getting following error:

sudo apt-get install couchbase-server
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package couchbase-server

Version of OS in 1st server
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04

Version of OS in 2nd server

Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

Did you execute sudo apt-get update? Could you post its output here?

Yes. I already tried that.

And what was the output of the command?

sudo apt-get update
Hit:1 http://us-west-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://us-west-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://us-west-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:5 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease
Hit:6 http://packages.couchbase.com/ubuntu xenial InRelease
Hit:7 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Fetched 306 kB in 0s (317 kB/s)
Reading package lists… Done

Could you make sure you follow instructions in the official documentation?
https://developer.couchbase.com/documentation/server/current/install/ubuntu-debian-install.html#story-h2-2

I don’t see it is loading from http://packages.couchbase.com/releases/couchbase-server/community/deb/, are you sure you use amd64 platform?

Yes,

I have tried this as well.

PFB the output

uname -m
x86_64
root@ip-172-31-18-16:~# curl -O http://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-3-amd64.deb
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3582 100 3582 0 0 6953 0 --:–:-- --:–:-- --:–:-- 6955
root@ip-172-31-18-16:~#
root@ip-172-31-18-16:~# sudo dpkg -i couchbase-release-1.0-3-amd64.deb
(Reading database … 201078 files and directories currently installed.)
Preparing to unpack couchbase-release-1.0-3-amd64.deb …
Unpacking couchbase-release (1.0-3) over (1.0-3) …
Setting up couchbase-release (1.0-3) …
gpg: key CD406E62: “Couchbase Release Key (RPM) support@couchbase.com” not changed
gpg: key D9223EDA: “Couchbase Release Key support@couchbase.com” not changed
gpg: Total number processed: 2
gpg: unchanged: 2
OK
root@ip-172-31-18-16:~# sudo apt-get update
Hit:1 http://us-west-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://us-west-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://us-west-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Hit:4 http://packages.couchbase.com/ubuntu xenial InRelease
Get:5 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:6 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease
Get:7 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease [17.5 kB]
Get:8 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial/main amd64 Packages [2,900 B]
Fetched 327 kB in 1s (323 kB/s)
Reading package lists… Done
root@ip-172-31-18-16:~# sudo apt-get install couchbase-server-community
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package couchbase-server-community

`

Could you show contents of /etc/apt/sources.list.d/couchbase.list?

vi couchbase.list
deb http://packages.couchbase.com/ubuntu xenial xenial/main

but http://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-3-amd64.deb contains different list, it uses the following template when generating the list of repositories, so you should have three lines

deb [ arch=amd64 ] http://packages.couchbase.com/releases/couchbase-server/enterprise/deb/  %DCODE_SERVER% %DCODE_SERVER%/main
deb [ arch=amd64 ] http://packages.couchbase.com/releases/couchbase-server/community/deb/  %DCODE_SERVER% %DCODE_SERVER%/main
deb  http://packages.couchbase.com/ubuntu %DCODE_SDK% %DCODE_SDK%/main

Could you reinstall couchbase-release package?

In my other server in which I was able to install successfully, there also I have only one line:

vi couchbase.list
deb http://packages.couchbase.com/ubuntu xenial xenial/main

Tried re-installation as well, same problem

sudo dpkg -i couchbase-release-1.0-3-amd64.deb
(Reading database … 218611 files and directories currently installed.)
Preparing to unpack couchbase-release-1.0-3-amd64.deb …
Unpacking couchbase-release (1.0-3) over (1.0-3) …
Setting up couchbase-release (1.0-3) …
gpg: key CD406E62: “Couchbase Release Key (RPM) support@couchbase.com” not changed
gpg: key D9223EDA: “Couchbase Release Key support@couchbase.com” not changed
gpg: Total number processed: 2
gpg: unchanged: 2
OK
root@ip-172-31-18-16:~# sudo apt-get update
Hit:1 http://us-west-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://us-west-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:3 http://us-west-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:5 http://packages.couchbase.com/ubuntu xenial InRelease
Hit:6 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease
Hit:7 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease
Hit:8 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
Fetched 102 kB in 0s (116 kB/s)
Reading package lists… Done
root@ip-172-31-18-16:~# sudo apt-get install couchbase-server-community
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package couchbase-server-community

I think that the answer is simple:

#!/bin/bash
gpg --import /etc/apt/trusted.gpg.d/GPG-KEY-COUCHBASE-1.0
apt-key add /etc/apt/trusted.gpg.d/GPG-KEY-COUCHBASE-1.0

repl=`lsb_release -c | awk '{print $2}'`
if [ "$repl" = "precise" -o "$repl" = "trusty" -o "$repl" = "lucid" -o "$repl" = "wheezy" -o "$repl" = "jessie" ]; then
    sed -e "s/%DCODE_SERVER%/$repl/g" -i /etc/apt/sources.list.d/couchbase.list
    sed -e "s/%DCODE_SDK%/$repl/g" -i /etc/apt/sources.list.d/couchbase.list
elif [ "$repl" = "xenial" ]; then
    sed -e "/%DCODE_SERVER%/d" -i /etc/apt/sources.list.d/couchbase.list
    sed -e "s/%DCODE_SDK%/$repl/g" -i /etc/apt/sources.list.d/couchbase.list
fi

This is postinst script, and as you can see it removes server-related repositories on Ubuntu Xenial.

What version of Couchbase are you trying to install? Couchbase 4.6.3 does not support Ubuntu Xenial, you should use Trusty

I guess I have missed this. Can you please help me with the command to check the Couchbase version.?

You can see supported platforms in Download section on the site: https://www.couchbase.com/downloads

I am using Ubuntu 16.04 which is not supported. In both the server the version is 16.04 but I can run in one server and not in other.
Both the servers have exact configuration.

Does it work on Ubuntu Trusty 14.04.5? It should work there, as it is in list of supported platforms.