If you are not European, probably you need a Visa to stay in Portugal . When you arrive to Portugal and go directly to your residence/stay with a friend, remember that you have three working days to make an appointment at the local Immigration Bureau. In Portugal, the Immigration Bureau is called "Serviço de Estrangeiros e Fronteiras" (literally Immigration and Borders Service). In Aveiro they are located at "Loja do Cidadão" - check here the location. To make an appointment, you can submit an online form. Also the working schedules are available online.