Setup Consul on a Single Server

How to setup Consul on one instance

Running Consul on one instance


This installation guide assumes Ubuntu 14.04 OS, tmux and nginx already installed. Follow the below instruction to complete the consul installation.

  • Run the following command to download and install consul
cd /usr/local/bin
sudo wget
sudo unzip
sudo rm

Now the consul command should be ready to use

  • Download the web-ui of consul in /home/ubuntu/consul-ui/
cd ~
mkdir -p consul-ui
sudo rm

  • Create the file config.json in /home/ubuntu/consul-config/server/ directory and put the following configuration in it. Here P.P.P.P is the private IP of the instance
"bootstrap": true,
"server": true,
"log_level": "DEBUG",
"enable_syslog": true,
"datacenter": "dc1",
"addresses" : {
"http": ""
"bind_addr": "P.P.P.P",
"node_name": "P.P.P.P",
"data_dir": "/home/ubuntu/consuldata",
"ui_dir": "/home/ubuntu/consul-ui",
"acl_datacenter": "dc1",
"acl_master_token": "4f3fa35a-h3ab-45a2-914f-f82a34fab0c45",
"acl_default_policy": "deny",
"encrypt": "pXoaLOJ816mO+da8y8zrsg=="

  • Make consul.conf file in /etc/nginx/conf.d/ directory and put the following configurations in it
listen 80 ;
root /home/ubuntu/consul-ui;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;

Change to the the desired domain, save and exit. Restart the nginx server sudo service nginx restart.

  • Open a tmux session by running tmux command. Run the following command to start consul
consul agent -config-dir ~/consul-config/server -ui-dir ~/consul-ui -bootstrap true -client=

Now, the consul should be running. Leave the process running by running ctrl+b than d. This will leave the tmux session running in which consul process was running.
The web-ui must be running on the public-ip or domain mentioned in the consul.conf file.

Note – If the link to download consul and web-ui doesn’t work (in case of version of consul changed) than visit this page to get the right link.

The video Tutorial


5 thoughts on “Setup Consul on a Single Server

  • May 16, 2016 at 9:32 am

    I think it makes more sense to add another 2 sections into this article: how to use docker in order to run consul in a single command, and how to setup single consul via init, upstart or systemd, instead of tmux.

  • January 11, 2017 at 10:16 am

    Do you have any documentation to setup two data center. getting some errors while adding with 1st data center.

  • February 21, 2017 at 8:25 pm

    Hi Ajeet, Hope your day is going great. I am very new to Consul, do you have instructions on how to set this up on RHEL 7? Thanks.

  • June 8, 2017 at 1:12 pm

    I need your help to read data like these values
    into hierarchical format into C# class format like this

    public class ConfigurationSettings
    public ApplicationSettings applicationSettings { get; set; }
    public SupplierSettings supplierSettings { get; set; }

    public class ApplicationSettings
    public string MetadataServiceUrl { get; set; }

    public class SupplierSettings
    public string TestUrl { get; set; }

    Please help me on this.


Leave a Reply

Your email address will not be published. Required fields are marked *