nvs
nvs copied to clipboard
Manual installation without using an install command
I would like to be able to install nvs
in an arbitrary location, which would be a user-owned subdirectory of /usr/local
, and manually update $HOME/.profile
(I do not care about updating any files other than $HOME/.profile
). (When I tried . "$NVS_HOME/nvs.sh" install
with nvs
in a subdirectory of /user/local
, using my own user id, it tried to update a root profile
file which neither works nor is what I want to do.)
The motivation is that it would make it easier for me to start pm2
as root (in its "god" mode) then control it from my own user account.
P.S. This is for a Ubuntu 18.04 LTS server droplet on Digital Ocean. I was already able to do this one one droplet. I will now try this on another droplet and give the solution in a comment for the sake of others. I think this manual installation should be documented as an option, hope I get a chance to raise a PR someday. I accidentally submitted before I finished adding the information, apologies.
Here is what I did on Ubuntu (18.04 LTS) (assumes that my account is already configured as a sudoer with NOPASSWD:ALL
setting):
-
sudo mkdir /usr/local/staff
-
sudo chown brodybits:staff /usr/local/staff
-
ls -l /usr/local
# (to check my work up to this point) -
git clone https://github.com/jasongin/nvs.git
- add the following lines to
$HOME/.profile
(similar to the documentation but note the custom subdirectory in theexport NVS_HOME
setting):
export NVS_HOME=/usr/local/staff/nvs
[ -s "$NVS_HOME/nvs.sh" ] && . "$NVS_HOME/nvs.sh"
-
. ~/.profile
- try
nvs --version
# (this would likely download a "bootstrap node" at first)
Then the following should work in a new login session:
- try
nvs --version
again -
nvs add 10
-
nvs use 10
- try
node --version
My attempt to do nvs link 10
would not work at this point. Here is what I did as a workaround:
-
cd /usr/local/staff/nvs
-
ln -s node/<version>/x64 default
# (assumesx64
CPU architecture, done with help from my tab key) - then check
nvs ls
- in another new login:
- try
node --version
- try
which node
- should show that it runs from thedefault
link
- try
This is similar to how I would install Homebrew into my own subdirectory of /usr/local
([1])
I suspect it should be possible to document this in a more concise, simplified and clear manner, hope I get a chance to contribute someday. (Maybe this should have been in a StackOverflow answer.)
P.S. Adding the following export to ~/.profile
seems to resolve the problem with nvs link
: export NVS_LINK_TO_SYSTEM=0