Home > AI > Server > Bluehost >

Introducing the BlueHost VPS service

Spent one day in introducing BlueHost VPS.

  1. Subscription to the service (done)
  2. Migration of cowpte.com (done)
  3. Install cPanel (done)
  4. Change root password (done)
  5. Check root access on terminal (done)
  6. Install MongoDB (done)
  7. Install OpenJDK (done)
  8. Enable Firewall and open ports (done)
  9. Config SSL (done)
  10. Upload MongoDB Data & change password (done)
  11. Upload MySQL Data & change password (done)
  12. Upload SpringBoot codebase and files (done)
  13. Enable SpringBoot (done)

Migration of cowpte.com

Initially, cowpte.com was linked to GoDaddy’s VPS. Due to its instability, we have now reconnected cowpte.com to Bluehost’s VPS since SpringBoot backend domain is cowpte.com

Subsequently, I discovered that the connection was not established. The Bluehost specialist registered a customized name server and I am currently awaiting its recognition across the Internet within 72 hours.

However, cowpte.com remains inaccessible. Upon checking the name server settings, I discovered that the IP address for the A record was incorrect. I modified it to match the VPS address.

Regarding SSL, upon reviewing WHM's SSL/TLS settings, I noticed that only a Self-Signed SSL certificate was available. Consequently, I removed it and proceeded to the Manage AutoSSL section, where I change the provider to Let’s Encrypt.

Following these adjustments, I contacted the Bluehost specialist again. They confirmed that the current name server settings were correct and assisted me in obtaining a new SSL certificate issued by Let’s Encrypt. They advised me to wait for approximately 40 minutes for the changes to take effect.

Finally, I could visit https://cowpte.com.

Installation of cPanel

Make cowpte.com as the username, resulting in the creation of a ‘cowpte’ folder in the home directory and a ‘public_html’ directory within the ‘cowpte’ directory.

Root access

I can now access root via the terminal using the IP address: ssh root@162.240.228.55 Additionally, I have changed the root password to a pre-set one.

Once https://cowpte.com is enabled, we can access it via the terminal using ssh root@cowpte.com. However, due to the host change, it may trigger a “Host key verification failed” error. To resolve this, simply use the command ssh-keygen -R cowpte.com.

Set up MongoDB

Verify the MongoDB version on GoDaddy’s CentOS by executing mongod --version, revealing version v4.4.6.

To install MongoDB on CentOS 7.9, you can follow these steps:

  1. Add the MongoDB repository with sudo vi /etc/yum.repos.d/mongodb-org.repo

Add the following lines to the file:

plaintextCopy code[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

Save and close the file.

  1. Install MongoDB with sudo yum install mongodb-org
  2. Start and enable MongoDB:
sudo systemctl start mongod
sudo systemctl enable mongod
  1. Verify the MongoDB service status with sudo systemctl status mongod

Install OpenJDK & Open Firewall

curl -s "https://get.sdkman.io" | bash

source "$HOME/.sdkman/bin/sdkman-init.sh"

sdk list java

sdk install java 21.0.1-oracle

sdk default java 21.0.1-oracle

java -version

Check relevant article https://www.jobyme88.com/?st_ai=migrate-springboot-from-local-to-vps-server-2

Activating the Firewall results in the closure of WHM ports. I reached out to a Bluehost specialist to address this issue.

Upload SpringBoot codebase and files

rsync -av /Users/workmac/documents/work-web-nginx/PTE-SpringBoot root@cowpte.com:/home/cowpte/public_html

I need to download new SSL certificate

rsync -av /Users/workmac/documents/COWPTE-backup/GoDaddy_uploads root@cowpte.com:/home/cowpte/public_html

Configure MongoDB

Open port 27017 for MongoDB in the firewall settings. Create a dedicated MongoDB user for the “pte” database. Utilize “mongorestore” command to restore the database. Established an admin user for authenticating the database. Steps are as follows.

  • Enable Authentication
security:
  authorization: enabled
  • Create a MongoDB User
use mongo

use admin

db.createUser({
  user: "username",
  pwd: "password",
  roles: [{ role: "userAdminAnyDatabase", db: "admin" }]
})

  • Restart MongoDB
sudo service mongod restart

Enable SpringBoot

Because a new SSL certificate has been generated, we must update the existing cowpte.jks file and import the certificate authority (CA) into the trusted store of openJDK.

// find the cacerts location on VPS
find ~/.sdkman -name cacerts

// for Mac (just for reference)
keytool -import -trustcacerts -file server.ca -alias server -keystore $(/usr/libexec/java_home)/lib/security/cacerts

// for VPS
keytool -import -trustcacerts -file server.ca -alias server -keystore /root/.sdkman/candidates/java/21.0.1-oracle/lib/security/cacerts

The total migration effort includes two days of high-intensity work plus an additional day for buffer.

Relevant tags:

Leave a Reply