Linear and nonlinear electromagnetic and electrostatic instabilities in a plasma with two ion beams