The 63-year-old German joins from Lokomotiv Moscow, where he was manager of sports and development.
At the end of the season Rangnick, whose appointment is subject to work visa requirements, will take on a consultancy role at Old Trafford for a further two years.
He takes over from first-team coach Michael Carrick, who has been in caretaker charge for two games since Solskjaer was sacked just over a week ago following a terrible run of results for the 20-time English champions.
"He was our number one candidate for interim manager, reflecting the invaluable leadership and technical skills he will bring from almost four decades of experience in management and coaching," said United football director John Murtough.
The former RB Leipzig boss said he was excited to be joining United and focused on making it a successful season for the struggling club.
"The squad is full of talent and has a great balance of youth and experience," he said. "All my efforts for the next six months will be on helping these players fulfil their potential, both individually and, most importantly, as a team.
"Beyond that, I look forward to supporting the club longer-term goals on a consultancy basis."
United are eighth in the Premier League table after a 1-1 draw with leaders Chelsea on Sunday, five points off the top four.
First-team coach Carrick -- who has overseen a Champions League win over Villarreal and the draw at Stamford Bridge, where he dropped Cristiano Ronaldo -- will remain in caretaker charge until Rangnick's work visa is finalised.
Club bosses sacked Solskjaer last week after a 4-1 humbling at lowly Watford despite keeping faith with the Norwegian after humiliating home losses to rivals Liverpool and Manchester City.
Solskjaer, who scoring the winning goal for United in the 1999 Champions League final to complete a historic treble, was in charge for nearly three years.
Under his leadership United finished in the Premier League top four in back-to-back seasons for the first time since Alex Ferguson retired as boss in 2013 but they failed to win their first silverware since 2017.
United can boast abundant riches in attack, with Ronaldo, Edinson Cavani, Marcus Rashford, Sancho, Marcus Greenwood and Anthony Martial all vying for starting spots.
But their leaky defence has already conceded 22 goals in 13 games, more than four times Chelsea's total of five.
Rangnick could take charge of United for the first time against Arsenal on Thursday if his work permit issues are sorted out quickly.
Former United defender Gary Neville tweeted: "Welcome to the Greatest Football Club in the World Ralf Rangnick.
"A contract for 6 months to coach the team. A contract for 2 years to coach the club."
Standout matches today