Saturday 4 November 2017

Help on Python

Help on Python

execute the below command in python shell to launch help tool.

HELP

help()


>>> help()

Welcome to Python 3.6's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/3.6/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".

help>


  • modules
  • keywords 
  • symbols
  • topics
  • type


modules

help> modules

Please wait a moment while I gather a list of all available modules...

invalid distro: 'Ubuntu'
AptUrl              apport_python_hook  hmac                sched
CommandNotFound     apt                 html                secrets
Crypto              aptdaemon           http                select
DistUpgrade         aptsources          httplib2            selectors
LanguageSelector    argparse            idlelib             shelve
NvidiaDetector      array               imaplib             shlex
Onboard             ast                 imghdr              shutil
Quirks              asynchat            imp                 signal
UbuntuDrivers       asyncio             importlib           site
UpdateManager       asyncore            inspect             sitecustomize
__future__          atexit              io                  six
_ast                audioop             ipaddress           smtpd
_asyncio            base64              itertools           smtplib
_bisect             bdb                 janitor             sndhdr
_blake2             binascii            json                socket
_bootlocale         binhex              keyword             socketserver
_bz2                bisect              language_support_pkgs softwarecenter_aptd_plugins
_codecs             builtins            lib2to3             softwareproperties
_codecs_cn          bytecode            linecache           speechd
_codecs_hk          bz2                 locale              speechd_config
_codecs_iso2022     cProfile            logging             spwd
_codecs_jp          cairo               louis               sqlite3
_codecs_kr          calendar            lsb_release         sre_compile
_codecs_tw          cgi                 lxml                sre_constants
_collections        cgitb               lzma                sre_parse
_collections_abc    chardet             macpath             ssl
_compat_pickle      checkbox_ng         macurl2path         stat
_compression        checkbox_support    mailbox             statistics
_crypt              chunk               mailcap             string
_csv                cmath               mako                stringprep
_ctypes             cmd                 markupsafe          struct
_ctypes_test        code                marshal             subprocess
_curses             codecs              math                sunau
_curses_panel       codeop              mimetypes           symbol
_datetime           collections         mmap                symtable
_dbm                colorsys            modulefinder        sys
_decimal            compileall          multiprocessing     sysconfig
_dummy_thread       concurrent          netrc               syslog
_elementtree        configparser        nis                 tabnanny
_functools          contextlib          nntplib             tarfile
_hashlib            copy                ntpath              telnetlib
_heapq              copyreg             nturl2path          tempfile
_imp                crypt               numbers             termios
_io                 csv                 oauthlib            test
_json               ctypes              oneconf             textwrap
_locale             curl                opcode              this
_lsprof             curses              operator            threading
_lzma               datetime            optparse            time
_markupbase         dbm                 orca                timeit
_md5                dbus                os                  tkinter
_multibytecodec     deb822              ossaudiodev         token
_multiprocessing    debconf             parser              tokenize
_opcode             debian              pathlib             trace
_operator           debian_bundle       pdb                 traceback
_osx_support        decimal             pickle              tracemalloc
_pickle             defer               pickletools         tty
_posixsubprocess    difflib             pipes               turtle
_pydecimal          dis                 piston_mini_client  types
_pyio               distutils           pkg_resources       typing
_random             doctest             pkgutil             ufw
_sha1               dummy_threading     plainbox            unicodedata
_sha256             email               platform            unittest
_sha3               encodings           plistlib            uno
_sha512             enum                poplib              unohelper
_signal             errno               posix               urllib
_sitebuiltins       faulthandler        posixpath           urllib3
_socket             fcntl               pprint              usbcreator
_sqlite3            feedparser          problem_report      uu
_sre                feedparser_sgmllib3 profile             uuid
_ssl                filecmp             pstats              venv
_stat               fileinput           pty                 warnings
_string             fnmatch             pwd                 wave
_strptime           formatter           py_compile          weakref
_struct             fpectl              pyatspi             webbrowser
_symtable           fractions           pyclbr              wsgiref
_sysconfigdata_m_linux_i386-linux-gnu friends             pydoc               xdg
_testbuffer         ftplib              pydoc_data          xdiagnose
_testcapi           functools           pyexpat             xdrlib
_testimportmultiple gc                  pygtkcompat         xkit
_testmultiphase     genericpath         pyparsing           xml
_thread             getopt              queue               xmlrpc
_threading_local    getpass             quopri              xxlimited
_tracemalloc        gettext             random              xxsubtype
_warnings           gi                  re                  zipapp
_weakref            glob                readline            zipfile
_weakrefset         gnome_sudoku        reprlib             zipimport
abc                 grp                 requests            zlib
aifc                gzip                resource
antigravity         hashlib             rlcompleter
apport              heapq               runpy

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".

Keywords

help> keywords

Here is a list of the Python keywords.  Enter any keyword to get more help.

False               def                 if                  raise
None                del                 import              return
True                elif                in                  try
and                 else                is                  while
as                  except              lambda              with
assert              finally             nonlocal            yield
break               for                 not
class               from                or
continue            global              pass


symbols

help> symbols

Here is a list of the punctuation symbols which Python assigns special meaning
to. Enter any symbol to get more help.

!=                  *=                  <<                  ^
"                   +                   <<=                 ^=
"""                 +=                  <=                  _
%                   ,                   <>                  __
%=                  -                   ==                  `
&                   -=                  >                   b"
&=                  .                   >=                  b'
'                   ...                 >>                  j
'''                 /                   >>=                 r"
(                   //                  @                   r'
)                   //=                 J                   |
*                   /=                  [                   |=
**                  :                   \                   ~
**=                 <                   ]

Tpoics

help> topics

Here is a list of available topics.  Enter any topic name to get more help.

ASSERTION           DELETION            LOOPING             SHIFTING
ASSIGNMENT          DICTIONARIES        MAPPINGMETHODS      SLICINGS
ATTRIBUTEMETHODS    DICTIONARYLITERALS  MAPPINGS            SPECIALATTRIBUTES
ATTRIBUTES          DYNAMICFEATURES     METHODS             SPECIALIDENTIFIERS
AUGMENTEDASSIGNMENT ELLIPSIS            MODULES             SPECIALMETHODS
BASICMETHODS        EXCEPTIONS          NAMESPACES          STRINGMETHODS
BINARY              EXECUTION           NONE                STRINGS
BITWISE             EXPRESSIONS         NUMBERMETHODS       SUBSCRIPTS
BOOLEAN             FLOAT               NUMBERS             TRACEBACKS
CALLABLEMETHODS     FORMATTING          OBJECTS             TRUTHVALUE
CALLS               FRAMEOBJECTS        OPERATORS           TUPLELITERALS
CLASSES             FRAMES              PACKAGES            TUPLES
CODEOBJECTS         FUNCTIONS           POWER               TYPEOBJECTS
COMPARISON          IDENTIFIERS         PRECEDENCE          TYPES
COMPLEX             IMPORTING           PRIVATENAMES        UNARY
CONDITIONAL         INTEGER             RETURNING           UNICODE
CONTEXTMANAGERS     LISTLITERALS        SCOPING
CONVERSIONS         LISTS               SEQUENCEMETHODS
DEBUGGING           LITERALS            SEQUENCES


help> type
Help on class type in module builtins:

class type(object)
 |  type(object_or_name, bases, dict)
 |  type(object) -> the object's type
 |  type(name, bases, dict) -> a new type
 |
 |  Methods defined here:
 |
 |  __call__(self, /, *args, **kwargs)
 |      Call self as a function.
 |
 |  __delattr__(self, name, /)
 |      Implement delattr(self, name).
 |
 |  __dir__(...)
 |      __dir__() -> list
 |      specialized __dir__ implementation for types
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __init__(self, /, *args, **kwargs)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __instancecheck__(...)
 |      __instancecheck__() -> bool
 |      check if an object is an instance
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  __prepare__(...)
 |      __prepare__() -> dict
 |      used to create the namespace for the class statement
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setattr__(self, name, value, /)
 |      Implement setattr(self, name, value).


Install Python3.6 on Ubuntu

Install Python3.6 on Ubuntu 


sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
reference
https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get

Python view Byte Code for the given script

Python view Byte Code for the given script


Normal execution syntax
python file_name.py

For retrieving the Byte Code information the execution syntax is,
python -m dist file_name.py

which will display in a disassembler format (human readable format)

Example :

# simple.py
a=10
b=20
c=a+b
print(c)

#output 
30


#cat bytecode.py

a=10
b=20
c=a+b
print(c)

#python3.6 bytecode.py

30

#python3.6 -m dis bytecode.py

  1           0 LOAD_CONST               0 (10)
              2 STORE_NAME               0 (a)

  2           4 LOAD_CONST               1 (20)
              6 STORE_NAME               1 (b)

  3           8 LOAD_NAME                0 (a)
             10 LOAD_NAME                1 (b)
             12 BINARY_ADD
             14 STORE_NAME               2 (c)

  4          16 LOAD_NAME                3 (print)
             18 LOAD_NAME                2 (c)
             20 CALL_FUNCTION            1
             22 POP_TOP
             24 LOAD_CONST               2 (None)
             26 RETURN_VALUE



Friday 3 November 2017

Python Microsoft Visual C++ 14.0 is required error while pip install

Python Microsoft Visual C++ 14.0 is required error while pip install


Error
-------

Collecting dist
  Using cached dist-1.0.3.zip
Installing collected packages: dist
  Running setup.py install for dist: started
    Running setup.py install for dist: finished with status 'error'
    Complete output from command C:\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\alps\\AppData\\Local\\Temp\\pycharm-packaging\\dist\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\alps\AppData\Local\Temp\pip-62o9v2z5-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'dist' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
 
    ----------------------------------------

Command "C:\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\alps\\AppData\\Local\\Temp\\pycharm-packaging\\dist\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\alps\AppData\Local\Temp\pip-62o9v2z5-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\alps\AppData\Local\Temp\pycharm-packaging\dist\


pytho 3.x required "Microsoft Visual C++ 14.0"


before that install dotnet 4.5.1 which will be the minimum required version to be available on the machine before executing MS visutal c++ 14.0
https://www.microsoft.com/en-in/download/details.aspx?id=40779
so post installing python dont forget to install the package which can be downloaded from
http://landinghub.visualstudio.com/visual-cpp-build-tools

post installation restart the machine to take effect the changes

How to create compiled files in python (py to pyc conversion)

How to create compiled files in python (py to pyc conversion)

This post explains about generating compiled files in python(py to pyc conversion).

The syntax is given as follows,

python -m py_compile file_name.py

where,
python is the executor command
-m is to represent the module
py_compile is the module to be called
file_name.py is the actual file which has to be compiled

This will create a output file like file_name.cpython.pyc

Thursday 2 March 2017

Python 3 While Loop

Python 3 While Loop

The below code block is an example for python while loop

'''While loops'''
a = 11
while a>10:
    a+=1
    print (a)
    break       # prints 12 and then breaks

Wednesday 1 March 2017

Python 3 Conditional Operators

Python 3 Conditional Operators

The explanation programs for conditional operators is as follows,

'''Conditional Operation'''
a = 100
if a == 100:
    print ("true")
else:
    print ("false")

# result is true
if a <50:
    print ("less than 50")
else:
    if a > 50:
        print ("greater than 50")

# result is greater than 50
if a < 50:
    print ("less than 50")
elif a>50:
    print ("greater than 50")
    
# result is greater than 50











Python 3 Relational Operators

Python 3 Relational Operators

Below code represents as an example for Relational Operators in Python

'''Relational Operation'''
test = 100
print (test == 100)  #True
print (test == 50)   #False
print (test != 100)  #False
print (test !=50)    #True
print (test < 200)   #True
print (test > 200)   #False

Python 3 Conversion between Scalar Built in Types

Python 3 Conversion between Scalar Built in Types


The type conversion in Python 3 is explained with the code below,

"Conversion between the types"
int_value = 100          # An integer assignment
float_value = 100.0       # A floating point
string_value = "name"       # A string# 
none_value = None

print (int_value)           #100
print (float(int_value))    #100.0
print (str(int_value))       #100
print (float_value)         #100.0 
print (int(float_value))    #100
print (str(float_value))    #100.0
print (string_value)        #name
# print (int(string_value)) 
#  ValueError: invalid literal for int() with base 10: 'name'# 
print (float(string_value)) 
# ValueError: could not convert string to float: 'name'

Python 3 Scalar Built in Types

Python 3 Scalar Built in Types

The below example explains about the python 3 available built in scalar types,


''' Available list of scalar built in types in python are
    1. int    
    2. float    
    3. None    
    4. bool'''
int_value = 5          # An integer assignment
float_value = 50.0       # A floating point
string_value = "name"       # A stringnone_value = None

print (int_value)
print (float_value)
print (string_value)
# print (None(none_value)) it will not print gives 
#"TypeError: 'NoneType' object is not callable"

Python 3 help Command

Python 3 help() Command

Just Type help() and hit enter or in your IDE type help() and run the file it will give help contents and help console.

Like the one given below

Welcome to Python 3.4's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/3.4/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".

help> 


Example for help command usage 


help> import
The "import" statement
**********************

   import_stmt     ::= "import" module ["as" name] ( "," module ["as" name] )*
                   | "from" relative_module "import" identifier ["as" name]
                   ( "," identifier ["as" name] )*
                   | "from" relative_module "import" "(" identifier ["as" name]
                   ( "," identifier ["as" name] )* [","] ")"
                   | "from" module "import" "*"
   module          ::= (identifier ".")* identifier
   relative_module ::= "."* module | "."+
   name            ::= identifier

The basic import statement (no "from" clause) is executed in two
steps:

1. find a module, loading and initializing it if necessary

2. define a name or names in the local namespace for the scope
   where the "import" statement occurs.

When the statement contains multiple clauses (separated by commas) the
two steps are carried out separately for each clause, just as though
the clauses had been separated out into individiual import statements.

The details of the first step, finding and loading modules are
described in greater detail in the section on the *import system*,
which also describes the various types of packages and modules that
can be imported, as well as all the hooks that can be used to
customize the import system. Note that failures in this step may
indicate either that the module could not be located, *or* that an
error occurred while initializing the module, which includes execution
of the module's code.

If the requested module is retrieved successfully, it will be made
available in the local namespace in one of three ways:

* If the module name is followed by "as", then the name following
  "as" is bound directly to the imported module.

* If no other name is specified, and the module being imported is a
  top level module, the module's name is bound in the local namespace
  as a reference to the imported module

* If the module being imported is *not* a top level module, then the
  name of the top level package that contains the module is bound in
  the local namespace as a reference to the top level package. The
  imported module must be accessed using its full qualified name
  rather than directly

The "from" form uses a slightly more complex process:

1. find the module specified in the "from" clause, loading and
   initializing it if necessary;

2. for each of the identifiers specified in the "import" clauses:

   1. check if the imported module has an attribute by that name

   2. if not, attempt to import a submodule with that name and then
      check the imported module again for that attribute

   3. if the attribute is not found, "ImportError" is raised.

   4. otherwise, a reference to that value is stored in the local
      namespace, using the name in the "as" clause if it is present,
      otherwise using the attribute name

Examples:

   import foo                 # foo imported and bound locally
   import foo.bar.baz         # foo.bar.baz imported, foo bound locally
   import foo.bar.baz as fbb  # foo.bar.baz imported and bound as fbb
   from foo.bar import baz    # foo.bar.baz imported and bound as baz
   from foo import attr       # foo imported and foo.attr bound as attr

If the list of identifiers is replaced by a star ("'*'"), all public
names defined in the module are bound in the local namespace for the
scope where the "import" statement occurs.

The *public names* defined by a module are determined by checking the
module's namespace for a variable named "__all__"; if defined, it must
be a sequence of strings which are names defined or imported by that
module.  The names given in "__all__" are all considered public and
are required to exist.  If "__all__" is not defined, the set of public
names includes all names found in the module's namespace which do not
begin with an underscore character ("'_'").  "__all__" should contain
the entire public API. It is intended to avoid accidentally exporting
items that are not part of the API (such as library modules which were
imported and used within the module).

The "from" form with "*" may only occur in a module scope.  The wild
card form of import --- "from module import *" --- is only allowed at
the module level.  Attempting to use it in class or function
definitions will raise a "SyntaxError".

When specifying what module to import you do not have to specify the
absolute name of the module. When a module or package is contained
within another package it is possible to make a relative import within
the same top package without having to mention the package name. By
using leading dots in the specified module or package after "from" you
can specify how high to traverse up the current package hierarchy
without specifying exact names. One leading dot means the current
package where the module making the import exists. Two dots means up
one package level. Three dots is up two levels, etc. So if you execute
"from . import mod" from a module in the "pkg" package then you will
end up importing "pkg.mod". If you execute "from ..subpkg2 import mod"
from within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The
specification for relative imports is contained within **PEP 328**.

"importlib.import_module()" is provided to support applications that
determine dynamically the modules to be loaded.


Future statements
=================

A *future statement* is a directive to the compiler that a particular
module should be compiled using syntax or semantics that will be
available in a specified future release of Python where the feature
becomes standard.

The future statement is intended to ease migration to future versions
of Python that introduce incompatible changes to the language.  It
allows use of the new features on a per-module basis before the
release in which the feature becomes standard.

   future_statement ::= "from" "__future__" "import" feature ["as" name]
                        ("," feature ["as" name])*
                        | "from" "__future__" "import" "(" feature ["as" name]
                        ("," feature ["as" name])* [","] ")"
   feature          ::= identifier
   name             ::= identifier

A future statement must appear near the top of the module.  The only
lines that can appear before a future statement are:

* the module docstring (if any),

* comments,

* blank lines, and

* other future statements.

The features recognized by Python 3.0 are "absolute_import",
"division", "generators", "unicode_literals", "print_function",
"nested_scopes" and "with_statement".  They are all redundant because
they are always enabled, and only kept for backwards compatibility.

A future statement is recognized and treated specially at compile
time: Changes to the semantics of core constructs are often
implemented by generating different code.  It may even be the case
that a new feature introduces new incompatible syntax (such as a new
reserved word), in which case the compiler may need to parse the
module differently.  Such decisions cannot be pushed off until
runtime.

For any given release, the compiler knows which feature names have
been defined, and raises a compile-time error if a future statement
contains a feature not known to it.

The direct runtime semantics are the same as for any import statement:
there is a standard module "__future__", described later, and it will
be imported in the usual way at the time the future statement is
executed.

The interesting runtime semantics depend on the specific feature
enabled by the future statement.

Note that there is nothing special about the statement:

   import __future__ [as name]

That is not a future statement; it's an ordinary import statement with
no special semantics or syntax restrictions.

Code compiled by calls to the built-in functions "exec()" and
"compile()" that occur in a module "M" containing a future statement
will, by default, use the new syntax or semantics associated with the
future statement.  This can be controlled by optional arguments to
"compile()" --- see the documentation of that function for details.

A future statement typed at an interactive interpreter prompt will
take effect for the rest of the interpreter session.  If an
interpreter is started with the *-i* option, is passed a script name
to execute, and the script includes a future statement, it will be in
effect in the interactive session started after the script is
executed.

See also: **PEP 236** - Back to the __future__

     The original proposal for the __future__ mechanism.

Related help topics: MODULES

Learning Python 3

Learning Python 3

This will be completely code driven learning

1. Python 3 import usage
2. Python 3 help Command 
3. Python 3 Scalar Built in Types
4. Python 3 Conversion between Scalar Built in Types
5 Python 3 Relational Operators
6. Python 3 Conditional Operators
7. Python 3 While Loop
8. Python 3 Strings
9. Python 3 Collections
10. Python 3 Iterations

Python 3 Import Usage


Python 3 Import Usage

The below are some valid python import usage for which

'''Example for normal import which imports all the classes present'''
import module_name

'''Example for importing a class inside a package or module'''
from module_name import function_name

'''Example for importing with alias'''
from module_name import function_name as alias_name

id = alias_name.method.param

Tuesday 14 February 2017

Puppet 4 installation on Ubuntu 16.04 (Puppet Server and Puppet Agent)

Puppet 4 installation on Ubuntu 16.04

This post will help the reader to setup and configure puppet 4. It will not be a deep explanatory kind of post but will sure have the required stuffs to make the setup. In node 1 puppet server / puppet master is installed and configured in node 2 puppet agent is installed. Please feel free to comment if there is anything wrong so that the post can be updated based on the needs. Thanks .. :)

required additional files can be also downloaded from :

https://drive.google.com/open?id=0By7X8TzuFNHJQlFPa185cEVMajg

Setting up Puppet Server / Puppet Master (Node 1)
Puppet Server and Puppet Master both are the one and the same.

Requirements: 
server

  • 4GB RAM
  • 2 CPU Cores


The command hostname -f provides the name of the puppet server and puppet agent using which the certificates will be created by the puppet.

puppet agent communicate with the puppet server by communicating the server with the host name puppet by default.

if required add the host entry in /etc/hosts file like,
<<IP_Address>>     puppet

the IP should be reachable by the puppet agent nodes.

Installing Puppet Server 
Follow the instructions below to install the puppet server. The commands executed are made bold.

$ pwd
/home/ubuntu

$ curl -O https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13662  100 13662    0     0   4428      0  0:00:03  0:00:03 --:--:--  4428

$ sudo dpkg -i puppetlabs-release-pc1-xenial.deb
Selecting previously unselected package puppetlabs-release-pc1.
(Reading database ... 53794 files and directories currently installed.)
Preparing to unpack puppetlabs-release-pc1-xenial.deb ...
Unpacking puppetlabs-release-pc1 (1.1.0-2xenial) ...
Setting up puppetlabs-release-pc1 (1.1.0-2xenial) ...

$ sudo apt-get update
....
....
Fetched 11.2 MB in 7s (1,483 kB/s)
Reading package lists... Done


$ sudo apt-get install puppetserver
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  ca-certificates-java fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libfontconfig1
  libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libnss3-nssdb libpcsclite1 libxi6 libxrender1 libxtst6 openjdk-8-jre-headless puppet-agent x11-common
Suggested packages:
  default-jre cups-common liblcms2-utils pcscd openjdk-8-jre-jamvm libnss-mdns fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho ttf-wqy-microhei
  | ttf-wqy-zenhei fonts-indic
The following NEW packages will be installed:
  ca-certificates-java fontconfig-config fonts-dejavu-core java-common libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libfontconfig1
  libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libnss3-nssdb libpcsclite1 libxi6 libxrender1 libxtst6 openjdk-8-jre-headless puppet-agent puppetserver
  x11-common
0 upgraded, 23 newly installed, 0 to remove and 88 not upgraded.
Need to get 79.8 MB of archives.
After this operation, 246 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
.. ..
.. ..
Selecting previously unselected package libjpeg-turbo8:amd64.
(Reading database ... 53799 files and directories currently installed.)
Preparing to unpack .../libjpeg-turbo8_1.4.2-0ubuntu3_amd64.deb ...
Unpacking libjpeg-turbo8:amd64 (1.4.2-0ubuntu3) ...
Selecting previously unselected package liblcms2-2:amd64.
Preparing to unpack .../liblcms2-2_2.6-3ubuntu2_amd64.deb ...
Unpacking liblcms2-2:amd64 (2.6-3ubuntu2) ...
Selecting previously unselected package x11-common.
Preparing to unpack .../x11-common_1%3a7.7+13ubuntu3_all.deb ...
Unpacking x11-common (1:7.7+13ubuntu3) ...
Selecting previously unselected package libxtst6:amd64.
Preparing to unpack .../libxtst6_2%3a1.2.2-1_amd64.deb ...
Unpacking libxtst6:amd64 (2:1.2.2-1) ...
Selecting previously unselected package libnspr4:amd64.
Preparing to unpack .../libnspr4_2%3a4.12-0ubuntu0.16.04.1_amd64.deb ...
Unpacking libnspr4:amd64 (2:4.12-0ubuntu0.16.04.1) ...
Selecting previously unselected package libnss3-nssdb.
Preparing to unpack .../libnss3-nssdb_2%3a3.26.2-0ubuntu0.16.04.2_all.deb ...
Unpacking libnss3-nssdb (2:3.26.2-0ubuntu0.16.04.2) ...
Selecting previously unselected package libnss3:amd64.
Preparing to unpack .../libnss3_2%3a3.26.2-0ubuntu0.16.04.2_amd64.deb ...
Unpacking libnss3:amd64 (2:3.26.2-0ubuntu0.16.04.2) ...
Selecting previously unselected package ca-certificates-java.
Preparing to unpack .../ca-certificates-java_20160321_all.deb ...
Unpacking ca-certificates-java (20160321) ...
Selecting previously unselected package java-common.
Preparing to unpack .../java-common_0.56ubuntu2_all.deb ...
Unpacking java-common (0.56ubuntu2) ...
Selecting previously unselected package libavahi-common-data:amd64.
Preparing to unpack .../libavahi-common-data_0.6.32~rc+dfsg-1ubuntu2_amd64.deb ...
Unpacking libavahi-common-data:amd64 (0.6.32~rc+dfsg-1ubuntu2) ...
Selecting previously unselected package libavahi-common3:amd64.
Preparing to unpack .../libavahi-common3_0.6.32~rc+dfsg-1ubuntu2_amd64.deb ...
Unpacking libavahi-common3:amd64 (0.6.32~rc+dfsg-1ubuntu2) ...
Selecting previously unselected package libavahi-client3:amd64.
Preparing to unpack .../libavahi-client3_0.6.32~rc+dfsg-1ubuntu2_amd64.deb ...
Unpacking libavahi-client3:amd64 (0.6.32~rc+dfsg-1ubuntu2) ...
Selecting previously unselected package libcups2:amd64.
Preparing to unpack .../libcups2_2.1.3-4_amd64.deb ...
Unpacking libcups2:amd64 (2.1.3-4) ...
Selecting previously unselected package libjpeg8:amd64.
Preparing to unpack .../libjpeg8_8c-2ubuntu8_amd64.deb ...
Unpacking libjpeg8:amd64 (8c-2ubuntu8) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../fonts-dejavu-core_2.35-1_all.deb ...
Unpacking fonts-dejavu-core (2.35-1) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../fontconfig-config_2.11.94-0ubuntu1.1_all.deb ...
Unpacking fontconfig-config (2.11.94-0ubuntu1.1) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../libfontconfig1_2.11.94-0ubuntu1.1_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.11.94-0ubuntu1.1) ...
Selecting previously unselected package libpcsclite1:amd64.
Preparing to unpack .../libpcsclite1_1.8.14-1ubuntu1.16.04.1_amd64.deb ...
Unpacking libpcsclite1:amd64 (1.8.14-1ubuntu1.16.04.1) ...
Selecting previously unselected package libxi6:amd64.
Preparing to unpack .../libxi6_2%3a1.7.6-1_amd64.deb ...
Unpacking libxi6:amd64 (2:1.7.6-1) ...
Selecting previously unselected package libxrender1:amd64.
Preparing to unpack .../libxrender1_1%3a0.9.9-0ubuntu1_amd64.deb ...
Unpacking libxrender1:amd64 (1:0.9.9-0ubuntu1) ...
Selecting previously unselected package openjdk-8-jre-headless:amd64.
Preparing to unpack .../openjdk-8-jre-headless_8u121-b13-0ubuntu1.16.04.2_amd64.deb ...
Unpacking openjdk-8-jre-headless:amd64 (8u121-b13-0ubuntu1.16.04.2) ...
Selecting previously unselected package puppet-agent.
Preparing to unpack .../puppet-agent_1.9.1-1xenial_amd64.deb ...
Unpacking puppet-agent (1.9.1-1xenial) ...
Selecting previously unselected package puppetserver.
Preparing to unpack .../puppetserver_2.7.2-1puppetlabs1_all.deb ...
Unpacking puppetserver (2.7.2-1puppetlabs1) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for systemd (229-4ubuntu13) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for ca-certificates (20160104ubuntu1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Setting up libjpeg-turbo8:amd64 (1.4.2-0ubuntu3) ...
Setting up liblcms2-2:amd64 (2.6-3ubuntu2) ...
Setting up x11-common (1:7.7+13ubuntu3) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Setting up libxtst6:amd64 (2:1.2.2-1) ...
Setting up libnspr4:amd64 (2:4.12-0ubuntu0.16.04.1) ...
Setting up java-common (0.56ubuntu2) ...
Setting up libavahi-common-data:amd64 (0.6.32~rc+dfsg-1ubuntu2) ...
Setting up libavahi-common3:amd64 (0.6.32~rc+dfsg-1ubuntu2) ...
Setting up libavahi-client3:amd64 (0.6.32~rc+dfsg-1ubuntu2) ...
Setting up libcups2:amd64 (2.1.3-4) ...
Setting up libjpeg8:amd64 (8c-2ubuntu8) ...
Setting up fonts-dejavu-core (2.35-1) ...
Setting up fontconfig-config (2.11.94-0ubuntu1.1) ...
Setting up libfontconfig1:amd64 (2.11.94-0ubuntu1.1) ...
Setting up libpcsclite1:amd64 (1.8.14-1ubuntu1.16.04.1) ...
Setting up libxi6:amd64 (2:1.7.6-1) ...
Setting up libxrender1:amd64 (1:0.9.9-0ubuntu1) ...
Setting up puppet-agent (1.9.1-1xenial) ...
Created symlink from /etc/systemd/system/multi-user.target.wants/puppet.service to /lib/systemd/system/puppet.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mcollective.service to /lib/systemd/system/mcollective.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/pxp-agent.service to /lib/systemd/system/pxp-agent.service.
Removed symlink /etc/systemd/system/multi-user.target.wants/pxp-agent.service.
Setting up libnss3-nssdb (2:3.26.2-0ubuntu0.16.04.2) ...
Setting up libnss3:amd64 (2:3.26.2-0ubuntu0.16.04.2) ...
Setting up ca-certificates-java (20160321) ...
Adding debian:ACEDICOM_Root.pem
Adding debian:ACCVRAIZ1.pem
Adding debian:Equifax_Secure_Global_eBusiness_CA.pem
Adding debian:S-TRUST_Universal_Root_CA.pem
Adding debian:Starfield_Class_2_CA.pem
Adding debian:AC_Raíz_Certicámara_S.A..pem
Adding debian:Starfield_Services_Root_Certificate_Authority_-_G2.pem
Adding debian:SwissSign_Platinum_CA_-_G2.pem
Adding debian:Sonera_Class_1_Root_CA.pem
Adding debian:SwissSign_Silver_CA_-_G2.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G2.pem
Adding debian:CA_WoSign_ECC_Root.pem
Adding debian:EE_Certification_Centre_Root_CA.pem
Adding debian:GlobalSign_Root_CA_-_R3.pem
Adding debian:DigiCert_Trusted_Root_G4.pem
Adding debian:TC_TrustCenter_Class_3_CA_II.pem
Adding debian:Staat_der_Nederlanden_EV_Root_CA.pem
Adding debian:S-TRUST_Authentication_and_Encryption_Root_CA_2005_PN.pem
Adding debian:DigiCert_Assured_ID_Root_CA.pem
Adding debian:CNNIC_ROOT.pem
Adding debian:Comodo_Secure_Services_root.pem
Adding debian:QuoVadis_Root_CA_3_G3.pem
Adding debian:USERTrust_RSA_Certification_Authority.pem
Adding debian:COMODO_ECC_Certification_Authority.pem
Adding debian:WoSign_China.pem
Adding debian:Verisign_Class_1_Public_Primary_Certification_Authority_-_G2.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G4.pem
Adding debian:CA_Disig_Root_R2.pem
Adding debian:OISTE_WISeKey_Global_Root_GA_CA.pem
Adding debian:NetLock_Notary_=Class_A=_Root.pem
Adding debian:Starfield_Root_Certificate_Authority_-_G2.pem
Adding debian:TÜRKTRUST_Elektronik_Sertifika_Hizmet_Sağlayıcısı_H5.pem
Adding debian:Certification_Authority_of_WoSign_G2.pem
Adding debian:COMODO_Certification_Authority.pem
Adding debian:Certum_Trusted_Network_CA.pem
Adding debian:Deutsche_Telekom_Root_CA_2.pem
Adding debian:Izenpe.com.pem
Adding debian:Go_Daddy_Root_Certificate_Authority_-_G2.pem
Adding debian:Equifax_Secure_CA.pem
Adding debian:Atos_TrustedRoot_2011.pem
Adding debian:Entrust_Root_Certification_Authority_-_EC1.pem
Adding debian:Hongkong_Post_Root_CA_1.pem
Adding debian:DST_Root_CA_X3.pem
Adding debian:thawte_Primary_Root_CA_-_G3.pem
Adding debian:VeriSign_Class_3_Public_Primary_Certification_Authority_-_G5.pem
Adding debian:E-Tugra_Certification_Authority.pem
Adding debian:QuoVadis_Root_CA.pem
Adding debian:TeliaSonera_Root_CA_v1.pem
Adding debian:Certinomis_-_Autorité_Racine.pem
Adding debian:AddTrust_External_Root.pem
Adding debian:ePKI_Root_Certification_Authority.pem
Adding debian:USERTrust_ECC_Certification_Authority.pem
Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority.pem
Adding debian:StartCom_Certification_Authority_2.pem
Adding debian:Cybertrust_Global_Root.pem
Adding debian:CFCA_EV_ROOT.pem
Adding debian:Entrust_Root_Certification_Authority_-_G2.pem
Adding debian:QuoVadis_Root_CA_2_G3.pem
Adding debian:Go_Daddy_Class_2_CA.pem
Adding debian:Entrust.net_Premium_2048_Secure_Server_CA.pem
Adding debian:AffirmTrust_Commercial.pem
Adding debian:TURKTRUST_Certificate_Services_Provider_Root_2007.pem
Adding debian:Swisscom_Root_CA_1.pem
Adding debian:GlobalSign_Root_CA.pem
Adding debian:Secure_Global_CA.pem
Adding debian:AddTrust_Low-Value_Services_Root.pem
Adding debian:Baltimore_CyberTrust_Root.pem
Adding debian:Certinomis_-_Root_CA.pem
Adding debian:CA_Disig.pem
Adding debian:Staat_der_Nederlanden_Root_CA.pem
Adding debian:ComSign_CA.pem
Adding debian:GeoTrust_Universal_CA.pem
Adding debian:T-TeleSec_GlobalRoot_Class_2.pem
Adding debian:PSCProcert.pem
Adding debian:T-TeleSec_GlobalRoot_Class_3.pem
Adding debian:certSIGN_ROOT_CA.pem
Adding debian:SecureSign_RootCA11.pem
Adding debian:Autoridad_de_Certificacion_Firmaprofesional_CIF_A62634068.pem
Adding debian:Security_Communication_RootCA2.pem
Adding debian:QuoVadis_Root_CA_3.pem
Adding debian:Verisign_Class_1_Public_Primary_Certification_Authority_-_G3.pem
Adding debian:EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
Adding debian:OISTE_WISeKey_Global_Root_GB_CA.pem
Adding debian:StartCom_Certification_Authority.pem
Adding debian:Security_Communication_Root_CA.pem
Adding debian:Equifax_Secure_eBusiness_CA_1.pem
Adding debian:Security_Communication_EV_RootCA1.pem
Adding debian:Comodo_Trusted_Services_root.pem
Adding debian:TWCA_Root_Certification_Authority.pem
Adding debian:UTN_USERFirst_Email_Root_CA.pem
Adding debian:IdenTrust_Commercial_Root_CA_1.pem
Adding debian:Certigna.pem
Adding debian:Global_Chambersign_Root_-_2008.pem
Adding debian:DigiCert_Assured_ID_Root_G3.pem
Adding debian:XRamp_Global_CA_Root.pem
Adding debian:Verisign_Class_1_Public_Primary_Certification_Authority.pem
Adding debian:DigiCert_Global_Root_G2.pem
Adding debian:GlobalSign_Root_CA_-_R2.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_EV_2009.pem
Adding debian:Certplus_Class_2_Primary_CA.pem
Adding debian:Microsec_e-Szigno_Root_CA.pem
Adding debian:Taiwan_GRCA.pem
Adding debian:DST_ACES_CA_X6.pem
Adding debian:NetLock_Express_=Class_C=_Root.pem
Adding debian:AffirmTrust_Premium_ECC.pem
Adding debian:Actalis_Authentication_Root_CA.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G2.pem
Adding debian:Microsec_e-Szigno_Root_CA_2009.pem
Adding debian:Camerfirma_Chambers_of_Commerce_Root.pem
Adding debian:Juur-SK.pem
Adding debian:Certum_Root_CA.pem
Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority_-_G2.pem
Adding debian:CA_Disig_Root_R1.pem
Adding debian:QuoVadis_Root_CA_2.pem
Adding debian:QuoVadis_Root_CA_1_G3.pem
Adding debian:Swisscom_Root_CA_2.pem
Adding debian:TWCA_Global_Root_CA.pem
Adding debian:GeoTrust_Primary_Certification_Authority_-_G3.pem
Adding debian:GeoTrust_Global_CA.pem
Adding debian:Visa_eCommerce_Root.pem
Adding debian:TÜRKTRUST_Elektronik_Sertifika_Hizmet_Sağlayıcısı_H6.pem
Adding debian:NetLock_Arany_=Class_Gold=_Főtanúsítvány.pem
Adding debian:Sonera_Class_2_Root_CA.pem
Adding debian:EC-ACC.pem
Adding debian:WoSign.pem
Adding debian:DigiCert_Global_Root_CA.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R4.pem
Adding debian:AddTrust_Qualified_Certificates_Root.pem
Adding debian:D-TRUST_Root_Class_3_CA_2_2009.pem
Adding debian:Swisscom_Root_EV_CA_2.pem
Adding debian:Root_CA_Generalitat_Valenciana.pem
Adding debian:DigiCert_High_Assurance_EV_Root_CA.pem
Adding debian:SecureTrust_CA.pem
Adding debian:AffirmTrust_Premium.pem
Adding debian:China_Internet_Network_Information_Center_EV_Certificates_Root.pem
Adding debian:Comodo_AAA_Services_root.pem
Adding debian:SwissSign_Gold_CA_-_G2.pem
Adding debian:COMODO_RSA_Certification_Authority.pem
Adding debian:ApplicationCA_-_Japanese_Government.pem
Adding debian:GeoTrust_Global_CA_2.pem
Adding debian:GeoTrust_Primary_Certification_Authority.pem
Adding debian:WellsSecure_Public_Root_Certificate_Authority.pem
Adding debian:Camerfirma_Global_Chambersign_Root.pem
Adding debian:TÜBİTAK_UEKAE_Kök_Sertifika_Hizmet_Sağlayıcısı_-_Sürüm_3.pem
Adding debian:NetLock_Qualified_=Class_QA=_Root.pem
Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority_2.pem
Adding debian:DigiCert_Assured_ID_Root_G2.pem
Adding debian:IGC_A.pem
Adding debian:Trustis_FPS_Root_CA.pem
Adding debian:Verisign_Class_2_Public_Primary_Certification_Authority_-_G2.pem
Adding debian:UTN_USERFirst_Hardware_Root_CA.pem
Adding debian:Staat_der_Nederlanden_Root_CA_-_G3.pem
Adding debian:Buypass_Class_2_CA_1.pem
Adding debian:Chambers_of_Commerce_Root_-_2008.pem
Adding debian:GeoTrust_Universal_CA_2.pem
Adding debian:Buypass_Class_3_Root_CA.pem
Adding debian:Verisign_Class_2_Public_Primary_Certification_Authority_-_G3.pem
Adding debian:Hellenic_Academic_and_Research_Institutions_RootCA_2011.pem
Adding debian:Verisign_Class_3_Public_Primary_Certification_Authority_-_G3.pem
Adding debian:AffirmTrust_Networking.pem
Adding debian:StartCom_Certification_Authority_G2.pem
Adding debian:thawte_Primary_Root_CA.pem
Adding debian:RSA_Security_2048_v3.pem
Adding debian:NetLock_Business_=Class_B=_Root.pem
Adding debian:GlobalSign_ECC_Root_CA_-_R5.pem
Adding debian:AddTrust_Public_Services_Root.pem
Adding debian:DigiCert_Global_Root_G3.pem
Adding debian:Buypass_Class_2_Root_CA.pem
Adding debian:VeriSign_Universal_Root_Certification_Authority.pem
Adding debian:thawte_Primary_Root_CA_-_G2.pem
Adding debian:IdenTrust_Public_Sector_Root_CA_1.pem
Adding debian:Entrust_Root_Certification_Authority.pem
Adding debian:Network_Solutions_Certificate_Authority.pem
done.
Processing triggers for ca-certificates (20160104ubuntu1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
Setting up openjdk-8-jre-headless:amd64 (8u121-b13-0ubuntu1.16.04.2) ...
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmid to provide /usr/bin/rmid (rmid) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/keytool to provide /usr/bin/keytool (keytool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/jjs to provide /usr/bin/jjs (jjs) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/pack200 to provide /usr/bin/pack200 (pack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/rmiregistry to provide /usr/bin/rmiregistry (rmiregistry) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/unpack200 to provide /usr/bin/unpack200 (unpack200) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/orbd to provide /usr/bin/orbd (orbd) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/servertool to provide /usr/bin/servertool (servertool) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/tnameserv to provide /usr/bin/tnameserv (tnameserv) in auto mode
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/jexec to provide /usr/bin/jexec (jexec) in auto mode
Setting up puppetserver (2.7.2-1puppetlabs1) ...
usermod: no changes
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Processing triggers for systemd (229-4ubuntu13) ...
Processing triggers for ureadahead (0.100.0-19) ...


If required change the memory parameters by opening the file using 

$ sudo nano /etc/default/puppetserver

Line to be modified ,
JAVA_ARGS="-Xms2g -Xmx2g -XX:MaxPermSize=256m"
to provide memeory upto 3GB the above line has to be changes as
JAVA_ARGS="-Xms3g -Xmx3g -XX:MaxPermSize=256m"

If firewall rules are enabled open firewall for 8140 port so that the puppet server communicates with the puppet agent,

$ sudo ufw allow 8140
Rules updated
Rules updated (v6)

Configuring puppet server to accept puppet agents 

sudo vim  /etc/puppetlabs/puppet/puppet.conf

cat /etc/puppetlabs/puppet/puppet.conf
# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://docs.puppetlabs.com/puppet/latest/reference/config_important_settings.html
# - https://docs.puppetlabs.com/puppet/latest/reference/config_about_settings.html
# - https://docs.puppetlabs.com/puppet/latest/reference/config_file_main.html
# - https://docs.puppetlabs.com/puppet/latest/reference/configuration.html
[master]
vardir = /opt/puppetlabs/server/data/puppetserver
logdir = /var/log/puppetlabs/puppetserver
rundir = /var/run/puppetlabs/puppetserver
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
codedir = /etc/puppetlabs/code
autosign = /etc/puppetlabs/puppet/autosign.conf

sudo vim /etc/puppetlabs/puppet/autosign.conf

cat /etc/puppetlabs/puppet/autosign.conf
*

# * denotes any node thats requests for certificate is provided with certificate


After all these configuration start the puppet server using the command given below,

$ sudo systemctl start puppetserver

$ sudo systemctl status puppetserver
● puppetserver.service - puppetserver Service
   Loaded: loaded (/lib/systemd/system/puppetserver.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-02-14 20:17:41 UTC; 43s ago
  Process: 15336 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserver start (code=exited, status=0/SUCCESS)
 Main PID: 15348 (java)
    Tasks: 28
   Memory: 1.0G
      CPU: 1min 8.222s
   CGroup: /system.slice/puppetserver.service
           └─15348 /usr/bin/java -Xms2g -Xmx2g -XX:MaxPermSize=256m -Djava.security.egd=/dev/urandom -XX:OnOutOfMemoryError=kill -9 %p -cp /opt/puppetlabs/serv

Feb 14 20:16:58 goku systemd[1]: Starting puppetserver Service...
Feb 14 20:16:58 goku puppetserver[15336]: OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Feb 14 20:17:41 goku systemd[1]: Started puppetserver Service.
lines 1-14/14 (END)

Configure service to run on boot,

$ sudo systemctl enable puppetserver
Synchronizing state of puppetserver.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable puppetserver


Enabling puppet commands involves the following steps, 

$ sudo nano /etc/environment
$ cat /etc/environment
PATH="/opt/puppetlabs/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
$ source /etc/environment

check the installation and configuration by checking the puppet version and puppet server version.

$ puppet --version
4.9.2

$ puppetserver --version
puppetserver version: 2.7.2

Before adding client in puppet server execute the following command,
$ puppet cert list
Notice: Signed certificate request for ca



Installing Puppet Agent (Node 2)

Requirements: 
Agent requirements atleast minimum,

  • 2GB RAM
  • 1 CPU Cores

Follow the below commands to install and configure puppet agent,

$ pwd
/home/ubuntu

$ wget https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
--2017-02-14 20:48:27--  https://apt.puppetlabs.com/puppetlabs-release-pc1-xenial.deb
Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 192.155.89.90, 2600:3c03::f03c:91ff:fedb:6b1d
Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|192.155.89.90|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13662 (13K) [application/x-debian-package]
Saving to: ‘puppetlabs-release-pc1-xenial.deb’

puppetlabs-release-pc1-xenial.deb       100%[==============================================================================>]  13.34K  --.-KB/s    in 0s

2017-02-14 20:48:29 (170 MB/s) - ‘puppetlabs-release-pc1-xenial.deb’ saved [13662/13662]

$ sudo dpkg -i puppetlabs-release-pc1-xenial.deb
Selecting previously unselected package puppetlabs-release-pc1.
(Reading database ... 53794 files and directories currently installed.)
Preparing to unpack puppetlabs-release-pc1-xenial.deb ...
Unpacking puppetlabs-release-pc1 (1.1.0-2xenial) ...
Setting up puppetlabs-release-pc1 (1.1.0-2xenial) ...

$ sudo apt-get update
.. ..
.. ..
Fetched 11.2 MB in 5s (1,936 kB/s)
Reading package lists... Done

$ sudo apt-get install puppet-agent
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  puppet-agent
0 upgraded, 1 newly installed, 0 to remove and 88 not upgraded.
Need to get 15.5 MB of archives.
After this operation, 92.2 MB of additional disk space will be used.
Get:1 http://apt.puppetlabs.com xenial/PC1 amd64 puppet-agent amd64 1.9.1-1xenial [15.5 MB]
Fetched 15.5 MB in 8s (1,728 kB/s)
Selecting previously unselected package puppet-agent.
(Reading database ... 53799 files and directories currently installed.)
Preparing to unpack .../puppet-agent_1.9.1-1xenial_amd64.deb ...
Unpacking puppet-agent (1.9.1-1xenial) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
Setting up puppet-agent (1.9.1-1xenial) ...
Created symlink from /etc/systemd/system/multi-user.target.wants/puppet.service to /lib/systemd/system/puppet.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mcollective.service to /lib/systemd/system/mcollective.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/pxp-agent.service to /lib/systemd/system/pxp-agent.service.
Removed symlink /etc/systemd/system/multi-user.target.wants/pxp-agent.service.
Processing triggers for libc-bin (2.23-0ubuntu5) ...

$ sudo vim /etc/puppetlabs/puppet/puppet.conf
$ cat /etc/puppetlabs/puppet/puppet.conf
# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://docs.puppetlabs.com/puppet/latest/reference/config_important_settings.html
# - https://docs.puppetlabs.com/puppet/latest/reference/config_about_settings.html
# - https://docs.puppetlabs.com/puppet/latest/reference/config_file_main.html
# - https://docs.puppetlabs.com/puppet/latest/reference/configuration.html
[main]
certname = <<puppet agent fqdn>>
server = <<puppet server fqdn>>
environment = production
runinterval = 1h


$ sudo systemctl start puppet

$ sudo systemctl enable puppet

$ sudo systemctl status  puppet
● puppet.service - Puppet agent
   Loaded: loaded (/lib/systemd/system/puppet.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-02-14 21:06:24 UTC; 10s ago
 Main PID: 2041 (puppet)
    Tasks: 2
   Memory: 56.9M
      CPU: 2.067s
   CGroup: /system.slice/puppet.service
           └─2041 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs/puppet/bin/puppet agent --no-daemonize

Feb 14 21:06:24 agent systemd[1]: Started Puppet agent.
Feb 14 21:06:26 agent puppet-agent[2041]: Starting Puppet client version 4.9.2
Feb 14 21:06:27 agent puppet-agent[2062]: Applied catalog in 0.01 seconds


Test the puppet server agent setup using the following command,

$ puppet agent -t --server <<puppet-server-fqdn>>
Info: Creating a new SSL key for <<puppet-agent-fqdn>>
Info: csr_attributes file loading from /home/ubuntu/.puppetlabs/etc/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for <<puppet-agent-fqdn>>
Info: Certificate Request fingerprint (SHA256): XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX
Info: Caching certificate for <<puppet-agent-fqdn>>
Info: Caching certificate_revocation_list for ca
Info: Caching certificate for <<puppet-agent-fqdn>>
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Notice: /File[/home/ubuntu/.puppetlabs/opt/puppet/cache/facts.d]/mode: mode changed '0775' to '0755'
Info: Retrieving plugin
Info: Caching catalog for <<puppet-agent-fqdn>>
Info: Applying configuration version '1487106815'
Info: Creating state file /home/ubuntu/.puppetlabs/opt/puppet/cache/state/state.yaml
Notice: Applied catalog in 0.01 seconds



Trouble Shooting Errors 

Error: Could not request certificate: The certificate retrieved from the master does not match the agent's private key.

To fix this, remove the certificate from both the master and the agent and then start a puppet run, which will automatically regenerate a certificate.
On the master:  execute in sudo user as well sometimes it will be available there
  puppet cert clean <<puppet-agent-fqdn>>
On the agent:
  1a. On most platforms: find /home/ubuntu/.puppetlabs/etc/puppet/ssl -name <<puppet-agent-fqdn>>.pem -delete
  1b. On Windows: del "\home\ubuntu\.puppetlabs\etc\puppet\ssl\certs\<<puppet-agent-fqdn>>.pem" /f
  2. puppet agent -t