1/12/2024 0 Comments Yum install nodejsthis is the recommend approach for development as only processes run under your user ID will be affected. To make one or more RHSCL packages a permanent part of your development environment, you can add it to the login script for your specific user ID. Permanently enable RHSCL in your development environment Doing this can cause conflicts and unexpected problems with other applications because the system version of the package is obscured by having the RHSCL version in the path first. While it is possible to change the system profile to make RHSCL packages part of the system’s global environment, this is not recommended. Each time you login, or start a new terminal session, scl enable needs to be run again. Typing exit will return to the original shell with the original environment. The steps in this tutorial run the command bash to start a new interactive shell to work in the updated environment. The environmental changes only affect the command that is run by scl and any processes that are run from that command. When scl enable runs, it modifies environment variables and then runs the specified command. To accomplish this, the desired package is added to your runtime environment as needed with the scl enable command. The software packages in RHSCL are designed to allow multiple versions of software to be installed concurrently. Now use curl, or a browser such as Firefox, to connect to the Node.js web server $ curl Hello, Red Hat Developer Program World from v8.6.0! Working with RHSCL packages Res.end('Hello, Red Hat Developer Program World from ' +Ĭonsole.log('Processed request for '+ req.url) Ĭonsole.log('Server running at + laddr + ':' + port + '/') Hello-http.js var http = require('http') Using your preferred text editor, create a file named hello-http.js with the following content: The next step is to try a slightly larger Node.js example that implements a tiny web server. If you get the error: node command not found, you need to run scl enable rh-nodejs8 bash first. Hello, Red Hat Developer Program World from Node v8.6.0 Hello.js console.log("Hello, Red Hat Developer Program World from Node " + process.version) Using a text editor such as vi, nano, or geditcreate a file named hello.js with the following content: The next step is to create a Node.js program that can be run from the command line. First, use scl enable to add Node.js v4 to your environment, then run Node.js to check the version. Under your normal user ID, start a Terminal window. 3. Hello World and your first Node.js application A separate package is no longer required. Note: In Node.js v8, the JavaScript v8 runtime is built in. Next step, install Node.js v4 from RHSCL: # subscription-manager repos -enable rhel-6-server-optional-rpms 2. Setup your Node.js development environment # subscription-manager repos -enable rhel-server-rhscl-6-rpms # subscription-manager repos -enable rhel-7-server-optional-rpms # subscription-manager repos -enable rhel-server-rhscl-7-rpms If you are using a workstation edition of Red Hat Enterprise Linux, change -server- to -workstation- in the following commands: See Troubleshooting and FAQ for more information. If you don’t see any RHSCL repositories in the list, your subscription might not include it. # subscription-manager repos -list | egrep rhscl Use the -list option to view the available software repositories and verify that you have access to RHSCL: You can add or remove software repositories from the command line using the subscription-manager tool as the root user. Using subscription-manager from the command line Note: After clicking, it might take several seconds for the check mark to appear in the enabled column. If you are using a workstation version of Red Hat Enterprise Linux, the repositories will be named rhel-workstation-rhscl-7-rpms and rhel-7-workstation-optional-rpms (or rhel-desktop-rhscl-6-rpms and rhel-6-desktop-optional-rpms). In the list of repositories, check the Enabled column for rhel-server-rhscl-7-rpms and rhel-7-server-optional-rpms (or rhel-server-rhscl-6-rpms and rhel-6-server-optional-rpms). Select Repositories from the System menu of the subscription manager. Alternatively, you can start it from the command prompt by typing subscription-manager-gui. Start Red Hat Subscription Manager using the System Tools group of the Applications menu. Using the Red Hat Subscription Manager GUI The remainder of this tutorial applies to systems running either RHSM or RHN Classic. The instructions in this section are only for systems using RHSM. Note for RHEL 6 users: If your system uses Red Hat Network (RHN) Classic instead of Red Hat Subscription Management (RHSM) for managing subscriptions and entitlements, please skip this step and follow the Installation chapter of the Red Hat Software Collections Release Notes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |