How to upgrade an N2WS server from Ubuntu 18 to Ubuntu 18 Pro

How to upgrade an N2WS server from Ubuntu 18 to Ubuntu 18 Pro

Before starting, make sure you know how to redeploy the server in case of issues during OS upgrade. In addition, Linux knowledge is Required.
There are additional costs charged by AWS when using Ubuntu Pro, see this link for pricing details.

Warning: Do not cut and paste commands out of this KB article as it will cause the procedure to fail and you will need to rebuild the CPM instance.

Steps:
1. Take backup of the cpmdata volume and read all the steps before starting.

2. Connect to N2WS server over SSH (user is cpmuser)


3. Switch to root user
sudo su -


4. Switch to SSL directory: 
cd /usr/local/ssl/


5. Check if certs directory exists
ls -laR |grep certs


6. Remove existing certs directory: 
rmdir certs


7. Create a soft link to the system certs directory:
ln -s /etc/ssl/certs certs


8. Verify that new certs directory exist:
ls -laR | grep certs
NOTE: Please accept all defaults when prompted, failure to do so may cause failures that will require you to redeploy the instance.

9. Update ubuntu:  
apt update

You should see a message similar to this if successful.


10 .Upgrade ubuntu:
apt upgrade


11. If upgrade fails due to an error /var/lib/dpkg/lock-frontend, find out which process is holding the lock-frontend
             sudo lsof /var/lib/dpkg/lock-frontend

      If the COMMAND column returns something, you may either kill the process and then remove the lock file or wait till it finish.
      You can see the process id under the PID column. Use this PID to kill the process. for example
            sudo kill -9 PID
            sudo rm /var/lib/dpkg/lock-frontend

      then Repeat update/upgrade command (Step 9 & 10)

12. Install pro client tool:  
apt install ubuntu-advantage-tools



13. Read the Ubuntu article on how to convert license to Pro: How to upgrade Ubuntu LTS to Ubuntu Pro on AWS using AWS License Manager
      Below Steps are based on the article, they are here to help but not to replace the Ubuntu Article.

14. Go to the AWS Systems Manager and verify that the SMS agent from the CPM instance is listed in AWS Fleet Manager as a managed node. 

If the CPM instance is not listed as a managed node then it may be necessary to restart the CPM instance or restart the ssm agent by running this command. 
sudo snap restart amazon-ssm-agent 

 15. Before continuing you must stop the CPM instance in the AWS ec2 console . Select CPM instance and right click on it and select "stop instance".


16.Confirm the stoppage of the instance

 
17. Confirm the instance is totally stopped.


18. Please go to AWS License Manager and click on the Create license type conversion button. 
19. Select the source operating system, Ubuntu LTS and select the CPM instance in the available instances section, then click Next.

20. Make sure that in the Specify license type destination field that it has Ubuntu Pro selected and click the Next button.


21. Review and confirm the settings for the license conversion and click the Convert button.


22. You should get a notification that the conversion was successful. The CPM instance should also show up in the License Type conversion section and show Success.


23. Start the CPM instance in the AWS ec2 Console.


24. ssh into the CPM instance using the login cpmuser and then run the command
pro status  
You should see the following enabled.