How to convert Pagoda to nodejs environment with one click? As a global web server control panel, Pagoda panel can help users easily manage various applications on the server. Among the many functions, Pagoda's one-click installation and one-click uninstall functions have become one of the most popular functions among users. Especially for users who need to frequently switch software environments, this feature can greatly improve work efficiency. However, for ordinary users, it is still troublesome to frequently switch software environments and install various dependent libraries. This article will introduce a technique to quickly switch the Node.js environment by using the one-click installation and one-click uninstall functions in the Pagoda panel.
1. Install the Pagoda Panel
First, you need to install the Pagoda Panel on the server. The following are the installation steps:
1. Log in as the root user
2. Execute the following command to install the Pagoda panel:
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
3. After execution, visit the following address entry:
http://服务器IP:8888
2. Install the Node.js environment
After installing Node Before setting up the .js environment, you need to obtain an installation package. Here we choose the 14.4.0 version of Node.js. Open the following page to find and download the Node.js 14.4.0 version binary (Linux version):
https://nodejs.org/dist/v14.4.0/
After downloading, upload it to the server. We take /root/node-v14.4.0-linux-x64.tar.xz as an example and execute the following command to install:
tar Jxf node-v14.4.0-linux-x64.tar.xz mv node-v14.4.0-linux-x64 /usr/local/nodejs
Next, we need to set environment variables to facilitate our use of node in the terminal and npm command. In the file /etc/profile.d/nodejs.sh, add the following configuration:
export NODE_HOME=/usr/local/nodejs export PATH=$NODE_HOME/bin:$PATH
Execute the following command to activate the configuration item:
source /etc/profile.d/nodejs.sh
Check whether the setting is successful, execute the following command to view the version :
node -v npm -v
After completing the above steps, we successfully installed the Node.js environment.
3. Convert Node.js environment secretly
Now we have installed the Node.js environment, but we still need to use them frequently. If you have to perform a series of operations such as installing and uninstalling various dependent libraries every time you want to switch environments, the efficiency will definitely be affected. At this time we need to use the one-click installation and one-click uninstall functions of the Pagoda panel.
First, in the software management interface of the Pagoda panel, find the "One-click installation" and "One-click uninstall" buttons. In the installation interface, fill in the relevant information:
1. Software name :node14
2. Installation directory: /usr/local/nodejs3. Download link: Installation package path (for example: http://IP address:port number/node-v14.4.0-linux-x64. tar.xz)
Then click the "Install" button to install the Node.js environment with one click, including installing and uninstalling dependent libraries.
After waiting for the installation to be completed, we need to darken the environment. Since we need to use the 14.4.0 version of Node.js, run the following command in the terminal:
nvm use 14.4.0
Among them, nvm is Node .js multi-version manager, through which you can quickly switch between different versions of Node.js environments. If the following error occurs:
Command 'nvm' not found, but can be installed with...
, you need to install nvm first and execute the following command:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
After the installation is completed, execute the dark transfer command again. After success, you can easily use Node. js environment.
4. Summary
This article introduces how to use the one-click installation and one-click uninstallation functions of the Pagoda panel to quickly switch the Node.js environment. In actual use, in order to improve efficiency, we can configure each version of the Node.js environment and then switch as needed. At the same time, it should be noted that before converting the environment secretly, you need to uninstall the old version of the dependent library to prevent the risk of version conflicts.
The above is the detailed content of Tutorial on how to secretly convert Pagoda to nodejs environment with one click. For more information, please follow other related articles on the PHP Chinese website!