How to Change UUID of Linux Partition on CentOS 7

Change UUIDUUID (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system.

If you cloned a virtual machine from vCenter, the metadata containing information of UUID for the filesystem will be identical for the original and cloned copy, therefore the UUID is no longer unique in /etc/fstab.

The following steps will show how to change UUID of linux partition on CentOS 7. Continue reading “How to Change UUID of Linux Partition on CentOS 7”

How to Install Zimbra Patch on CentOS 7

Install Zimbra Patch

Many have asked me, did Zimbra Collaboration (ZCS) 8.6.0 Patch4 will include Patch1 to Patch3? Actually, if you read the release notes document, the answer is there. ZCS patches are cumulative, meaning ZCS 8.6.0 Patch4 includes ZCS 8.6.0 Patch3, ZCS 8.6.0 Patch2 and ZCS 8.6.0 Patch1. These patch release notes provide information about the Zimbra Collaboration (ZCS) 8.6.0 Patch4, including the enhancements, bug fixes, security fixes, considerations, Known issues, preparation before installing the Patch, step to install the patch, example of the Patch script and revision history information. This step to install zimbra patch has been tested on RHEL6, CentOS6, Oracle Linux 6, RHEL7, CentOS7 and Oracle Linux 7.

In release notes document (preparation before patch), one of the steps we need to take into consideration is to perform a full backup before applied any patch. This is because there is no automatic roll-back if anything goes wrong. If your environment is currently using VMware Vsphere, you can do a virtual machine snapshot before start installing any patch.

How to Install Zimbra Patch4 CentOS / RHEL

1. Before begin, you should get ready the following:

a) Zimbra Collaboration 8.6.0 GA installed (Tested in RHEL6/CentOS6/OL6/RHEL7/CentOS7/OL7)

# zmcontrol -v
Release 8.6.0_GA_1153.RHEL6_64_20141215151155 RHEL6_64 FOSS edition.

b) Zimbra Collaboration 8.6.0 Patch4 TGZ file already downloaded.

2. Copy the patch.tgz file(s) to your server.

# ls | grep zcs-patch
zcs-patch-8.6.0_GA_1182.tgz

3. Install Zimbra Collaboration 8.6.0 Patch4
a. Log in as root and cd to the directory where the tar file is saved. Type :

# tar xzvf zcs-patch-8.6.0_GA_1182.tgz
# cd zcs-patch-8.6.0_GA_1182

b. Switch to user zimbra :

c. The ZCS mailbox service must be stopped to install the patch. Type the following command :

# zmmailboxdctl stop

d. As root, install the patch. Type

# ./installPatch.sh
..
..
..
Updating files for package zimbra-core
  /opt/zimbra/lib/jars/zimbraclient.jar... copied.
  /opt/zimbra/lib/jars/zimbrastore.jar... copied.
  /opt/zimbra/conf/timezones.ics... copied.
  /opt/zimbra/lib/jars/zimbracommon.jar... copied.
  /opt/zimbra/libexec/zmfixperms... copied.
  /opt/zimbra/bin/zmtrainsa... copied.
  /opt/zimbra/lib/jars/zimbrasoap.jar... copied.

e. Switch to user zimbra

# su – zimbra

f. ZCS must be restarted to changes to take effect.

# zmcontrol restart

I hope this article gives you some ideas and quick guide on how to install Zimbra Patch on RHEL6, CentOS6, Oracle Linux 6, RHEL7, CentOS7 and Oracle Linux 7.

How to Download CentOS 7 ISO

Download CentOS 7 ISO

In July 2014, a welcome version of CentOS 7 which tagged as 1406 (CentOS 7.0) officially released. As of end-March 2015, the second CentOS 7 release tagged as 1503 (CentOS 7.1) is available for download and CentOS 7.2  that was tagged as 1511 was released on 14 December 2015.

As of end-March 2015, the second CentOS 7 release tagged as 1503 (CentOS 7.1) is available for download and CentOS 7.2  that was tagged as 1511 was released on 14 December 2015.

The latest release supersedes all previously released content for CentOS 7, therefore it is recommended for all users to upgrade their CentOS machines. This article will list the URL to download CentOS 7 ISO images.

CentOS is an Enterprise-class Linux Distribution derived from sources freely provided to the public by Red Hat.For those who do not want to perform

For those who do not want to perform fresh install of CentOS 7 on the existing machine, you also can get CentOS 7 running by following the upgrade path from CentOS-6 to CentOS-7.

But this path is only supported from the latest version of CentOS-6 (being 6.7 at the time of writing) to the latest version of CentOS-7.

Mirror list to download CentOS 7 ISO images available :

a) Download centos 7 64 bit (4.0GB)
b) Download centos 7 64 bit Everything (7.1GB)
c) Download centos 7 netinstall
d) Download centos 7 live cd

The following alternate mirrors should also have the ISO images available.

Before you download, you also can read the Major Changes for CentOS 7.0 (1406) :
As with every first major release most of the packages have changed and have been updated to more recent versions. It would exceed the scope of this document to list them all. Most notable changes are:

  • Kernel updated to 3.10.0
  • Support for Linux Containers
  • Open VMware Tools and 3D graphics drivers out of the box
  • OpenJDK-7 as default JDK
  • In Place Upgrade from 6.5 to 7.0 (as already mentioned)
  • LVM-snapshots with ext4 and XFS
  • Switch to systemd, firewalld and GRUB2
  • XFS as default file system
  • iSCSI and FCoE in kernel space
  • Support for PTPv2
  • Support for 40G Ethernet Cards
  • Supports installations in UEFI Secure Boot mode on compatible hardware

Major Changes for CentOS 7.1 (1503)

  • As of March 2015 ABRT (>= 2.1.11-19.el7.centos.0.1) can report bugs directly to bugs.centos.org. You can find information about that feature at this page
  • Support for new processors (Intel Broadwell) and graphics (AMD Hawaii)
  • Full support for LVM cache
  • Ability to mount ceph block devices
  • Updated Hyper-V network drivers
  • New libguestfs features
  • Full support for OpenJDK-1.8.0
  • Improved clock stability (for PTP and NTP)
  • Updated Networkmanager packages to version 1.0
  • Updated docker to 1.4.1
  • Updated OpenSSH to 6.6.1
  • New package: Mozilla Thunderbird
  • Update to numerous storage, network and graphics drivers
  • Technology Preview: Support of the Btrfs file system, OverlayFS and the Cisco VIC kernel driver

Major Changes for CentOS 7.2 (1511)

  • Since release 1503 (abrt>= 2.1.11-19.el7.centos.0.1) CentOS-7 can report bugs directly to bugs.centos.org. You can find information about that feature at this page
  • sudo is now capable of verifying command checksums
  • A Kerberos https proxy is now available for identity management
  • NSS no longer accepts DH key parameters < 768 nor RSA/DSA certificates with key sizes < 1024 bits, NSS also now enables TLS1.1/1.2 by default
  • various packages now support TLS1.1/1.2 and EC ciphers
  • The maximum number of SCSI LUNs has been increased
  • The virt-v2v command line tool is now fully supported
  • dd can now show transfer progress
  • OpenJDK7 now supports ECC for TLS connections
  • TPM version 2.0 driver level support has been added
  • tcpdump now supports nanosecond timestamps
  • Various updates to the networking stack (i.e. VXLANs, Data Center TCP, TCP/IP Stack, IPSec, …)
  • Various atomic related packages have been updated
  • Update to the libATA, FCoE and DCB storage drivers
  • Updates to various storage, network and graphics drivers
  • Anaconda now supports NFS when adding additional repos during install
  • Major rebases for the following: Gnome from 3.8 to 3.14, KDE from 4.3 to 4.14, Xorg-X11-Server from 1.15 to 1.17, libreoffice from 4.2.8 to 4.3.7. openldap from 2.4.39 to 2.4.40 and more.

Read more on CentOS 7 Release Notes

I hope this article gives you some ideas and quick guide on where you can download CentOS 7 ISO.

 

How to Setup Linux Login Banner on CentOS 6 / CentOS 7

Linux Login Banner

Most system administrators have applied linux login banner on their servers. The purpose of this linux login banner is to show some messages or warnings when ssh session connected and before entry. The message displayed in the linux login banner is dedicated either to the system administrator who wants to perform routine system maintenance or intruders who want to launch brute force attacks on the server.

Linux Login Banner on CentOS 6 / CentOS 7 / RHEl 7 / Oracle Linux 7

To enable this in ssh you have to follow this simple steps:

1. Create a /etc/mybanner file and fill it with your desired message as below

# vi /etc/mybanner
Unauthorized access to this machine is prohibited
Only authorized System Administrator can access to this system
Press  if you are not an authorized user

Save and Quit the mybanner file.

Optionally you can give warning as below if it is involved a server with highly confidential information:

This service is restricted to authorized System Administrator only. All activities on this system are logged. Unauthorized access will be fully investigated and reported to the appropriate law enforcement agencies.

2. Edit /etc/ssh/sshd_config, to look like this Banner /etc/mybanner

113
114
115 # default banner path
116 Banner /etc/mybanner
117
118

3. Restart sshd service sshd restart

4. Test your session

login as: root
Unauthorized access to this machine is prohibited
Only authorized System Administrator can access to this system
Press  if you are not an authorized user
root@192.168.2.5's password:

I hope this article gives you some ideas and essential guidance on how to setup linux Login Banner on RHEL 7 / CentOS 7/ Oracle Linux 7

 

How to Install Virtualmin on CentOS 7 / RHEL 7 / Oracle Linux 7

Virtualmin is an advanced web hosting control panel that is very flexible and powerful for Linux and UNIX systems. It is based on the well-known Open Source web-based system management, Webmin. It is a Webmin module for managing multiple virtual hosts, multiple virtual domains, mailboxes, databases, applications, and the entire server, from one comprehensive and single friendly web interface. Virtualmin is an excellent alternative to cPanel and Plesk, with the same administrative structure based on user root, resellers, and customers. Virtualmin supports the account creation and management of Apache virtual hosts, BIND DNS domains, MySQL database. VirtualMin also provides functions for non-root users to manage their hosting account. In this article, i will show the steps to install Virtualmin on CentOS 7 / RHEL 7 / Oracle Linux 7. Steps maybe similar to older version of linux distribution.

Install Virtualmin on CentOS 7

There are two versions of Virtualmin exist:

  • Virtualmin GPL is a free and the open source version. (Discussed in this article)
  • Virtualmin Pro is a the commercial version of Virtualmin.

This tutorial assumes the following:

  • You have setup minimal installation for CentOS 7 / RHEL 7 / Oracle Linux 7.
  • You are running with root access.
  • If you are running as a normal user, you must have privileged access (sudo).

Install Virtualmin on CentOS 7 / RHEL 7 / Oracle Linux 7

1. It is recommended to install Virtualmin on the fresh server to avoid conflict when you start the installation. You need to update the system to ensure that we have all the latest software installed.

To update, run the following command :

# yum update -y

2. Download the VirtualMin installer into current directory:

# wget http://software.virtualmin.com/gpl/scripts/install.sh

3. Make the install.sh file executable :

# chmod +x install.sh

4. start the installation :

# ./install.sh
 The systems currently supported by install.sh are:
 CentOS/RHEL/Scientific Linux 7 on x86_64
 CentOS and RHEL 5-6 on i386 and x86_64
 Scientific Linux 6 on i386 and x86_64
 Debian 6, 7, and 8 on i386 and amd64
 Ubuntu 10.04 LTS, 12.04 LTS, and 14.04 LTS on i386 and amd64
 Amazon Linux 2012.03 on i386 and x86_64
 FreeBSD 7.0 and 8 on i386 and amd64

If your OS is not listed above, this script will fail. More details about the systems supported by the script can be found here:

http://www.virtualmin.com/os-support.html

Example :

# ./install.sh
Checking for Perl
found Perl at /usr/bin/perl


Welcome to the Virtualmin GPL installer, version 1.1.2

 WARNING:

 The installation is quite stable and functional when run on a freshly
 installed supported Operating System.

 If you have existing websites, email users, or if you manually installed
 Virtualmin via a Webmin 'wbm' module, you are likely to run into problems.
 Please read the Virtualmin Administrators Guide before proceeding if
 your system is not a freshly installed and supported OS.

 This script is not intended to update your system!  It should only be
 used to perform your initial Virtualmin installation.  If you have previously
 run the Virtualmin installer, you can perform upgrades and updates from within
 Virtualmin itself, or using your system's package manager. Once Virtualmin is
 installed, you never need to run this script again.

 The systems currently supported by install.sh are:
 CentOS/RHEL/Scientific Linux 7 on x86_64
 CentOS and RHEL 5-6 on i386 and x86_64
 Scientific Linux 6 on i386 and x86_64
 Debian 6, 7, and 8 on i386 and amd64
 Ubuntu 10.04 LTS, 12.04 LTS, and 14.04 LTS on i386 and amd64
 Amazon Linux 2012.03 on i386 and x86_64
 FreeBSD 7.0 and 8 on i386 and amd64

 If your OS is not listed above, this script will fail.  More details
 about the systems supported by the script can be found here:

   http://www.virtualmin.com/os-support.html

 Continue? (y/n) y
Checking for HTTP client...found /usr/bin/curl -s -O
Checking for perl...found /usr/bin/perl
Loading log4sh logging library...
INFO - Started installation log in /root/virtualmin-install.log
INFO - Checking for fully qualified hostname...
INFO - Hostname OK: fully qualified as centos71.ehowstuff.local
INFO - Installing serial number and license key into /etc/virtualmin-license
INFO - Loading OS selection library...
INFO - Download of http://software.virtualmin.com/lib/oschooser.pl Succeeded.
INFO - Loading OS list...
INFO - Download of http://software.virtualmin.com/lib/os_list.txt Succeeded.
INFO - Operating system name:    CentOS Linux
INFO - Operating system version: 7.1.1503
INFO - Configuring package manager for CentOS Linux 7.1.1503...
INFO - Disabling SELinux during installation...
/usr/sbin/setenforce: SELinux is disabled
INFO -   setenforce 0 failed: 1
INFO - Download of http://software.virtualmin.com/gpl/rhel/7.1.1503/x86_64/virtualmin-release-latest.noarch.rpm Succeeded.
warning: virtualmin-release-latest.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID a0bdbcf9: NOKEY
INFO -  Succeeded.
INFO - Installing dependencies using command: /usr/bin/yum -y -d 2 install bind bind-utils caching-nameserver httpd postfix spamassassin procmail perl-DBD-Pg
 perl-DBD-MySQL quota iptables openssl python mailman subversion mysql mysql-server mysql-devel mariadb mariadb-server postgresql postgresql-server rh-postgr
esql rh-postgresql-server logrotate webalizer php php-xml php-gd php-imap php-mysql php-odbc php-pear php-pgsql php-snmp php-xmlrpc php-mbstring mod_perl mod
_python cyrus-sasl dovecot spamassassin mod_dav_svn cyrus-sasl-gssapi mod_ssl ruby ruby-devel rubygems perl-XML-Simple perl-Crypt-SSLeay mlocate perl-LWP-Pro
tocol-https
                  
..
..
..

5. Once the install.sh script complete, you have to login to web management console :

https://IPADDRESS:10000/

The following are the summaries for the Post Setup Wizard task :

a) Once you login you will be prompted with a Post Setup Wizard. Click Next.

b) You will be prompted if you would like to pre-load certain libraries. Click Yes and then Next.

c) You will be prompted if you would like to run ClamAV virus scanner on your server. It is suggested that you select Yes and click Next.

d) You will be prompted if you would like to run the SpamAssassin e-mail spam scanner. If you are not running e-mail services it is not necessary to run this. However if you are hosting e-mail it is highly advised. Click Yes and Next if you are going to use SpamAssassin, otherwise click Next.

e) Next you will be prompted if you would like to run MySQL and/or PostgreSQL servers. This is entirely up to you as to which database servers you will provide to your customers (if any). Select your options and click Next. You will be prompted on the following screens for password information.

f) Once finished, you will be presented with an ‘All Done’ page. Click Next.

g) Once the main page loads you will need to reload your configuration. Click the Re-check and refresh configuration button in the yellow box.

I hope this article gives you some ideas and essential guidance on how to install Virtualmin on CentOS 7 / RHEL 7 / Oracle Linux 7.

 

How to Configure Firewalld in Linux CentOS 7 / RHEL7

Linux kernel includes powerful network filtering subsystem called Netfilter. It allows kernel modules to inspect each packet crossing the linux system such as to allow or drop incoming and outgoing network packet. In older Red Hat Enterprise Linux (RHEL) release such as RHEL 5 and RHEL 6, iptables was the main method of interacting with the kernel netfilter subsystem. The firewall capabilities were provided by the iptables utility, and configured either at the command line or through the graphical configuration tool, system-config-firewall.

configure firewalld in linux

In RHEL 7, firewalld has been introduced as a new method of interacting with netfilter. It is a default method for managing host-level firewalls. Basically the firewall capabilities are still provided by iptables. But linux administrators now interact with iptables through the dynamic firewall daemon, firewalld, and its configuration tools: firewall-config, firewall-cmd, and firewall-applet, which is not included in the default installation of Red Hat Enterprise Linux 7. Traffic management becomes easier after firewalld classifies all network traffic into a specific zone. Based on criteria such as source IP address of packets through the network, traffic was diverted into the firewall rules for approriate zone.

How to Configure Firewalld in Linux

There are three main ways for system administrators to interact with firewalld.

  • By directly editing congfiguration files in /etc/firewalld
  • By using the graphical firewall-config tool
  • By using firewalld-cmd from the command line (will be discussed in this article)

This article will discuss how to configure firewalld in linux CentoS 7, RHEL 7 and Oracle linux 7 by using firewalld-cmd command line. Please take note that the firewalld daemon is installed from the firewalld package. It is part of a base install, but not part of a minimal installation.

1. How to install Firewalld :

Firewalld package is installed by default in RHEL 7.1 and CentOS 7.1. If you noticed it is not installed, you can install it using the following YUM command.

# sudo yum install firewalld -y

2. How to disable or enable Firewalld at boot :

a) To disable start at boot :

# sudo systemctl disable firewalld
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'

b) To enable start at boot :

# sudo systemctl enable firewalld

3. Verify that firewalld is enabled and running on your server system :

# sudo systemctl status firewalld.service

Example :

# sudo systemctl status firewalld.service
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
   Active: active (running) since Wed 2015-09-09 21:26:25 MYT; 1 weeks 0 days ago
 Main PID: 2348 (firewalld)
   CGroup: /system.slice/firewalld.service
           ??2348 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Sep 09 21:26:25 centos71.ehowstuff.local systemd[1]: Started firewalld - dynamic firewall daemon.

4. How to query the current default zone ?

# sudo firewall-cmd --get-default-zone
public

In this case, the default zone is public.

5. How to list all available zones ?

# sudo firewall-cmd --get-zones
block dmz drop external home internal public trusted work

This will display all available zones.

6. Open up incoming http,https and mysql traffic for public zone :

# sudo firewall-cmd --permanent --zone=public --add-service=http
# sudo firewall-cmd --permanent --zone=public --add-service=https
# sudo firewall-cmd --permanent --zone=public --add-service=mysql

7. Activate the changes to your server firewall :

# sudo firewall-cmd --reload

8. Check the configuration of the running firewall on your system :

a) Query active zone :

# sudo firewall-cmd --get-active-zones

b) Display all running firewall configuration :

# sudo firewall-cmd --zone=public --list-all

Example :

# sudo firewall-cmd --zone=public --list-all
public (default, active)
  interfaces: ens32
  sources:
  services: dhcpv6-client http https mysql ssh
  ports:
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

I hope that this gives you some ideas and essential guidance on how to configure firewalld in linux RHEL 7 / CentOS 7.

 

How to a Add and Remove User Account on RHEL 6/7, CentOS 6/7, Oracle Linux 6/7

This article will explain and share how to add and remove user account with useradd(add) and userdel (remove) from the command-line on linux RHEL 6/7, CentOS 6/7, Oracle Linux 6/7 server.

1. Adding a New User to an Linux System.

a) Get the useradd manual :

# man useradd
useradd - create a new user or update default new user information

b) To creates the new account and the /home/john home directory :

# useradd --home /home/ehowstuff ehowstuff

c) useraddd command does not set any valid password by default, and user cannot log in until a password is set.To set the password user the following command :

# passwd ehowstuff
Changing password for user ehowstuff.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

d) Verify the values in /etc/password :

# cat /etc/passwd | grep ehowstuff
ehowstuff:x:501:501::/home/ehowstuff:/bin/bash

e) Verify the values in /etc/group :

# cat /etc/group | grep ehowstuff
ehowstuff:x:501:

f) Verify email user created for id ehowstuff :

# ls /var/spool/mail | grep ehowstuff
ehowstuff

More useradd options :

-c, –comment COMMENT
Add a value, such as a full name, to the GECOS field.

-g, –gid GROUP
Specify the primary group for the user account.

-G, –groups GROUPS
Specify a list if supplementary groups for the user account.

-a, –append
Used with the -G option to append the user to the supplemental groups mentioned without removing the user from other groups.

-d, –home HOME_DIR
Specify a new home directory to a new location. Must be used with the -d option.

-m, –move-home
Move a user home directory to a new location. Must be used with the -d option.

-s, –shell SHELL
Specify a new login shell for the user account.

-L, –lock
Lock a user account.

-U, –unlock
Unlock a user account.

2. Deleting a User from an Linux System.

a) Get userdel manual :

# man userdel
userdel - delete a user account and related files

b) userdel username removes the user from /etc/passwd, but leaves the home directory intact by default. Proper command to remove the user’s account, user’s home directory and mail spool as part of the deletion process :

# userdel --remove ehowstuff

or

# userdel -r ehowstuff

Warning :
When a user is removed with userdel without the -r option specified, the system will have files that are owned by an unassigned user ID number. This can also happen when files created by a deleted user exist outside their home directory. This situation can lead to information leakage and other security issues.

 

How to Install and Configure TigerVNC Server on CentOS 7.1 / RHEL 7.1 / Oracle Linux 7

The following article explain how to Install and configure TigerVNC Server on CentOS 7.1 or Red Hat Enterprise Linux (RHEL 7.1) or Oracle Linux 7. TigerVNC (Tiger Virtual Network Computing) is a remote access utility that allows you to control other computers that running graphical desktop sharing in separate sessions in parallel. It is works on the client-server principle: a server shares its output (vncserver) and a client (vncviewer) connects to the server. TigerVNC in RHEL 7 or CentOS 7 or Oracle Linux 7 uses the systemd system management daemon for its configuration. The /etc/sysconfig/vncserver configuration file has been replaced by /etc/systemd/system/vncserver@.service.

Install and Configure TigerVNC Server on Linux

1. Install tigervnc-server

# yum install tigervnc-server -y

2. Copy this file to /etc/systemd/system/vncserver@:.service :

# cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service

3. Edit and vncserver parameters appropriately

# vi /etc/systemd/system/vncserver@:1.service

Replace with actual user hat exist on the linux (e.g ehowstuff)

[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l ehowstuff -c "/usr/bin/vncserver %i"
PIDFile=/home/ehowstuff/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]
WantedBy=multi-user.target

4. Run `systemctl daemon-reload` to make the changes take effect immediately :

# systemctl daemon-reload

5. Set the password for the user or users defined in the configuration file. Note that you need to switch from root to USER first.

# su - ehowstuff
$ vncpasswd
Password:
Verify:

6. To start the service, specify the display number directly in the command :

# systemctl start vncserver@:1.service

7. Enable the service to start automatically at system start

# systemctl enable vncserver@:1.service

8. Add firewall rules to allow the VNC connection :

# firewall-cmd --permanent --zone=public --add-port 5901/tcp
# systemctl restart firewalld.service

9. Run VNC viewer :
Configure TigerVNC Server

How to Install and Setup Apache Tomcat 8 on CentOS 7 / RHEL 7

What is Tomcat Server and What is Apache Tomcat used for ?

Apache Tomcat version 8 is an open source web server and servlet container developed by the Apache Software Foundation (ASF).

It provides a web server environment for Java based source code and used to deploy Java Servlets and JSPs.

Basically Apache is an HTTP Server, serving HTTP. Tomcat is a Servlet and JSP Server serving Java technologies.

Tomcat 8 is the first Apache Tomcat release to support the Servlet 3.1, JSP 2.3, EL 2.3, and WebSocket specifications.

This article will describes how to install and configure Tomcat 8 on CentOS 7, RHEL 7 and Oracle Linux 7.

1. Install Oracle java :

2. How to download Apache Tomcat 8 :

To download Apache tomcat 8, go to the apache tomcat mirror

# cd /opt
# wget http://apache.arvixe.com/tomcat/tomcat-8/v8.0.22/bin/apache-tomcat-8.0.22.tar.gz

3. Extract the downloaded files :

# tar xzvf apache-tomcat-8.0.22.tar.gz

4. Create tomcat8 group and add user tomcat8 to that group:

# groupadd tomcat8
# useradd -s /bin/bash -g tomcat8 tomcat8

5. Create a symbolic link of tomcat directory to /opt/tomcat and assign permission :

# ln -s /opt/apache-tomcat-8.0.22 /opt/tomcat
# chown -R tomcat8:tomcat8 /opt/tomcat /opt/apache-tomcat-8.0.22

6. Create a Systemd Setting file :

# vi /usr/lib/systemd/system/tomcat8.service

Add the following :

[Unit]
Description=Apache Tomcat 8
After=network.target

[Service]
Type=oneshot
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
RemainAfterExit=yes
User=tomcat8
Group=tomcat8

[Install]
WantedBy=multi-user.target

7. How to start tomcat server and make it auto start at boot :

# systemctl start tomcat8
# systemctl enable tomcat8

8. Tomcat server works on port 8080 default. You can access from your browser using the url :

http://serverURL:8080

setup-tomcat-centos7-1

9. There are changes on the user roles on Tomcat 8. By default, no users or passwords are created for the Tomcat manager roles. To set roles, user name(s) and password(s), we need to configure the tomcat-users.xml file located at $CATALINA_HOME/conf/tomcat-users.xml.

# vi /opt/tomcat/conf/tomcat-users.xml

Add the following :

<!-- user manager can access only manager section -->
<role rolename="manager-gui"></role>
<user username="manager" password="password" roles="manager-gui"></user>

<!-- user admin can access manager and admin section both -->
<role rolename="admin-gui"></role>
<user username="admin" password="password" roles="manager-gui,admin-gui"></user>

Read here on the different between Apache Web Server and Apache Tomcat server.

How to Install JAVA 8 (JDK 8u45) on CentOS 6 / CentOS 7

The JDK is a development tool for building applications, applets, and components using the Java programming language . It includes a useful tool for developing and testing programs written in the Java programming language and runs on the Java platform. You can go through this document to know more about new enhancement of Java JDK 8. This post describe how to install JAVA 8 (JDK 8u45) on CentOS 6 and CentOS 7 from rpm package.

1. Download Oracle Java 8 rpm from official website (64 bit):

# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm"

2. Install Oracle Java 8 :

# rpm -ivh jdk-8u45-linux-x64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:jdk1.8.0_45-2000:1.8.0_45-fcs    ################################# [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...
        jfxrt.jar...
        plugin.jar...
        javaws.jar...
        deploy.jar...

3. Verify the Oracle Java version :

# java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)