Installing Git,unzip, OpenJDK 11, Python 2, Python3, Node and NPM in CentOS

Installing Node and npm::

Download nodejs installation file from : https://nodejs.org/en/download/

untar it to /opt/ , create the folder if it doesn’t exists ( sudo mkdir /opt)

tar -xvJf node-v10.16.0-linux-x64  -C /opt

x– un-compress, v-verbros, J– indicating target is xz, f– file path : f should be given before providing file name.

now create a symbolic link in /bin:

sudo ln -s -f /opt/node-v10.16.0-linux-x64/bin/node /bin/node
sudo ln -s -f /opt/node-v10.16.0-linux-x64/bin/npm /bin/npm

Installing OpenJDK:

Download JDK tar from : https://jdk.java.net/java-se-ri/11

tar -xvzf openjdk-11+28_linux-x64_bin.tar.gz -C /opt/

now create a symbolic link:

sudo ln -s -f /opt/java-11/bin/java /bin/java

Git:………………….

sudo yum install git

unzip:…………………..

sudo yum install unzip 

Note for Jenkins:

Please restart Jenkins for the installations to get reflected, close the shell and start again the service.

Installing Python2:………………….

Python2.7.5 is installed by default in CentOS 7, to verify use the below command

python --version

Install PIP for :

Goto : https://pip.pypa.io/en/stable/installing/ and follow the instructions ( You don’t have to , i have summarized the steps below)

Note: Always follow official documents like the one i gave above than following blogs.

Download pip installation script :

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Run the get-pip.py script to install pip:

python get-pip.py

Done, now check the installation:

pip --version

Installing python3:…………………..

Download:

Download python source code from : https://www.python.org/downloads/release/python-374/

Note: you can download zip or xz format

Extract:

If using tar.xz , use -C to specify a different directory than current as destination folder

tar -xvJf Python-3.7.4.tar.xz

if you are using zip

unzip <file_name>

Install development Tools:

We need tools that could download dependency compile the source code etc. ‘Development tools’ gropu in yum has all the tools we need to compile and build the python tool from source code.

Lets install that..

sudo yum groupinstall -y "Development Tools"

install:

Goto extracted directory:

cd Python-3.7.4

Execute below commands:

Make the files executable

sudo chmod 777 *

Install zlib-devel, as cpython uses zlib compression and decompression:

sudo yum install zlib-devel

Install libffi-devel as cpython use libffi:

sudo yum install libffi-devel

Install openssl-devel ,as pip needs ssl module for downloading packages:

sudo yum install openssl-devel

Note: if you want to know more about any package , use the command ‘yum info <pkg_name>‘ Eg:

yum info  libffi-devel 

run the configure file

sudo ./configure

Make is an build utility that helps in building tools from source code, make command will compile all codes and download all required files

sudo make

Make altinstall, will install the tool to

sudo make altinstall

Note: python3 will be installed to /usr/local/bin/

Check python version:

python3.7 --version

To use pip:

pip3.7 --version

See symbolic path (Or real path if sym path is not set):

which python3.7

To see actual installation :

Goto folder in the above command result. See python3 ( it will be in light blue color , indicating that its a symboliclink. Means a link to actual file)

To see actual file, give below command. It gives details of actual file.

readlink -f python3

Note: if you want the commands to be available only for the current user , then create the symbolic link in /usr/bin instead of /usr/local/bin

Creating user :

sudo adduser linuxize

Create password:

sudo passwd linuxize

Add to sudoers file:

sudo usermod -aG wheel linuxize

Removing a symbolic link:

sudo rm <symbolic_link_path> or
sudo unlink <symboliclink_path>
sudo rm /usr/bin/java
sudo unlink /usr/bin/java

IGNORE THE BELOW ONCE:

Goto the extracted ‘folder > bin’ directory copy the full path (eg: /Downloads/node/bin) by opening terminal and using the command ‘pwd’ ( means print working directory)

Open bashrc and edit it

vi ~/.bashrc

Press insert or i and goto end of the file and add below command:

export PATH=${PATH}:/home/praveen/Downloads/node-v10.16.0-linux-x64/bin/

Note : After ${PATH} , use the location of the node bin folder that you have used

Note: you can also edit /etc/profile instead bashrc, bashrc settings is applicable only for bash scripts. Profile settings will be available across different shells.

Press escape and type :wq

Close the terminal and open again:

Reboot system to reflect the changes.