I have been told to not use sudo so that the package concerned get installed locally by a regular user.
How do I do that, given that I get the following:
apt-get install elasticsearch
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Whoever told you that this was possible was mistaken. Installing software on Ubuntu (or any Debian derivative) requires root rights. The prepackaged software can only be installed as root.
It may be possible to manually compile and install the software though.