How to Stop and Start Firewalld on Centos 7 and Red Hat 7

Default installations of the CentOS 7 Linux operating system have the firewalld firewall installed and enabled by default as a security measure, but how can we disable it?

Disable Firewalld:
To disable firewalld, run the command as root:

systemctl disable firewalld

Stop Firewalld
To stop firewalld:

systemctl stop firewalld

Check the Status of Firewalld
And finally, to check the status of firewall:

systemctl status firewalld

Enable Firewalld
To enable firewalld, run the following command as root:

systemctl enable firewalld

Start Firewalld
To start firewalld, run the following command as root:

systemctl start firewalld

Check the Status of Firewalld

To check the status of firewalld, run the following command as root:

systemctl status firewalld

Continue Reading

How To Install Docker on Centos 7 and Red Hat 7

Hello friends, I’m starting some posts referring to a Docker.
During the next months, we will make an update more frequent, all of us who have a suggestion please send an email to: geraldo@techpoli.info.

Introduction:

Docker is a software technology providing containers, promoted by the company Docker, Inc. Docker provides an additional layer of abstraction and automation of operating-system-level virtualization on Windows and Linux. Docker uses the resource isolation features of the Linux kernel such as cgroups and kernel namespaces, and a union-capable file system such as OverlayFS and others to allow independent “containers” to run within a single Linux instance, avoiding the overhead of starting and maintaining virtual machines.

The Linux kernel’s support for namespaces mostly isolates an application’s view of the operating environment, including process trees, network, user IDs and mounted file systems, while the kernel’s cgroups provide resource limiting, including the CPU, memory, block I/O, and network. Since version 0.9, Docker includes the libcontainer library as its own way to directly use virtualization facilities provided by the Linux kernel, in addition to using abstracted virtualization interfaces via libvirt, LXC (Linux Containers) and systemd-nspawn.

Step 1: Installation of Docker

As a matter of best practice we’ll update our packages:

yum -y update

Now run this command. It will add the official Docker repository, download the latest version of Docker and install it:

curl -fsSL https://get.docker.com/ | sh

Step 2: Start the docker and configure to start with the operating system.

Set the Docker service to start at boot:

systemctl enable docker

Then start the Docker service:

systemctl start docker

And verify your work by checking the status of Docker:

systemctl status docker

Step 3: Download Container

Download the centos Docker image:

Note you can choose any system like Ubuntu or Debian.

docker pull centos

Step 4: Run Container

As an example, let’s run a container using the latest image of CentOS. The combination of the -i and -t switches gives you interactive shell access into the container:

docker run -i -t centos /bin/bash

You are now using a docking dock inside a docker centos.

To disconnect or detach from the shell without exiting, use a string of Ctrl + Ctrl-p + Ctrl-q.

There are many community containers already available that can be found through a survey. On the command below, I look for a Ubuntu keyword:

docker search ubuntu:17.04

Friends, that’s all.
We will continue with more advanced articles on docker.

Continue Reading

Installing VMware Tools in a Linux virtual machine on Centos 7 and Red Hat 7

To install VMware Tools in a Linux guest operating system using Compiler:

1-Ensure that your Linux virtual machine is powered on.

2- If you are running a GUI interface, open a command shell.

Note: Log in as a root user, or use the sudo command to complete each of these steps.

3-Click VM in the virtual machine menu, then click Guest > Install/Upgrade VMware Tool

4-Click OK.

Note: In some cases, verify that the CDROM device is Connected from within the Edit Settings option of the virtual machine.

5-  To create a mount point, run:

mkdir /mnt/cdrom

6- To mount the CDROM, run:

mount /dev/cdrom /mnt/cdrom

7- To copy the Compiler gzip tar file to a temporary local directory, run:

cp /mnt/cdrom/VMwareTools-version.tar.gz /tmp/

Where version is the VMware Tools package version.

8-  To determine the version of VMware tools, run:

ls /mnt/cdrom

You see output similar to:

# VMwareTools-5.0.0-12124.tar.gz

9- To change to the tmp directory and extract the contents of the tar file into a new directory called vmware-tools-distrib, run:

cd /tmp
tar -zxvf VMwareTools-version.tar.gz

10- To change directory to vmware-tools-distrib and run the vmware-install.pl PERL script to install VMware Tools, run:

cd vmware-tools-distrib
./vmware-install.pl

Notes:
Complete the screen prompts to install the VMware Tools. Options in square brackets are default choices and can be selected by pressing Enter.
To compile VMware Tools successfully, you need gcc Compiler and Linux Kernel sources provided by your Linux distribution. Consult your Linux distribution documentation for details on methods to install these packages.
It is normal for the console screen to go blank for a short time during the installation when the display size changes.
Some warnings or errors are normal, like when a files does not exist.
Depending on the Linux distribution, your network service might restart after installation. VMware recommends that you invoke this command from the console and not remotely.

11- If you are running a GUI interface, restart your X Window session for any mouse or graphics changes to take effect.

12-  To start VMware Tools running in the background during an X Window session, run:

/usr/bin/vmware-toolbox &

13- Depending on your environment, you may need to unmount the CD-ROM. To unmount the CD-ROM, run:

umount /mnt/cdrom

14- Depending on your environment, you may need to manually end the VMware Tools installation. To end the VMware Tools install, click VM in the virtual machine menu, then click Guest > End VMware Tools Install.

15-To remove VMware Tools installation packages, run:

cd
rm /tmp/VMwareTools-version.tar.gz
rm -rf /tmp/vmware-tools-distrib

That is all

Continue Reading

X11 Forwarding using Xming and PuTTY

We can run graphical programs on Linux machines on campus remotely and display them on your desktop computer running Windows. We can do this by using running two applications together on your Windows machine: Xming and PuTTY.

What is Xming?

Xming is a PC X Window Server. This enables programs being run remotely to be displayed on your desktop. Download and run the installation program from: http://sourceforge.net/projects/xming/

1- Navigate to the Files section and download:
*Xming setup from the Xming folder
*The fonts package installer from the Xming-fonts folder

   2- By default both programs will be installed into the same location, so don’t the worry about over writing files. We cannot work without both packages.
3- Once installed, running All Programs > Xming > XLaunch is a good idea to see what the configuration looks like. In most cases, the default options should be just fine.
4-Finally run All Programs > Xming > Xming to start the PC X Server. The “X” icon should be visible on the Windows Taskbar, as in the image below. The X Server must be started before setting up a SSH connection to a campus machine.

Xming on Windows 7 Taskbar

What is PuTTY?

PuTTY is a free SSH client. Through PuTTY we connect to a remote machine on the UT Dallas campus. Download the single Windows executable file from: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html There is no setup required, you can run by simply double clicking putty.exe.

Configuring PuTTY

1-Under Session, enter the hostname you want to connect to: 192.168.0.22 on port 22. Make sure the connection type is ssh.

putty11

 1-Next, scroll to Connection > SSH > X11. Check the box next to Enable X11 Forwarding. The remote authentication should be set to MIT-Magic-Cookie-1

2-Finally go back to Session. You can save your session too, and load it each time you want to connect.

3-Click Open to bring up the terminal and login using your netid/password .

puttyx11

Now with the ready configuration, will connect to the server.

Note: At this point it is important to log in with the User that will run the graphical interface.

display1

Run the program

 

oracle

 That is all.
Any doubts I am available.

 

Continue Reading

Join Centos in Windows Active Directory

This example shows to configure on the environment below.

Domain Server   : Windows Server 2012 R2
Domain Name    : poli01dc01
Realm                   : poli01ad01.local
Hostname            : poli01srv01.poli01ad01.local

 

Install some required packages.

yum -y install realmd sssd oddjob oddjob-mkhomedir adcli samba-common

 

Join in Windows Active Directory Domain.

# change the DNS to AD's one

[root@dlp ~]# nmcli c modify ens3 ipv4.dns 10.1.1.5

[root@dlp ~]# nmcli c down ens3; nmcli c up ens3
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)

# discover Active Directory domain
[root@dlp ~]# realm discover POLI01AD01.LOCAL

srv.world
type: kerberos
realm-name: POLI01AD01.LOCAL
domain-name: POLI01AD01.LOCAL
configured: no
server-software: active-directory
client-software: sssd
required-package: oddjob
required-package: oddjob-mkhomedir
required-package: sssd
required-package: adcli
required-package: samba-common

# join in Active Directory domain
[root@dlp ~]# realm join POLI01AD01.LOCAL
Password for Administrator:
# AD's Administrator password

# make sure it's possible to get an AD user info or not
[root@dlp ~]# id poli01srv01.poli01ad01.local\\Serverworld
uid=406801001(POLI01SRV01@POLI01AD01.LOCAL) gid=406800513(domain users@srv.world) groups=406800513(domain users@srv.world)

# make sure it's possible to switch to an AD user or not
[root@dlp ~]# su - poli01srv01.poli01ad01.local\\Serverworld
Creating home directory for serverworld@srv.world.
[serverworld@srv.world@dlp ~]$     # just switched

 If you’d like to omit domain name for AD user, configure like follows.

[root@dlp ~]# vi /etc/sssd/sssd.conf
# line 16: change

use_fully_qualified_names = False
[root@dlp ~]# systemctl restart sssd

[root@dlp ~]# id Administrator
uid=406800500(administrator) gid=406800513(domain users) groups=406800513(domain users),
406800572(denied rodc password replication group),406800518(schema admins),
406800520(group policy creator owners),406800512(domain admins),406800519(enterprise admins) 

That is all

Continue Reading