I've been looking everywhere for a step-by-step explanation for how to set up the following on an EC2 instance. For a new user I want things to be clean and correct but all of the 'guides' have different information and are really confusing.
My first thought is that I need to do the following
Things that are unclear:
sudo pip package_name
enough?I assume you may be unfamiliar with EC2, so I suggest going through this FAQ before continuing with deploying an EC2 instance to run your Python2.7 application.
Anyway, now that you are somewhat more familiar with that, here's how I normally deploy a one-off instance through the EC2 web-interface in brief:
sudo
is a *nix command)My recommendation is rather than spending money (unless you are eligible for the free tier) on running an EC2 instance to learn all this, I suggest downloading VirtualBox or VMWare Player and play and learn with a locally running Linux image on your machine.
Now for your unclear bits: They are not much different than normal environments.
yum
is a package management system built on top of RPM
, or RedHat Package Manager. If you use other distributions they may have different package managers. For instance, other common server distributions like Debian and Ubuntu they will have aptitude
or apt-get
, ArchLinux will have pacman
.
Also, in general you can just rely on the distro's python packages which you can just install using [sudo] yum install python27
or [sudo] apt-get install python-2.7
, depending on the Linux distribution that is being used.
.bashrc
controls settings for your running shell, generally it won't do anything for your server processes. So no, you may safely leave that alone if you are following best practices for working with Python (which will follow).
Best practices generally is to have localized environments using virtualenv
and not install Python packages on the system level.
sudo
is for tasks that require system level (root) privileges. You generally want to avoid using sudo
unless necessary (such as installing system level packages).
No, virtualenv
should take care of that for you. Since 1.4.1 it distributes its own version of pip
and it will be installed from there.
So, what you seem to be missing is experience with running Python in a virtualenv. There are good instructions on the package's website that you might want to familiarize yourself with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With