How to install R and RStudio on Linux - CentOS or RHEL 7 in 5 minutes

Leave a Comment

R is a programming language used for statistical computing commonly by Data Scientists and analysts. It is free and open source tool under GNU project and R is maintained by R foundation.

In this article we will learn how to install R and R Studio on a Linux server that can be Centos 7 or Red hat Enterprise Linux 7.  

Please note :  You can install either using root user or a non root user with sudo rights.

Step 1 : Install R 

First, you need to install the epel repo for centos and rhel using below command. Make sure yum works on your machine.

sudo yum install

Install R software using below command

sudo yum install R -y

Once yum completes the installation of R package, you may verify the same using below command.

On your Linux machine, run command R, if successfully installed you will see output as given below.

root@techbuzztimes #  R 

You are done with one part that is R installation, next you need to install R studio.

Step 2: Install R studio

You can find the latest version of R studio for Centos and RHEL 7 from here
Make sure wget is installed on your machine, you need to download the package first and then install it using yum command as given below

sudo yum install rstudio-server-rhel-1.3.1093-x86_64.rpm

During the installation, at the end it will try to enable and start the service as shown in below screenshot, make sure Rtsudio service is up and running.

Check the Rstudio service using below command.

systemctl status rstudio-server.service

Make sure service is enabled so that it comes up after the server restarts.

systemctl enable rstudio-server.service

Step 3 : Verify Rstudio GUI 

Ok, so you are done with the installation steps, now you can go ahead and verify the R studio gui on web browser.

By default, R studio runs on port 8787

In your web browser open URL http://hostname:8787

You will see gui like below

You can verify access on the R studio using any user, make sure user exists on the server and having valid home directory on the server, you may check using below command.

getent passwd username

Once successfully logged in, you will see Gui as shown below. All these steps will take between 5 to 10 minutes.  Please let us know how your R studio installation went in comments.




How to Register Philips Trimmer Warranty Online using Serial Number

Few days back, i have purchased my new Philips trimmer Online Philips QT4011/15. My last trimmer QT4019/15 worked  really well that i purchased back in 2012. Philips is a brand that you can trust without second thought. They have good range of trimmers and comes with reasonable price tag. You can purchase Philips trimmer on all the major Online Websites or from Offline stores.

In this post, i will show you how you can register your Philips trimmer on Philips India website and get 3 years warranty for it.

1. Go to Philips India website, Sign up for the same by entering your details or if you already have account, log in with the credentials to start registering your Philips trimmer.

Link of Philip India Website:

2. Once you land up on the home page after login, you will see the old registered products and below that there is option Register your product. Click on the Register your product option and enter the serial number  if you have the same.

In my case i wanted to Registered my Philips QT4011/15  Trimmer that i purchased online from Flipkart , i tried couple of product codes given on the package but sadly none of them worked.

So, i searched for the product Philips QT4011/15 and it showed me below page.

3. Enter below details to complete the registration. Give the Date of Purchase as the date when order was placed. Enter the serial number that is 4 digit code given on the trimmer as show in the below screenshot.

How to get serial number of your Philips Trimmer: 

As shown in below screenshot, serial is at the back side of the trimmer. The 4 digit code will be the serial number for your trimmer.

Post entering all the details, you will see the confirmation page as show below.

If you find, this post useful, do like us on Facebook, twitter.


How to install Docker on RHEL 8 beta


This post will guide you about the steps required to get started with Docker on RHEL 8 beta system. RHEL 8 beta was announced a few months back and it is available to download for testers and developers, It comes with a lot of advancement and new features and If you want to install and explore RHEL 8 you can read our old post that shows the detailed steps of RHEL 8 installation on VMware workstation
One of the new features added in RHEL 8 is Containers without daemons. Buildah and Podman can help you build containers without any requirement of Dockers.
There are two versions of Dockers available: Docker CE [Community edition] and Docker EE [Enterprise Edition].
Well, if you are wondering of RHEL 8 Beta supports docker? There is no official documentation regarding the installation of Dockers on RHEL 8 beta, we tested installation of Docker CE on RHEL 8 beta to play with dockers on RHEL 8.

Steps of Installing Docker CE on RHEL 8 beta

Before installing Docker CE on a machine, we need to setup the docker repository. Once this step is done, we can install Docker from the repository.

1. Set up the repository

Install required packages, dnf-utils, device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.
Note that : DNF (dandified yum)is used as package management utility in RHEL 8.
# dnf install -y dnf-utils \
  device-mapper-persistent-data \
Use the following command to set up the repository.
#  dnf config-manager \ 
  --add-repo \
Now, the docker ce repository is set up, you can check using dnf repolist or yum repolist

2. Install Docker CE

You can install the latest version of the docker ce using below command.
# dnf install docker-ce
While installing, if you are prompted to accept the GPG key, accept the same by entering y
Note: We encountered below error while running the install command for the first time. We re-ran the install command, it did not appear and prompt for accepting gpg key came next and after entering y, the installation went smooth and was finished in about a minute.
Curl error (6): Couldn’t resolve host name for [Could not resolve host:]

Once installed, you will see the download complete message with the package details that are installed.

Next step is to start and enable docker using systemctl
# systemctl start docker
# systemctl enable docker
Finally, you are done with the Docker CE installation on your RHEL 8 machine, now lets verify that it is installed correctly by running the hello-world image.

That’s all for this post, hope you are able to install docker on your RedHat Linux 8 machine.
If you have thoughts on this, please feel free to comment below.

Different Instructions in a Dockerfile and their usage

Learn about different components/Instructions that makes a Dockerfile

What is Dockerfile?

The set of instructions for building a container are written in Dockefile. It is a text file that contains the base image, all the settings, and the list of commands required for preparing and starting a container.

Dockerfile basic Example

A basic example of a Dockerfile for installaing and building a apache web server.
FROM centos:latest


RUN yum update && yum -y install httpd

RUN echo "Hello, Welcome to the world of Dockers" > /var/www/html/index.html


CMD [“/usr/sbin/httpd”, “-D”, “FOREGROUND”]

Instructions in Dockerfile

The syntax of Dockerfile is simple and contains below instructions:


FROM is the first instruction in any Dockerfile and it defines the base image to use. Base image can be any existing Docker image, typically it is operating system image or a specific application framework.
FROM <image>
FROM <image>:<tag>

MAINTAINER:  [deprecated]

It is used to set the author of that image. You can do same task using LABEL instruction.


RUN is used to run or execute commands in the container. Usage of RUN is RUN <command> , command is run in a shell, which is by default /bin/sh –c
RUN <command> (shell form, the command is run in a shell, which by default is /bin/sh –c)


ADD is used to copy the files, directories, remote file URLs from current directory into the container. Eg ADD <src><dest>.
<src> file can also be tar archive, the same will be unpacked for you as a directory into the docker image.
If <dest> path do not exist, it will be created for you.
ADD <src><dest>


It is similar to ADD, but it do not support the compression and URL file functionality. It is used to copy the files or directories from <src> and adds them to the destination path.
COPY <source>… <destination>


When container starts up, these commands will be executed/run. It is used to provide defaults for an executing container. The defaults can be executables or in case executable is omitted/excluded then you must specify an ENTRYPOINT instruction as well. In case there are more than one CMD in the dockerfile, then only the last CMD will take effect.
In case a user specify any arguments to docker run, then they will override the defaults mentioned in CMD.
Usage :
CMD [“executable”,”param1″,”param2″]  (exec form)
CMD [“param1″,”param2”] (default parameters to ENTRYPOINT)


It is used to add metadata to an image. A label is a key-value pair. An image can have more than one label. You can view image labels using docker inspect command.
Eg of Label:
LABEL version=”1.0″


It is used to inform Docker that container listens on the specified network port at the runtime. You can specify the protocol as well (TCP or UDP), by default  TCP is the protocol if nothing is specified.
Using EXPOSE,  the ports are exposed and can be used to publish and map one or more ports using –p option with docker run.
Regardless, of the EXPOSE instruction, the settings can be override at runtime by using the –p flag.
For eg.
docker run –p 80:80/tcp –p 5050:5050 ….
 EXPOSE <port> [<port>/<protocol>…]


The ENV instruction is used  to set the environment variable <key> to the value <value>
First format given in usage below will set single variable to value, while the second format can be used to set multiple variables at one time. You can view all the set environment variables using docker inspect command and change them using dockerrun –env<key>=<value>
ENV <key><value>
ENV <key>=<value> …


ENTRYPOINT allows you to configure a container that will run as an executable.

What’s the difference between CMD and ENTRYPOINT

Docker has default entrypoint (/bin/sh -c) but does not have a command. For example, running below <docker run image>, here the default Entrypoint will be /bin/sh -c and CMD will be bash. So that means, CMD is run via the ENTRYPOINT or CMD will be the parameter of the entrypoint.
Docker run –i –t ubuntu bash
Entrypoint : /bin/sh –c
Cmd : bash
Another example, suppose you want to use ENTRYPOINT as /bin/cat. So, when docker run image /etc/passwd command will run /etc/passwd is command and it is passed to the ENTRYPOINT /bin/cat and the execution is /bin/vat /etc/passwdd
Final Conclusion is ENTRYPOINT specifies a command that will always be executed when container starts.
CMD specifies arguments that will be fed to the ENTRYPOINT
ENTRYPOINT [“executable”, “param1”, “param2”] (exec form, preferred)
ENTRYPOINT command param1 param2 (shell form)


Volume defines a path or creates a mount point in the container that Docker exposes to the host system and it can be mapped using the -v option.
The docker run command initializes the specified volume along with the existing data in the volume within the base image.
VOLUME [“/path”]
VOLUME  /path1 /path2 ..


USER instruction sets the username or UID to use while running the image. Also, GID or user group can also be specified with USER instructions.
USER <user>[:<group>]


The WORKDIR instruction is used to set the working directory for any ADD, COPY, CMD, RUN or ENTRYPOINT instruction that follows it. It can be used multiple times in a Dockerfile.
WORKDIR </path>


ARG instruction is used to define a variable that can be passed at build time to the builder docker build using the –build-arg <variable>=<value>
A dockerfile can contain multiple ARG instructions. Environment variable defined using ENV instruction always override the ARG instruction.
It is not recommended to pass user credentials, github keys as build time variables as the same will be visible in docker history command.
ARG <name>[=<default value>]


SHELL instruction is particulary useful for Windows and it allows to override the default shell (/bin/sh -c) for Linux and (“cmd” “/S”, “/C” ).
SHELL instruction also allows to use alternate shells like zsh, tsh, powershell etc.
SHELL [“<executable>”, “<param1>”, “<param2>”]
Please comment down your thoughts on Dockerfiles and let us know if you have any query.


How to Change Hostname in Linux (CentOS 7.x/RHEL 7.x)

How to Change Hostname in a Linux Machine using hostnamectl command


This article is about how you can change your Linux machine hostname using the hostnamectl command. While installing Redhat 7.x or CentOS 7.x, in case you have not specified any hostname, then by default “localhost.localdomain” will be assigned as default hostname for that machine. You can easily change the hostname for your Redhat or CentOS Linux machine using the hostnamectl command. This method can be used for CentOS 7.x / RHEL 7.x and RHEL 8 operating systems.

Method 1: hostnamectl

hostnamectl command can be used to change or query system hostname and related settings. The advantage of using hostnamectl is that , we dont require machine reboot to make the changes. Let us learn more about hostnamectl command.

Types of Hostnames

  1. Pretty Hostname: The high level pretty hostname is in the form of Human readable format and it can include all kinds of special characters. Example of Pretty hostname can be “John’s Laptop” or “Database Server”.
  2. Static Hostname: It is the traditional hostname, which can be chosen by the user and used to initialize kernel hostname at boot. It is stored in the /etc/hostname file.
  3. Transient Hostname: It is the dynamic hostname maintained by the kernel and is initialized to the static hostname by default.

Changing your Hostname in CentOS 7 or RHEL 7 /RHEL 8

In CentOS and RHEL 7.x onwards hostname query and control is managed by hostnamectl command. You can use hostnamectl command to change or set hostnames. As described above, all the three hostnames viz Pretty hostname, static hostname and transient hostname can be set using hostnamectl.

To view all the Host names

To query about current status of hostname information, issue the hostnamectl command.
# hostnamectl

To change all the Hostnames

To change all the host names command, use below command as root user. This will change the pretty, static and transient hostnames alike.
# hostnamectl set-hostname name

To Set a Particular hostname

In case you want to set a Particular hostname, use below command with required option.
# hostnamectl set-hostname name <options>
Options can be either:
  • –static
  • –pretty
  • –transient
Example of setting Pretty hostname:
# hostnamectl set-hostname "John's Laptop" --pretty
Example of setting Static hostname:
# hostnamectl set-hostname linuxforgeek --static

To clear a particular hostname

Use below command as root user to clear a particular hostname and revert the same to its default.
# hostnamectl set-hostname "" <options>
In above command “” refers to empty string and will clear the hostname and <option> can be either –pretty, –static or –transient.

Making new hostname effective

Once you are done with changing the hostname of your Linux server/machine, you can open up a new terminal session or issue shell command bash to update in the current session
# bash

Method 2 : modify /etc/hostname

Another method to change hostname in RHEL 7.x/CentOS 7.x is by changing hostname in /etc/hostname file followed by the reboot.
# vi /etc/hostname
# reboot
That is all for this post, feel free to comment below for any query.