Tag Archives: CentOS 7

How to install ElasticSearch on CentOS 7

“Elasticsearch is a search engine based on Lucene. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Elasticsearch is developed in Java and is released as open source under the terms of the Apache License”

This tutorial will show you how to install ElasticSearch on CentOS 7. The version of ElaistcSearch we use is, 1.7.3.

Step 1

We download openJDK by running:

  • sudo yum install java-1.8.0-openjdk.x86_64

Step 2

Next we will get the elasticsearch package by running:

  • sudo wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.3.noarch.rpm

Step 3

We will then install it by running the following command:

  • sudo rpm -ivh elasticsearch-1.7.3.noarch.rpm

Step 4

We will then start and configure the elasticsearch service by running the following commands.

  • sudo service elasticsearch start
  • sudo service elasticsearch status
  • sudo chkconfig elasticsearch on

Step 5

We will now check that elasticsearch is working as we expect. We will navigate to localhost over port 9200 (the default port for elasticsearch)

  • sudo wegt localhost:9200
  • cat index.html

The output of this file should look similar to the below.

{
"status" : 200,
"name" : "Lockjaw",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.7.3",
"build_hash" : "05d4530971ef0ea46d0f4fa6ee64dbc8df659682",
"build_timestamp" : "2015-10-15T09:14:17Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}

A full video tutorial can be found here:

 

How to statically assign DNS in CentOS 7

You can statically assign DNS in Centos 7. In this example we will assign Googles DNS, which is:

8.8.8.8

8.8.44

To begin we will first edit the our internet adaptor, do so run the command:

sudo vi /etc/sysconfig/network-scripts/ifcfg-enpXXX

in our case we ran

 sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

We changed the line

PEERDNS=yes

to:

PEERDNS=no

 

Next we need to edit the resolv.conf file:

 sudo vi /etc/resolv.conf

nameserver 8.8.8.8

nameserver 8.8.4.4

 

How to disable root ssh logins on CentOS 7

If you have a server that’s available over a network it’s generally a good idea to disable root access over ssh.

The reason for this, is that, scripts run attempting to access  your server and these scripts use the root username to try and log in. A simple way to protect yourself is to simply disable root access via SSH.

We will first create a standard user account that we’ll use to administer our system.

Run the command:

useradd darren

Next we’ll set a password for the user

passwd darren

Now let’s give the account admin permissions:

visudo

Add the following line to the file:

darren = ALL=(ALL) ALL

Now lets stop root from accessing the server via ssh:

vi /etc/ssh/sshd_config

Edit the line:

PermitRootLogin yes

To make it read:

PermitRootLogin no

 

Now restart SSH:

service sshd restart.

Next make sure your you can ssh into the account you created:

ssh darren@192.168.123.67

Run a command with sudo to insure you have sudo access

sudo ls

Once you have confirmed you can exit the server knowing that root access is now disabled for the server.

 

 

 

 

 

 

How to Install Nginx Web Server on CentOS 7

NGINX is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. It is a rival to the Apache web server and used extensively throughout the internet.

This tutorial will show you how to install Nginx on CentOS 7.

So to begin we’ll need to ensure that we have epel repository installed. We can do so by running the command:

  • sudo yum install epel-release

Next we can install Nginx using yum. The command to do so is:

  • sudo yum install nginx.

Next we’ll start the Nginx web server and insure it starts when the server is powered on. The two commands to do this are:

  • sudo service nginx start
  • sudo chkconfig nginx on

Now we need to navigate to our localhost. To do so open a browser window and type in localhost. You should see a screen similar to the one below:

Now that we know that Nginx is working as we expect, lets remove the default Index.html and enter our own. First delete the default index.html by running:

  • sudo rm /usr/share/nginx/html/index.html

Now create your own file using vi:

  • sudo vi /usr/share/nginx/html/index.html

Enter some test text into your file and save it. Now refresh your browser window. You should see the changes replicated. When we refreshed ours it looked like the image below:

 

A full video tutorial on how to install Nginx can be found here:

How to RDP (Remote Desktop) into CentOS 7

Hi There,

In this tutorial I will show you how to RDP into your CentOS 7 Server. This tutorial will also work on a Redhat 7 server. In order to follow this tutorial you will need to be sure that you have CentOS 7 installed with the GNOME Desktop. If you haven’t done this yet be sure to follow this tutorial to get up to speed.

The first thing that we need to do is to add two repos to our CentOS server. The two commands that you need to run are:

  1. sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
  2. sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm

Next we will install the xrdp software package and then start it as a service. The commands to do this are:

  1. sudo yum -y install xrdp tigervnc-server
  2. Sudo systemctl start xrdp.service

Now we need to allow the ports for xrdp through the firewall. After that we’ll need to restart the firewall service. This can be done by running these commands.

  1. sudo firewall-cmd –permanent –zone=public –add-port=3389/tcp
  2. sudo firewall-cmd –reload

Finally we need to configure SELinux. To do so run these two commands:

  1. sudo chcon –type=bin_t /usr/sbin/xrdp
  2. sudo chcon –type=bin_t /usr/sbin/xrdp-sesman

We can now try to RDP to our CentOS 7 server.

First open RDP and type in the IP address of you CentOS 7 Server.

If you get certificate warnings click yes to continue.

Now enter your CentOS username and password

You will now be brought to your CentOS Desktop.

 

 A full video of this tutorial can be seen here:

How to reset the root password on CentOS 7 / Redhat 7 (RHEL 7)

This tutorial will show you how to reset the root password on CentOs 7 / Redhat 7. As a health warning please be sure that when doing this you have taken a snapshot of your VM or if it’s a physical server that you follow the instructions very carefully. With that in mind lets get started.

Step 1

When the system boots up press e on this screen.

Step 2

In the screen that appears scroll down to the line were you see Linux 16

Now Change where its says ro to:

rw init=/sysroot/bin/sh

Then press ctrl + x

Step 3

You will now be in emergency mode which will look like the screen below:

Step 4

Type in the command:

chroot /sysroot

Step 5

Reset the root password by typing in:

passwd root

Step 6

No ensure that selinux will be relabelled by typing the command:

touch /.autorelabel

Step 7

Type in:

exit

Step 8

Now reboot by typing in:

reboot

How to Install CentOS 7 On VMware Workstation 12

In this tutorial you will learn how to install CentOS 7 on VMWare workstation 12. The first thing that you need to do to Install CentOS 7 is to download CentOS 7 from the CentOS website:

https://www.centos.org/download/

The version that you will need to download is the DVD ISO. Once you have downloaded the CentOS7 ISO, you will need to open VMWare workstation.

Once VMWare workstation is open you will then need to follow the following steps to ensure that CentOS 7 is installed.

  • Click file and then New Virtual Machine.
  • Then click typical and next.
  • Find the ISO file you saved and click next.
  • Give your machine a name and click next.
  • Set your disk size and click next.
  • Click customise hardware.
  • Increase the RAM to 2GB
  • Then click close and finish.
  • Then power on the CentOS 7 machine.
  • Select install CentOs 7.
  • Select your language and click next.
  • Select Gnome Desktop for Software Selection and then done.
  • Select the disk you created for installation destination and then done.
  • Then click begin install.
  • Next create your root password and click done.
  • Then create your user, create a password for that user and select make that user an administrator.
  • Then click reboot.
  • Accept the license on start up and click finish configuration.
  • You have now installed Centos 7 On VMWare.
  • The video guide below shows the process in more detail.