[Solved] Install apache2 on the ubuntu virtual box using chef-client

I’m going through chef-learning tutorials (learn.chef.io) and I’m stuck at installation of apache.

I’m using virtual box and chef-client.

Refer the gist for the receipt I’m running: recipe for apache2

When I run chef-client in local mode, I’m getting following error:

Running handlers:
[2017-09-02T11:34:18+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-09-02T11:34:18+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 28 seconds
[2017-09-02T11:34:18+00:00] FATAL: Stacktrace dumped to /root/.chef/local-mode-cache/cache/chef-stacktrace.out
[2017-09-02T11:34:18+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-09-02T11:34:18+00:00] ERROR: yum_package[apache2] (@recipe_files::/home/vagrant/chef-repo/webserver.rb line 6) had an error: Chef::Exceptions::package: No candidate version available for apache2
[2017-09-02T11:34:18+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Your subject line says you’re using Ubuntu, but looks like the error is
being generated by the yum_package resource, which would make me think
you’re using a Red Hat based distro like CentOS.

In any event, the yum package for Apache2 is typically httpd. So try
changing the package name to that.

I am curious to know how you resolved this. I am using Ubuntu 16.04