Murder is not the same as killing. Murder is unjust killing.
Obviously, God commanded Joshua to kill all of the Canaanites. In this case, not killing would have been disobedience to God. Not killing, therefore, would have been sin.
Killing in obedience to God’s command is a good thing in the sight of God. So, when Joshua and the Israelites killed Canaanites in obedience to the Word of God, it was a good thing and it glorified God. It was the right thing to do.
Obviously, the God of the Old Testament is the same as the God of the New Testament. In other words, it was Jesus Christ who commanded genocidal killing of the Canaanites.
That is who God is.
It is in keeping with the nature of this God of the Bible that God could kill everyone in Sodom and Gomorrah (gay and not gay) because of homosexuality. It is this God who killed Israelites who bowed to the Golden Calf. And it is this very God of the Bible who commanded genocidal war for believers.
Killing glorifies God when God commands it. That was the case with Joshua and ancient Israelites, and it is the case until the Second Coming of Jesus Christ.