[Solved] Cannot install Java 8 on Ubuntu

When you run this command

add-apt-repository ppa:webupd8team/y-ppa-manager
Cannot add PPA: 'ppa:webupd8team/y-ppa-manager'.
Please check that the PPA name or format is correct.

I also research a lot to solve this problems, such as reinstall ca-certificates,… but nothing work

I find out a solution:

1) Manual add ppa to /etc/apt/sources.list by run 2 commands

Copy commands base on your Ubuntu version

Ubuntu 14.04

sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list
sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list

Ubuntu 16.04

sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" >> /etc/apt/sources.list
sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" >> /etc/apt/sources.list

Ubuntu 16.10

sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu yakkety main" >> /etc/apt/sources.list
sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu yakkety main" >> /etc/apt/sources.list

Ubuntu 17.04

sudo echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu zesty main" >> /etc/apt/sources.list
sudo echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu zesty main" >> /etc/apt/sources.list

2) Add public key of host ppa.launchpad.net to system

Run 2 commands:

gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv C2518248EEA14886
gpg --export --armor C2518248EEA14886 | sudo apt-key add -

3) Update and install java 8

sudo apt-get update
sudo apt-get install oracle-java8-installer

4) Done