Minggu, 31 Juli 2016

How To Install Apache Tomcat 9.0 Ubuntu 16.04

The Apache Tomcat® software is an opened upwards source implementation of the Java Servlet, JavaServer Pages, Java Expression Language in addition to Java WebSocket technologies.


Step ane - Install Tomcat from binary 

Download Latest JAVA version from Official Website.

root@U16: # wget http://apache.mirror.iweb.ca/tomcat/tomcat-9/v9.0.0.M9/bin/apache-tomcat-9.0.0.M9.tar.gz

root@U16: # wget http://apache.mirror.iweb.ca/tomcat/tomcat-9/v9.0.0.M9/bin/apache-tomcat-9.0.0.M9.tar.gz --2016-08-01 02:42:30--  http://apache.mirror.iweb.ca/tomcat/tomcat-9/v9.0.0.M9/bin/apache-tomcat-9.0.0.M9.tar.gz Resolving apache.mirror.iweb.ca (apache.mirror.iweb.ca)... 192.175.120.173, 2607:f748:10:12:a9a:c1:1e:1 Connecting to apache.mirror.iweb.ca (apache.mirror.iweb.ca)|192.175.120.173|:80... connected. HTTP asking sent, awaiting response... 200 OK Length: 9322413 (8.9M) [application/x-gzip] Saving to: ‘apache-tomcat-9.0.0.M9.tar.gz’  apache-tomcat-9.0.0.M9.tar.gz              100%[=======================================>]   8.89M   402KB/s    inwards 38s  2016-08-01 02:43:09 (242 KB/s) - ‘apache-tomcat-9.0.0.M9.tar.gz’ saved [9322413/9322413] 

Step ii - Extract apache-tomcat-9.0.0.M9.tar.gz  file 

root@U16: # tar -xzvf apache-tomcat-9.0.0.M9.tar.gz
root@U16: # tar -xzvf apache-tomcat-9.0.0.M9.tar.gz
Step three - Move file to a proper location 

root@U16: # mv apache-tomcat-9.0.0.M9 /opt/tomcat
root@U16: # mv apache-tomcat-9.0.0.M9 /opt/tomcat


Step four - Install JAVA

Java is required to run Tomcat, let's cheque JAVA if already exist.
root@U16: # java -version openjdk version "1.8.0_91" OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4 16.04.1-b14) OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

In My Ubuntu machine JAVA 8 is already installed,  If JAVA does't be Install it using command apt install default-jdk.

root@U16: # apt install default-jdk


Step v - Start TOMCAT 

Ater JAVA installation, Let's inaugural of all TOMCAT.

Go to Tomcat folder
root@U16: # cd /opt/tomcat/bin/

To Start Tomcat run command ./startup.sh
root@U16:/opt/tomcat/bin# ./startup.sh Using CATALINA_BASE:   /opt/tomcat Using CATALINA_HOME:   /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME:        /usr Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar Tomcat started. root@U16:/opt/tomcat/bin#

JAVA  has been started successfully, Let's cheque using Server IP in addition to Port 8080.


6 - Optional   We tin modify the default Tomcat port from server.xml file.

6a -Fisrt Stop Tomcat Server -  root@U16:/opt/tomcat/bin# ./shutdown.sh

root@U16:/opt/tomcat/bin# ./shutdown.sh Using CATALINA_BASE:   /opt/tomcat Using CATALINA_HOME:   /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME:        /usr Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar 

6b - Go to Conf Folder -
root@U16: # cd /opt/tomcat/conf/ 

6c - Open server.xml file using VI editor

root@U16:/opt/tomcat/conf# vi server.xml
Find Connector port="8080"  And Change port to your wishing number.

<Connector port="8181" protocol="HTTP/1.1"                connectionTimeout="20000"                redirectPort="8443" /> 

6d - Save and Exit from file.


6E - Start Tomcat Server


root@U16:/opt/tomcat/bin# ./startup.sh Using CATALINA_BASE:   /opt/tomcat Using CATALINA_HOME:   /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME:        /usr Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar Tomcat started.
JAVA  has been started successfully, Let's cheque using Server IP and Port 8181.





7- Troubleshooting :-

When you lot choose Server Status, Showing fault 403 access denied 















7a- To Fix inwards a higher house error, you lot ask append below syntax inwards $CATALINA_HOME/conf/Catalina/hostname/manager.xml file. Open file inwards Vi editor.


root@U16: # vi /opt/tomcat/conf/Catalina/localhost/manager.xml
<Context antiResourceLocking="false" privileged="true" useHttpOnly="true" override="true">    <Valve className="org.apache.catalina.authenticator.BasicAuthenticator" securePagesWithPragma="false" />  </Context> 

Save and Exit from File.

7b-  Now opened upwards tomcat-users.xml file in addition to allow business office access from remote pc.


root@U16: # vi /opt/tomcat/conf/tomcat-users.xml

Add below Syntax to inwards a higher house file between <tomcat-users> </tomcat-users> 
.
 <role rolename="manager-gui"/> <user username="tomcat" password="s3cret" roles="manager-gui"/>


Save and Exit from File.
7c- Now Restart Tomcat Server :-

Stop Tomcat First

 root@U16: # /opt/tomcat/bin/./shutdown.sh Using CATALINA_BASE:   /opt/tomcat Using CATALINA_HOME:   /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME:        /usr Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar root@U16: # 


Start Tomcat Now
root@U16: # /opt/tomcat/bin/./startup.sh Using CATALINA_BASE:   /opt/tomcat Using CATALINA_HOME:   /opt/tomcat Using CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME:        /usr Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar Tomcat started. root@U16: # 


7d- Let's cheque Server Status Now

Enter User_Name (tomcat) in addition to Password (s3cret) when prompt. You volition come across below page when everything goes successfully.








That's ALL
!!! Cheers !!!

Sumber https://linuxhowtoguide.blogspot.com/

How To Add Together Novel Network Adapter Inward Linux Ubuntu 16.04

This is the blog, how to add together novel network interface inwards Linux Ubuntu 16.04 TLS.

For a System Administrator, It is a common task which is required on need to add together additional Network Interface. It may last required for unlike operate i.e. Setup Bridge Interface, Setting upwards VLAN etc.


1 - Requirement :- In my scenario, I am using Ubuntu 16.04 TLS box running on the Virtual box.



2 - Check Current Interfaces :-

We tin cheque electrical current available Network interfaces using below method.

A- Using ascendency ifconfig -a

root@U16: # ifconfig -a enp0s3    Link encap:Ethernet  HWaddr 08:00:27:ae:86:3c           inet addr:10.0.0.161  Bcast:10.0.1.255  Mask:255.255.254.0           inet6 addr: fe80::a00:27ff:feae:863c/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:1906 errors:0 dropped:0 overruns:0 frame:0           TX packets:894 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           RX bytes:1646594 (1.6 MB)  TX bytes:73845 (73.8 KB)  lo        Link encap:Local Loopback           inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:65536  Metric:1           RX packets:160 errors:0 dropped:0 overruns:0 frame:0           TX packets:160 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1           RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB) 

B- Using ascendency ip link


root@U16: # ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue lay down UNKNOWN means DEFAULT grouping default qlen i     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast lay down UP means DEFAULT grouping default qlen grand     link/ether 08:00:27:ae:86:3c brd ff:ff:ff:ff:ff:ff root@U16: # 


3- Now Add novel network interface from Virtual Box.

- Shutdown your VM first

- Select (1) VM Go to VM (2) setting  



- Select (1) Network from left side menu, Choose (2) Network adapter 2 , conduct cheque box (3) enable network Adapter and Select (4) Bridge Adapter from driblet downwards list Attached to option.


- Click Ok  And Start the VM.

4- Check newly added interface :-

root@U16: # ifconfig -a enp0s3    Link encap:Ethernet  HWaddr 08:00:27:ae:86:3c           inet addr:10.0.0.161  Bcast:10.0.1.255  Mask:255.255.254.0           inet6 addr: fe80::a00:27ff:feae:863c/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:723 errors:0 dropped:0 overruns:0 frame:0           TX packets:114 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           RX bytes:67371 (67.3 KB)  TX bytes:16991 (16.9 KB)  enp0s8    Link encap:Ethernet  HWaddr 08:00:27:98:ec:88           BROADCAST MULTICAST  MTU:1500  Metric:1           RX packets:0 errors:0 dropped:0 overruns:0 frame:0           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)  lo        Link encap:Local Loopback           inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:65536  Metric:1           RX packets:160 errors:0 dropped:0 overruns:0 frame:0           TX packets:160 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1           RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB) 


Newly available interface is enp0s8



5- Let's configure enp0s8 interface as well as activate this adapter:-

Open interfaces from /etc/network location using vi editor. And append below line.

auto enp0s8
iface enp0s8 inet dhcp

root@U16: # vi /etc/network/interfaces  auto enp0s8 iface enp0s8 inet dhcp  

Save and Exit form file.


6- Restart Networking service to utilize changes :-

root@U16: # service networking restart


7- Let's cheque for IP address :-

Use ascendency ifconfig or ip addr to cheque assigned IP address.

root@U16: # ifconfig enp0s3    Link encap:Ethernet  HWaddr 08:00:27:ae:86:3c           inet addr:10.0.0.161  Bcast:10.0.1.255  Mask:255.255.254.0           inet6 addr: fe80::a00:27ff:feae:863c/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:6811 errors:0 dropped:0 overruns:0 frame:0           TX packets:381 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           RX bytes:627377 (627.3 KB)  TX bytes:80855 (80.8 KB)  enp0s8    Link encap:Ethernet  HWaddr 08:00:27:98:ec:88           inet addr:10.0.0.81  Bcast:10.0.1.255  Mask:255.255.254.0           inet6 addr: fe80::a00:27ff:fe98:ec88/64 Scope:Link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:2246 errors:0 dropped:0 overruns:0 frame:0           TX packets:8 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           RX bytes:209378 (209.3 KB)  TX bytes:1192 (1.1 KB)  lo        Link encap:Local Loopback           inet addr:127.0.0.1  Mask:255.0.0.0           inet6 addr: ::1/128 Scope:Host           UP LOOPBACK RUNNING  MTU:65536  Metric:1           RX packets:160 errors:0 dropped:0 overruns:0 frame:0           TX packets:160 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1           RX bytes:11840 (11.8 KB)  TX bytes:11840 (11.8 KB)  


We convey successfully added newly Interface as well as getting IP address.



That's All
!!!Cheers!!!


Sumber https://linuxhowtoguide.blogspot.com/

Minggu, 24 Juli 2016

How To Setup Key Log Server

This article is how to setup Central Log Server to collect rsyslog from unlike Linux motorcar together with analysis them from a Central location..

What is Syslog Server is used for :-
Central Syslog server is the master copy requirement of a Linux Administrator, It aid to an Administrator analysis rsyslog fourth dimension to fourth dimension together with validate is everything going inward good fashion amongst server.

Requirement:- In my Case I am using Ubuntu 16.04 TLS

1- Central Log Server    :-    192.168.138.129
2- Linux Web01 Server  :-    192.168.138.132
3- Linux Web02 Server  :-    192.168.138.133

Steps :- 

Central Server Side Configuration :-

Check rsyslog packet using ascendence dpkg. 

root@LXD: # dpkg --list rsyslog
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                      Version                   Architecture              Description
+++-=========================================-=========================-=========================-=======================================================================================
ii  rsyslog                                   8.16.0-1ubuntu3           amd64                     reliable organization together with kernel logging daemon

root@LXD: #

By-default rsyslog packet come upward pre-installed. If non be install using below command.

root@LXD: # apt install rsyslog

Now brand required changes inward rsyslog.conf file. Open file together with add together highlighted employment below.

root@LXD: # vi /etc/rsyslog.conf

#  /etc/rsyslog.conf    Configuration file for rsyslog.
#
#                       For to a greater extent than data see
#                       /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
#
#  Default logging rules tin mail away move flora inward /etc/rsyslog.d/50-default.conf


#################
#### MODULES ####
#################

module(load="imuxsock") # provides back upward for local organization logging
module(load="imklog")   # provides nitty-gritty logging support
#module(load="immark")  # provides --MARK-- message capability

# provides back upward for local organization logging
$ModLoad imuxsock

# provides nitty-gritty logging back upward (previously done past times rklogd)
$ModLoad imklog

# provides UDP syslog reception. For TCP, charge imtcp.
$ModLoad imudp

# For TCP, InputServerRun 514
$UDPServerRun 514

# This ane is the template to generate the log filename dynamically, depending on the client's IP address.
$template FILENAME,"/var/log/centrallog/%HOSTNAME%/syslog.log"

# Log all messages to the dynamically formed file. Now each clients log (192.168.138.132192.168.138.133, etc...), will move nether a assort directory which is formed past times the template FILENAME.
*.* ?FILENAME

# provides UDP syslog reception
#module(load="imudp")
#input(type="imudp" port="514")

# provides TCP syslog reception
#module(load="imtcp")
#input(type="imtcp" port="514")

# Enable non-kernel facility klog messages
$KLogPermitNonKernelFacility on

###########################
#### GLOBAL DIRECTIVES ####
###########################
#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the next line.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

# Filter duplicated messages
$RepeatedMsgReduction on

#
# Set the default permissions for all log files.
#
$FileOwner syslog
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$PrivDropToUser syslog
$PrivDropToGroup syslog

#
# Where to house spool together with soil files
#
$WorkDirectory /var/spool/rsyslog

#
# Include all config files inward /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf

Save together with Exit from File

Restart rsyslog service

root@LXD: # systemctl restart rsyslog

We accept define log path - /var/log/centrallog/ 
You volition come across Central Log server log file volition move at that spot amongst hostname, Check through below command.

root@LXD: # ls -l /var/log/centrallog/
total 4
drwx------ ii syslog syslog 4096 Jul 25 15:23 LXD



Client Server Configuration :-

Client End Configuration demand to add together next lines, larn to web01 server together with made below changes.


root@web01: # vi /etc/rsyslog.conf

ModLoad imuxsock

$ModLoad imklog

# Provides UDP forwarding. The IP is the server's IP address

*.* @192.168.138.129:514 

Save together with leave of absence from file.

Restart rsyslog service 

root@web01: # systemctl restart rsyslog

Now larn to Central log server together with run below ascendence to come across web01 hostname file within log path folder.


root@LXD: # ls -l /var/log/centrallog/
full 8
drwx------ ii syslog syslog 4096 Jul 25 15:23 LXD
drwx------ ii syslog syslog 4096 Jul 25 15:38 web01

Logon to  web02 server together with add together below employment into rsyslog.conf file.

root@web02: # vi /etc/rsyslog.conf

ModLoad imuxsock

$ModLoad imklog

# Provides UDP forwarding. The IP is the server's IP address

*.* @192.168.138.129:514 

Save together with leave of absence from file.

Restart rsyslog service 

root@web02: # systemctl restart rsyslog

Both the Client web01 together with web02 started frontwards logs to Central log server. Use ascendence to come across file together with analysis log file.


root@LXD: # ls -l /var/log/centrallog/
full 12
drwx------ ii syslog syslog 4096 Jul 25 15:23 LXD
drwx------ ii syslog syslog 4096 Jul 25 15:38 web01
drwx------ ii syslog syslog 4096 Jul 25 15:41 web02

To cheque log purpose ascendence Cat or tail.

root@LXD: # tail -f /var/log/centrallog/web01/syslog.log

2016-07-25T15:38:07+05:30 web01 systemd[1]: Starting System Logging Service...
2016-07-25T15:38:09+05:30 web01 systemd[1]: Started System Logging Service.
2016-07-25T15:38:09+05:30 web01 rsyslogd-2039: Could non opened upward output pipage '/dev/xconsole':: No such file or directory [v8.16.0 endeavor http://www.rsyslog.com/e/2039 ]
2016-07-25T15:38:09+05:30 web01 rsyslogd-2007: activity 'action 15' suspended, adjacent retry is Monday Jul 25 15:38:39 2016 [v8.16.0 endeavor http://www.rsyslog.com/e/2007 ]
2016-07-25T15:39:01+05:30 web01 CRON[1254]: pam_unix(cron:session): session opened for user origin past times (uid=0)
2016-07-25T15:39:01+05:30 web01 CRON[1255]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean)
2016-07-25T15:39:01+05:30 web01 CRON[1254]: pam_unix(cron:session): session shut for user root
2016-07-25T15:39:45+05:30 web01 dhclient[279]: DHCPREQUEST of 192.168.138.132 on eth0 to 192.168.138.254 port 67 (xid=0x5c3e468d)
2016-07-25T15:39:45+05:30 web01 dhclient[279]: DHCPACK of 192.168.138.132 from 192.168.138.254

2016-07-25T15:39:45+05:30 web01 dhclient[279]: fountain to 192.168.138.132 -- renewal inward 717 seconds



That's all

!!! Cheers !!!


Sumber https://linuxhowtoguide.blogspot.com/