(This guide assumes you are using Linux, and have installed the TexLive distribution of LaTeX.)
ApJ requires that LaTeX submissions are formatted a particular way. To this end, there are some LaTeX add-ons available so that you don't have to do the formatting “by hand”. Unfortunately, these add-ons aren't necessarily provided with the TexLive LaTeX distribution, so you'll need to download and install them yourself.
The name of the package to find is
AASTeX, and everything you need can be found on the AASTeX website, including full documentation. Instructions on how to install LaTeX packages can be found on this Wikibooks page. Alternatively, you can simply put the LaTeX class and style files (.cls, .bst) in the same directory as your LaTeX project.
It is also likely that your Linux distribution maintains a software package that includes AASTeX (and other dependents). For example, Arch Linux users can install the package
To test that you have installed the packages correctly, download and compile this example LaTeX document (and accompanying figure files). To compile a LaTeX document with a bibliography from the command line and produce PDF output, it is usually necessary to run the following set of commands (running multiple times ensures that all the references and labels are numbered correctly):
pdflatex example.tex bibtex example pdflatex example.tex pdflatex example.tex
Or, better yet, do it all in one shot:
pdflatex example.tex && bibtex example && pdflatex example.tex && pdflatex example.tex