You'll need a work permit to legally work in Egypt. Normally the employer will do most of the paperwork for this. As you mentioned, you'll also need a residence permit. Your employer can probably give you advice on how to apply for this, too. You can also try getting in touch with the Egyptian Ministry of Foreign Affairs, as they should be able to tell you how to apply. For more info, see our pages on Work Permits for Egypt and Visas for Egypt.