The possibility to customize your environments is indeed one of the key characteristics of AWS Elastic Beanstalk in comparison to other PaaS offerings:
Most existing application containers or platform-as-a-service
solutions, while reducing the amount of programming required,
significantly diminish developers' flexibility and control. [...] However, with Elastic
Beanstalk, you retain full control over the AWS resources powering
your application. If you decide you want to take over some (or all) of
the elements of their infrastructure, you can do so seamlessly [...]
What you are looking for is possible by facilitating a Custom AMI. Once you have launched an environment, you can customize its configuration details, amongst those the AMI used by your instances as illustrated in Configuring Servers. While there are some requirements to be met in order to properly execute within Beanstalk, you can basically customize these AMIs to your heart's content, the process is documented in Using Custom AMIs (for a 3rd party explanation see e.g. How to customize an Amazon Elastic Beanstalk instance).
Please be aware of the following implication though:
After you are running on your own custom AMI, you will no longer
receive any automated updates to the operating system, software stack,
or the AWS Elastic Beanstalk host manager.
This means you will need to track the evolution of the AWS AMIs yourself to ensure stability and security of your application - this isn't as easy as it should be currently, as discussed e.g. in Amazon AMI product lifecycle questions and more recently Keeping up with the AWS Developers (Latest AMI's).