我以 root 身份登录到我的 CentOS 5/cPanel 服务器并输入以下内容:
cd /usr/local/bin/
git clone --depth 1 http://github.com/joyent/node.git
cd node
git checkout origin/v0.4 # optional. Note that master is unstable.
export JOBS=2 # optional, sets number of parallel commands.
mkdir ~/local
./configure --prefix=$HOME/local/node
make
make install
echo 'export PATH=$HOME/local/node/bin:$PATH' >> ~/.profile
source ~/.profile
在我从服务器注销并重新登录之前,它似乎工作正常,因为它没有安装:
[~]# node test.js
-bash: node: command not found
如果我输入:source ~/.profile
它会再次开始工作,直到我注销。
请帮忙。谢谢。
编辑:
这是我的 .bash_profile 的内容,我应该如何更改它?
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME