Yes, install both server and agent on same node. Be careful with trying to do too many components/services on a single node with small ram/cores. If you try to run/install all of them you will have troubles getting cluster stable. Minimal install is like Hdfs, Yarn, MapReduce, AmbariMetrics, Zookeeper, Hive/Tez, Ranger.