Showing posts with label path. Show all posts
Showing posts with label path. Show all posts

Saturday 24 February 2018

How to add a directory to your path in Ubuntu

Open up the terminal
Type the command
echo $PATH
This gives you the current path.
Let's say you want to add the directory /home/mick/temp to the path...
Copy the current path you have just echo'd. Lets's say it's
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
First make sure you are in your home directory by typing
cd ~
Open the file .bashrc using an editor such as gedit using
gedit .bashrc
Go to the bottom of the file and add a line
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
Where the existing path is just pasted in.
Now add a colon followed by the path you'd like to add so that it reads
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/home/mick/temp
Save the file and restart your computer.
Now any excecutable placed in can also be available wherever you are on your installation.
This will be useful in following blog entries.

Friday 23 February 2018

The 2018 Web Developer : Install nvm on Ubuntu

In the introduction to this series I wrote about the value of learning JavaScript technologies such as node.js (node), in order to avail myself of more work. In order to install node I should first install nvm. This will allow me to control the versions of I install.

What is nvm?

Node Version Manager (nvm) is a tool for applying node to an installation.

How will nvm help me?

Let's say you're involved in a project which began and continues to be running using an older version of node. You, as a developer need to be in a position to install that older version in your project. You would obviously, also want to install newer versions for other projects.

OK, I'm convinced. Let's install stuff

Let's begin with nvm.
From your home directory, create a directory called .nvm
mkdir .nvm
sudo apt-get install build-essential libssl-dev curl git-core
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
Check the latest version from https://github.com/creationix/nvm
Now reboot and check that it works using:
nvm --version
A new directory should have been added to you home directory called .nvm
And the following should have been added to your .bashrc file
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

What next?

I haven't achieved much here, other than installing a piece of software, but I have opened the door to the possibilities which node brings. In the next instalment I'll take another baby step. I'll use my newly installed piece of software to install node.