How do I add ancient Greek accents in Ubuntu?

See if this helps: How to type Greek, Greek Polytonic in Linux

Excerpt:

Result                Key combination                      Works for…
Tonos/Acute ΄         Dead key (;) + vowel                 All vowels: ά έ ή ί ύ ό ώ
Dialytika ¨           Dead key (:) + vowel                 These vowels: ϊ ϋ
Dialytika with Tonos  Dead key (;) + Dead key (:) + vowel  These vowels: ΐ ΰ
Dialytika with Tonos  Dead key (:) + Dead key (;) + vowel  These vowels ΐ ΰ
Περισπωμένη ῀         AltGr + Dead key ([) + vowel         ᾶ ῆ ῖ ῦ ῶ
Υπογεγραμμένη         AltGr + Dead key (]) + vowel         ᾳ ῃ ῳ
Ψιλή ᾿                AltGr+ Dead key (:) + vowel or       ἀ ἐ ἠ ἰ ὐ ὀ ὠ ῤ
                      the letter ρ
Δασεία ῾              AltGr+ Dead key (”) + vowel or       ἁ ἑ ἡ ἱ ὑ ὁ ὡ ῥ
                      the letter ρ
Βαρεία `              AltGr+ Dead key (’) + vowel          ὰ ὲ ὴ ὶ ὺ ὸ ὼ
Μακρόν ¯              AltGr+ Dead key ({) + vowel          ᾱ ῑ ῡ
Βραχύ ˘               AltGr+ Dead key (}) + vowel          ᾰ ῐ ῠ

If you use the "Ubuntu" font, then you get a circumflex from the [ key on the Greek polytonic keyboard. If you use other fonts, then you get a tilde above the vowel in stead.