Install nodejs on LinuxONE Community Cloud and run applications.
Request access to LinuxONE Community Cloud. Follow instructions https://github.com/linuxone-community-cloud/technical-resources/blob/master/faststart/deploy-virtual-server.md
Install Visual Studio Code on your workstation. https://code.visualstudio.com/
Install required packages
For RHEL:
$ sudo yum install nodejs -y
$ sudo yum install git -y
$ sudo yum install vim -y
Check nodejs version
$ node -v
Sample output
Check npm version
$ npm -v
$ node
> console.log(“This is a test”);
exit
> .exit
Create test.js
$ vim test.js
Run the script
$ node test.js
Create a project folder named project-01
$ mkdir project-01
Change directory to project-01
$ cd project-01
$ vim apps.js
Check the ip address of the server and copy it.
$ nmcli
Run the application
$ node apps.js
Open web browser, insert ip address port 3000
This was rendered using plain text, we will now render html.
Create index.html using vscode
Type ! and press enter and it will generate the outline on an html document for you.
Inside the body insert This is HTML so that you know you are rendering htm instead of plain text.
Sample output after pressing enter
Create the file on server using vim and copy the contents
$ vim index.html
copy apps.js file content add a function in apps.js to use html instead of plain text and import a library so you can read the file index.html
create file called appshtml.js and change the port to 3001
$ vim appshtml.js
Run application
$ node appshtml.js