<\/span><\/h2>\nFirst, log in to your AlmaLinux server via SSH as the root user:<\/p>\n
ssh root@IP_Address -p Port_number<\/pre>\nYou will need to replace \u2018IP_Address\u2018 and \u2018Port_number\u2018 with your server\u2019s respective IP address and SSH port number. Additionally, replace \u2018root\u2019 with the username of the admin account if necessary.<\/p>\n
Before starting, you have to make sure that all AlmaLinux packages installed on the server are up to date. You can do this by running the following command:<\/p>\n
dnf update<\/pre>\n<\/span>Step 2: Install Node.js<\/span><\/h2>\nFirst, install all required dependencies with the following command:<\/p>\n
dnf install epel-release git curl unzip<\/pre>\nOnce all the dependencies are installed, check the available Node.js streams with the following command:<\/p>\n
dnf module list nodejs<\/pre>\nYou should get similar output like this:<\/p>\n
AlmaLinux 8 - AppStream\r\nName Stream Profiles\r\nnodejs 10 [d] common [d], development, minimal, s2i\r\nnodejs 12 common [d], development, minimal, s2i\r\nnodejs 14 common [d], development, minimal, s2i\r\nnodejs 16 common [d], development, minimal, s2i\r\n\r\nExtra Packages for Enterprise Linux Modular 8 - x86_64\r\nName Stream Profiles\r\nnodejs 13 default, development, minimal\r\nnodejs 16-epel default, development, minimal\r\n\r\nHint: [d]efault, [e]nabled, [x]disabled, [i]installed\r\n<\/pre>\nNext, install Node.js from the official repositories with the following command:<\/p>\n
dnf module install nodejs:16<\/pre>\nOnce Node.js has been installed, you can verify the installed version of Node.js with the following command:<\/p>\n
node -v<\/pre>\nYou should get the following output:<\/p>\n
v16.13.1<\/pre>\nTo check\u00a0 the NPM version run the following command:<\/p>\n
npm -v<\/pre>\nYou should get the following output:<\/p>\n
8.1.1<\/pre>\n<\/span>Step 3: Installing Angular CLI<\/span><\/h2>\nTo install AngularJS, use the following command:<\/p>\n
npm install -g @angular\/cli<\/pre>\nTo verify that AngularJS is installed, check the version by running this command:<\/p>\n
ng version<\/pre>\nYou should get an output like this:<\/p>\n
Angular CLI: 13.3.3\r\nNode: 16.13.1\r\nPackage Manager: npm 8.1.1\r\nOS: linux x64\r\n<\/pre>\n<\/span>Step 4: Create a New Angular Application<\/span><\/h2>\nYou may use the ng<\/strong> command to create a new AngularJS application once you have Angular CLI installed.<\/p>\nng new MyApplication<\/pre>\nYou should see the following output:<\/p>\n
? Would you like to add Angular routing? Yes<\/strong><\/span>\r\n? Which stylesheet format would you like to use? CSS<\/span> [PRESS ENTER]<\/strong>\r\nCREATE MyApplication\/README.md (1067 bytes)\r\nCREATE MyApplication\/.editorconfig (274 bytes)\r\nCREATE MyApplication\/.gitignore (548 bytes)\r\nCREATE MyApplication\/angular.json (3082 bytes)\r\nCREATE MyApplication\/package.json (1077 bytes)\r\nCREATE MyApplication\/tsconfig.json (863 bytes)\r\nCREATE MyApplication\/.browserslistrc (600 bytes)\r\nCREATE MyApplication\/karma.conf.js (1431 bytes)\r\nCREATE MyApplication\/tsconfig.app.json (287 bytes)\r\nCREATE MyApplication\/tsconfig.spec.json (333 bytes)\r\nCREATE MyApplication\/.vscode\/extensions.json (130 bytes)\r\nCREATE MyApplication\/.vscode\/launch.json (474 bytes)\r\nCREATE MyApplication\/.vscode\/tasks.json (938 bytes)\r\nCREATE MyApplication\/src\/favicon.ico (948 bytes)\r\nCREATE MyApplication\/src\/index.html (299 bytes)\r\nCREATE MyApplication\/src\/main.ts (372 bytes)\r\nCREATE MyApplication\/src\/polyfills.ts (2338 bytes)\r\nCREATE MyApplication\/src\/styles.css (80 bytes)\r\nCREATE MyApplication\/src\/test.ts (745 bytes)\r\nCREATE MyApplication\/src\/assets\/.gitkeep (0 bytes)\r\nCREATE MyApplication\/src\/environments\/environment.prod.ts (51 bytes)\r\nCREATE MyApplication\/src\/environments\/environment.ts (658 bytes)\r\nCREATE MyApplication\/src\/app\/app-routing.module.ts (245 bytes)\r\nCREATE MyApplication\/src\/app\/app.module.ts (393 bytes)\r\nCREATE MyApplication\/src\/app\/app.component.css (0 bytes)\r\nCREATE MyApplication\/src\/app\/app.component.html (23364 bytes)\r\nCREATE MyApplication\/src\/app\/app.component.spec.ts (1094 bytes)\r\nCREATE MyApplication\/src\/app\/app.component.ts (217 bytes)\r\n\u2714 Packages installed successfully.\r\nSuccessfully initialized git.<\/pre>\nChange into the newly created MyApplication<\/strong><\/code> directory with the following command:<\/p>\ncd MyApplication<\/pre>\nServe up the new application with the command:<\/p>\n
ng serve --host 0.0.0.0<\/pre>\nYou should get the following output:<\/p>\n
\u2714 Browser application bundle generation complete.\r\n\r\nInitial Chunk Files | Names | Raw Size\r\nvendor.js | vendor | 1.97 MB |\r\npolyfills.js | polyfills | 294.80 kB |\r\nstyles.css, styles.js | styles | 173.23 kB |\r\nmain.js | main | 49.80 kB |\r\nruntime.js | runtime | 6.52 kB |\r\n\r\n| Initial Total | 2.48 MB\r\n\r\nBuild at: 2022-04-19T21:06:08.919Z - Hash: 80933e939c98b336 - Time: 18108ms\r\n\r\n** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http:\/\/localhost:4200\/ **\r\n\r\n\u2714 Compiled successfully.<\/pre>\nBy default, the AngularJS application runs on port 4200<\/code><\/span><\/strong><\/p>\n<\/span>Step 5: Running AngularJS Application with PM2<\/span><\/h2>\nProcess Manager (PM2) will allow you to keep applications alive forever, reload them without downtime, and facilitate common system admin tasks. You can use npm<\/code> to install PM2 as follows:<\/p>\nnpm install -g pm2<\/pre>\nAfter installing PM2, you can run these commands to start your AngularJS on port 4200.<\/p>\n
cd MyApplication\r\npm2 start \"ng serve --host 0.0.0.0\"<\/pre>\nIf you want to run your AngularJS application on a specific port you need to run the following command:<\/p>\n
pm2 start \"ng serve --host 0.0.0.0 --port 8000\"<\/pre>\nCheck the PM2 Status:<\/span><\/p>\n$ pm2 status\r\n\u250c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\r\n\u2502 id \u2502 name \u2502 namespace \u2502 version \u2502 mode \u2502 pid \u2502 uptime \u2502 \u21ba \u2502 status \u2502 cpu \u2502 mem \u2502 user \u2502 watching\u2502\r\n\u251c\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\r\n\u2502 0 \u2502 ng serve --host 0.0.0 \u2502 default \u2502 N\/A \u2502 fork \u2502 1612 \u2502 0s \u2502 0 \u2502 online \u2502 0% \u2502 1.2mb\u2502 root \u2502 disabled\u2502\r\n\u2514\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\r\n<\/pre>\nThe following command is to allow incoming traffic on the TCP port 4200<\/code> in the firewall.<\/p>\nfirewall-cmd --zone=public --add-port=4200\/tcp --permanent\r\nfirewall-cmd --reload<\/pre>\n