Liferay Installation Shell Script | KNOWARTH Technologies
  • Services
    Close
      • Enterprise Services
      • Enterprise Portal Development
      • eCommerce Portal Development
      • Enterprise Integration Services
      • ERP Implementation
      • Magento Development Services
      • Cloud and Infrastructure Management
      • Cloud Infra & Management Services
      • Remote Infra Management Services
      • DHIS2 Cloud Hosting Services
      • Consulting Services
      • UX & UI Consulting Services
      • Architectural Consulting Services
      • Performance Tuning & Assessment
      • Liferay Consulting Services
      • DevOps Consulting Services
      • Software Testing Services
      • Software Testing Services
      • Custom Application Development
      • Single Page Application Development
      • Mobile App Development
      • Android Application Development
      • iOS App Development
    Close
  • Solutions
    Close
      • Digital Experience Platform
      • Collaboration Portal Development
      • Intranet Portal Development
      • Enterprise Content Management System
      • Human Resource Management System
      • Hospital Management System
      • Learning Management System
      • Community Portal Development
      • Partner Portal Development
      • Liferay Enterprise Solutions
      • Liferay Portal Development
      • Liferay Migration and Upgrade Services
      • Liferay Consulting Services
      • Liferay Performance Tuning
      • Enterprise Mobility Solutions
      • Network Monitoring Solutions
    Close
  • Products
    Close
      • HRMS
      • Commercium
    Close
  • Resources
    Close
      • Blogs
      • News
      • Events
      • Case Studies
      • White Papers
      • Books
    Close
  • Portfolio
  • en EN
    ar ARnl DUen ENfr FRid INms MAru RS
Inquire Now
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Inquire Now
  • Home
  • Services
    • Enterprise Services
      • Enterprise Portal Development
      • eCommerce Portal
      • Enterprise Integration Services
      • ERP Implementation
      • Magento Development Services
    • Cloud and Infrastructure Management
      • Cloud Infrastructure Management Services
      • Remote Infrastructure Management Services
      • Cloud Hosting Services DHIS2
    • Quality Assurance
      • Software Testing Services
    • Custom Application Development
      • Single Page Application Development
    • Mobile App Development
      • Android Application Development
      • iOS App Development
  • Consulting
    • UX & UI Consulting
    • Architectural Consulting Services
    • Performance Tuning & Assessment
    • Liferay Consulting Services
    • DevOps Consulting Services
  • Solutions
    • Digital Experience Platform
      • Collaboration Portal Development
      • Intranet Portal Development
      • Enterprise Content Management System
      • Hospital Management System
      • Learning Management System
      • Human Resource Management System
      • Community Portal Development
      • Partner Portal Development
    • Enterprise Mobility Solutions
    • Network Monitoring Solutions
  • Products
  • Technologies
  • Resources
    • Case Studies
    • Blogs
    • White Papers
  • Company
    • Who We Are
    • Career
    • Partners
    • News & Events
  • Contact
  1. >
  2. Technologies
  3. >
  4. Liferay Installation Shell Script
940 Share
0
0
0
0
0
Liferay-Installation-Shell-Script-featured
940 Share
0
0
0
0
0

Liferay Installation Shell Script

This script is useful to automate installation of Liferay in Linux. Script is created in Bash/Shell.

  • It is limited to run on Linux
  • Tomcat is used as application server
  • MySQL is used as database.

Below are the pre-requisites for same.

  1. Super-user privileges for System and MySQL.
  2. Liferay installations repository should be available via Web
 #!/bin/bash

# Script to add a user to Linux system

if [ $(id -u) -eq 0 ]; then

read -p “Enter System username : ” username

read -p “Enter System password : ” password

read -p “Enter Directory path : ” dirpath

read -p “Enter mysql root password : ” mysqlpwd

read -p “Enter DB Name : ” dbname

read -p “Enter DB password : ” dbpwd

read -p “Enter Tomcat Port : ” tomcatport

read -p “Enter Tomcat Shutdown Port : ” tomcatshutport

read -p “Enter DomainName : ” domainname

#Request for Liferay Version from Web Server

wgetoptions=”wget http://URL/liferay.txt”

wgetfile=”liferay.txt”

liferayfile=”liferayfile.txt”

rm -f $wgetfile $liferayfile

$wgetoptions

cat $wgetfile | cut -d “.” -f2-10 | sort -rn > liferayfile.txt

IFS=”

”

select x in $(<./liferayfile.txt) do break done #Verify Username egrep “^$username” /etc/passwd >/dev/null

if [ $? -eq 0 ]; then

echo “$username exists!”

exit 1

else

pass=$(perl -e ‘print crypt($ARGV[0], “password”)’ $password)

useradd -m -p $password $username

[ $? -eq 0 ] && echo “User has been added to system!” || echo “Failed to add a user!”

fi

else

echo “Only root may add a user to the system”

exit 2

fi

#Verify MySql root login

mysql -u root -p”${mysqlpwd}” -e “use mysql;” 2> /dev/null

if [ $? -ne 0 ]

then

echo “Unable to login to MySQL.”

exit 1

fi

#Verify Directory path

if [[ -L ${dirpath} || -e ${dirpath} ]]; then

echo “Directory path Exists”

exit 1

else

mkdir ${dirpath}

fi

#Verify Tomcat port

STAT=`netstat -na | grep :${tomcatport} | awk ‘{print $6}’`

if [ “$STAT” = “LISTEN” ]; then

echo “TOMCAT PORT IS already LISTENING”

exit 1

fi

#Download and Unzip Liferay

wget -P ${dirpath} http://192.168.102.226/Liferay$x

zipfile=$(echo “${x}” | sed ‘s/.*\///’)

unzip -q “${dirpath}/${zipfile}” -d ${dirpath}

[ $? -ne 0 ] && echo “Failed unzipping $zipfile” >&2

rm -f “${dirpath}/${zipfile}”

#Tomcat Locations

tomcatlo=”${dirpath}”/$(ls “${dirpath}” | grep liferay-portal)

tomcatloc=”${tomcatlo}”/$(ls “${tomcatlo}” | grep tomcat)

#Download MySQL jar file

wget -P ${tomcatloc}/lib/mysql.jar http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.0.7/mysql-connector-java-5.0.7.jar

#Setup MySQL DB for liferay

mysql -u “root” -p”${mysqlpwd}” -e “use ${dbname};” 2> /dev/null

if [ $? -ne 0 ]; then

# Database doesn’t exist. Create it.

mysql -u root -p${mysqlpwd} -e “create database ${dbname} character set utf8;”

mysql -u root -p${mysqlpwd} -e “GRANT ALL ON ${dbname}.* TO ‘${dbname}’@’localhost’ identified by ‘${dbpwd}';”

mysql -u root -p${mysqlpwd} -e “flush privileges;”

else

echo “Database ‘${dbname}’ already exists.”

exit 1

fi

#Create Portal-ext.properties

echo “jdbc.default.driverClassName=com.mysql.jdbc.Driver

jdbc.default.url=jdbc:mysql://localhost/${dbname}?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false

jdbc.default.username=${dbname}

jdbc.default.password=${dbpwd}

schema.run.enabled=true

schema.run.minimal=true” > $tomcatlo/portal-ext.properties

#Set Tomcat Memory

#sed -i ‘3 a export JAVA_OPTS=”-server -Xms512m -Xmx2048m -XX:MaxPermSize=512m -Dfile.encoding=UTF8 -Duser.timezone=GMT”‘ $dirpath/bin/catalina.sh

#Set Permissions

chown -R ${username}:${username} ${dirpath}

chmod -R 777 ${dirpath}

#Setup Ports

sed -i “s/8080/${tomcatport}/” ${tomcatloc}/conf/server.xml

sed -i “s/8005/${tomcatshutport}/” ${tomcatloc}/conf/server.xml

#Add Virtualhost in Apache

echo ”

ServerName ${domainname}.domain.com

ServerAdmin admin@domain.com

DocumentRoot ${dirpath}

ErrorLog logs/${domainname}.domain.com-error_log

CustomLog logs/${domainname}.domain.com-access_log common

ProxyPreserveHost On

ProxyPass / http://localhost:${tomcatport}/

ProxyPassReverse / http://localhost:${tomcatport}/

” >> /etc/httpd/conf/httpd.conf

/etc/init.d/httpd restart

#Start liferay/tomcat and wait to finish, clean log first because of greps below

echo > $tomcatloc/logs/catalina.out

$tomcatloc/bin/startup.sh

echo ” Enjoy Liferay!!” 
Join our mailing list to get the latest updates! We will not spam you.
Loading

Related Blogs

Message-from-management

Address Customers’ Needs & Forge Stronger Ties

https://www.knowarth.com/wp-content/uploads/2020/06/Message-from-management.jpg 400 1140 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2020-06-29 19:33:182020-06-29 19:34:50Address Customers’ Needs & Forge Stronger Ties
Vinita

Insider Note - Enable Remote Workplaces to Quickly Adapt to a Changing Paradigm

https://www.knowarth.com/wp-content/uploads/2020/05/vinita-blog-1.png 400 1140 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2020-05-06 19:16:042020-05-07 17:31:59Insider Note - Enable Remote Workplaces to Quickly Adapt to a Changing Paradigm
Chintan Shah

Voice of Reason: Prepare Better for Operational Continuity

https://www.knowarth.com/wp-content/uploads/2020/05/chintan-shah-blog-1.png 400 1140 Chintan Shah https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png Chintan Shah2020-05-06 18:21:102020-05-07 17:56:11Voice of Reason: Prepare Better for Operational Continuity
CM Talks

CM Talks

https://www.knowarth.com/wp-content/uploads/2020/04/cm-talks.png 400 1140 Chintan Mehta https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png Chintan Mehta2020-04-29 15:41:412020-04-29 17:19:21CM Talks
More Blogs

Services

  • Enterprise Portal Development
  • eCommerce Portal Development
  • Cloud Infra & Management Services
More Services

Solutions

  • Enterprise Content Management System
  • Learning Management System
  • Hospital Management System
More Solutions

Categories

Enterprise Technologies

Related Case Studies

SAAS based productivity management suite

SAAS based productivity management suite

https://www.knowarth.com/wp-content/uploads/2017/02/SAAS-based-productivity-management-suite.jpg 657 1920 Krupal Khatri https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png Krupal Khatri2017-02-28 15:19:302017-02-28 16:39:41SAAS based productivity management suite
Hospital Management System with Secure Mobile Application

Hospital Management System with Secure Mobile Application

https://www.knowarth.com/wp-content/uploads/2016/12/Hospital-Management-System-with-Secure-Mobile-Application.jpg 657 1920 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2016-12-30 17:41:182017-01-27 22:48:33Hospital Management System with Secure Mobile Application
LIFERAY Clustering with enhanced Security

LIFERAY Clustering with enhanced Security

https://www.knowarth.com/wp-content/uploads/2016/11/LIFERAY-Clustering-with-enhanced-Security.jpg 657 1920 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2016-11-22 19:39:172017-01-30 11:35:59LIFERAY Clustering with enhanced Security
Amazon Web Services (AWS) to Open Stack Migration

Amazon Web Services (AWS) to Open Stack Migration

https://www.knowarth.com/wp-content/uploads/2016/11/Amazon-Web-Services-AWS-to-Open-Stack-Migration.jpg 657 1920 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2016-11-22 17:51:202017-01-30 11:46:29Amazon Web Services (AWS) to Open Stack Migration

Audit, Document Management and Collaboration Platform

https://www.knowarth.com/wp-content/uploads/2016/11/Case-Study-Audit-Document-Management-and-Collaboration-Platform.jpg 677 1400 KNOWARTH Admin https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png KNOWARTH Admin2016-11-22 15:16:142017-01-30 14:51:46Audit, Document Management and Collaboration Platform
Continuous Integration & Deployment Using Chef, AWS Code

Continuous Integration & Deployment using Chef, AWS Code Deploy and AWS OpsWork

https://www.knowarth.com/wp-content/uploads/2016/05/Continuous-Integration-Deployment-Using-Chef-AWS-Code.jpg 657 1920 Chintan Mehta https://www.knowarth.com/wp-content/uploads/2020/09/knowarth-anblicks-white.png Chintan Mehta2016-05-24 15:50:112017-01-30 14:53:39Continuous Integration & Deployment using Chef, AWS Code Deploy and AWS OpsWork
PreviousNext

Follow Us

HRMS-ad-new
MySQL8 For Big Data
Mastering Apache Solr 7.x

Latest Tweets

Tweets by @KNOWARTH
Chintan Mehta
By Chintan Mehta
March 12, 2014

Services

  • Enterprise Portal Development
  • Liferay Consulting Services
  • Mobile App Development
  • Software Testing Services
  • ERP Implementation
  • RIM Services
  • View All Services

Solutions

  • Liferay Portal Development
  • Liferay Migration and Upgrade
  • Digital Experience Platforms
  • Enterprise Mobility Solutions
  • IT Monitoring Solutions
  • Learning Management System
  • View All Solutions

Products

  • Commercium
  • HRMS

Resources

  • Case Studies
  • Blogs
  • Events
  • White Paper
  • Books

Company

  • Who We Are
  • Career
  • Our Partners
  • Our Clients
  • Cookie Policy

ANZ: +61 423 683 702
APAC: +91 98664 98179
USA: +1 (408) 656-6493
marketing@anblicks.com
HAProxy-featured HAProxy Load balancer Configuration
Scroll to top

Schedule A Consultation

Field marked * are mandatory.