Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:2:21

O mankind, worship your Lord, who created you and those before you, that you may become righteous -  

O people, of Mecca, worship, profess the oneness of, your Lord Who created you, made you when you were nothing, and created those that were before you; so that you may be fearful, of His punishment by worshipping Him (la‘alla, ‘so that’, is essentially an optative, but when spoken by God it denotes an affirmative),
القرآن:٢:٢١

يَا أَيُّهَا النَّاسُ اعْبُدُوا رَبَّكُمُ الَّذِي خَلَقَكُمْ وَالَّذِينَ مِنْ قَبْلِكُمْ لَعَلَّكُمْ تَتَّقُونَ  

{يا أيُّها الناس} أي أهل مكة {اعبدوا} وحِّدوا {ربَّكم الذي خلقكم} أنشأكم ولم تكونوا شيئاً {و} خلق {الذين من قبلكم لعلكم تتقون} بعبادته عقابَه، ولعل: في الأصل للترجي، وفي كلامه تعالى للتحقيق.