I followed below steps
Preparation
During upgrade process influxdb will make backup copy of existing 1.x db into the home folder of the user account from where the upgrade command is run.
backup copy can be found under .influxdb
command : ls -a ~
check if you have sufficient disk spack to hold both backup copy and upgrade copy of DB, for that use below command to check the size of existing [influxdb 1.x] size.
command: du -hs /var/lib/influxdb/
considering 1.x db data is in default location. else adjust the path in above command accordingly.
Once you verified that enough disk space is available, move to next step.
Upgrading
stop influxdb service
command : sudo systemctl stop influxdb.service
update repository list
command : sudo apt update
install influxdb2
command : sudo apt install influxdb2
upgrade 1.x dbs to 2.x [influxdb comes with a script to upgrade existing 1.x db’s to 2.x dbs]
command : /usr/share/influxdb/influxdb2-upgrade.sh
let the command run, during starting it will ask for
admin user name
admin user password
org
default bucket
once that required data is given, upgrade will be done.