This is a big job. Since you are asking in this forum, the best advice is to get a manual at the auto parts store, like a Haynes manual. Look up the procedure and see if it is something that you want to tackle.
Besides the equipment necessary to remove the hub from the vehicle, you will need a press and appropriate fixturing to remove and replace the bearing. Not a job for a novice.
The 2002 Subaru Forester has a 8 ft. 3.4 in. (99.4 in.) wheel base.
The 2012 Subaru Forester has a 8 ft. 7 in. (103 in.) wheel base.
The 2009 Subaru Forester has a 8 ft. 7 in. (103 in.) wheel base.
The 2003 Subaru Forester has a 8 ft. 3.4 in. (99.4 in.) wheel base.
The 2006 Subaru Forester has a 8 ft. 3.4 in. (99.4 in.) wheel base.
The 2004 Subaru Forester has a 8 ft. 3.4 in. (99.4 in.) wheel base.
The 2001 Subaru Forester has a 8 ft. 3.4 in. (99.4 in.) wheel base.
The 2011 Subaru Forester has a 8 ft. 7 in. (103 in.) wheel base.
The 2005 Subaru Forester has a 8 ft. 3.4 in. (99.4 in.) wheel base.
The 2013 Subaru Forester has a 8 ft. 7 in. (103 in.) wheel base.
The 2014 Subaru Forester has a 8 ft. 7.9 in. (103.9 in.) wheel base.
The 2007 Subaru Forester has a 8 ft. 3.4 in. (99.4 in.) wheel base.