Liferay is a free and open source enterprise portal software. It is written in Java and uses MySQL to store its data. Liferay is a suite of different business related applications. It consists of many different features such as Alerts and Announcements, document library integration, Asset Publishing, Blogs, Calendar, Chat, Document and Image management, Knowledge Base, LDAP Integration, Mail, Message Boards, Polls, Software Catalog, Themes, User Directory, Web Content, Web Form Builder, WebDAV Integration, Wiki etc. It can be used in different sectors of industries like banking, healthcare, government, retail or manufacturing etc. This application is very popular and used by many prominent companies like Allianz, HP, Domino's, BOSCH, US Bank etc.
In this tutorial, we will install Liferay on CentOS 7 server.
Liferay requires at least 2GB of RAM to run Java. All the required dependencies will be installed throughout the tutorial. You will need a minimal installation of CentOS 7 with root access on it. If you are logged in as a non-root user, you can run sudo -i to switch to root user.
Before installing any package it is recommended that you update the packages and repository using the following command.
yum -y update
Liferay runs on both OpenJDK and Oracle JAVA. In this tutorial, we will install the latest version of Oracle Java into the server. Run the following commands for same.
If you do not have wget installed, you can run the yum -y install wget to install wget. Now install the downloaded RPM using the following command.
yum -y localinstall jdk-8u131-linux-x64.rpm
You can now check the java version using the following command.
You will get the following output.
[root@liptan-pc ~]# java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
Once you install Java, you can download the Liferay application bundled with Apache Tomcat. Apache Tomcat is an application server used to serve java application. Run the following command to download Liferay.
cd /varwget https://downloads.sourceforge.net/project/lportal/Liferay%20Portal/7.0.2%20GA3/liferay-ce-portal-tomcat-7.0-ga3-20160804222206210.zip -O liferay.zip
If you don't have unzip installed, you can run yum -y install unzip. The above command will extract the content of the archive to liferay-ce-portal-7.0-ga3/ directory. Rename the directory to liferay using the following command.
mv liferay-ce-portal-* liferay
To use MySQL database with the application, you will need to install MySQL first. Run the following command to install MySQL/MariaDB on your system.
yum -y install mariadb mariadb-server
To start MariaDB and enable it to start at boot time using the following commands.
systemctl start mariadbsystemctl enable mariadb
Now run the following commands to secure your MySQL or MariaDB installation.
It will run a small script which asks you to provide the root password for MariaDB. As we have just installed MariaDB, the root password is not set, just press enter to proceed further. It will ask you if you want to set a root password for your MariaDB installation, choose y and set a strong password for the installation. It will also ask you for removing test databases and anonymous users. Most of the questions are self-explanatory and you should answer yes or y to all the questions.
Now you will need to create a new file to enter MySQL details. Run the following command to create a new portal-ext.properties.
If you do not have nano installed, you can run yum -y install nano. Now paste the following text into the nano editor. Now paste the following lines into the file. Change your MySQL root password with the password you set earlier.
Now that the database server is ready, you can set up a systemd service so that it can be managed as a service and can be automatically started on failures and boot time. Run the following command to create a systemd service file.
Copy and paste the following code into the editor.
Description=Liferay Tomcat service
Now you can start Liferay server and configure it to automatically start at boot time using following commands.
systemctl start liferaysystemctl enable liferay
To check if Liferay service is started correctly, you can run the following command to check the status of the Liferay service.
systemctl status liferay
You should get output similar to shown below.
[root@liptan-pc ~]# systemctl status liferay
● liferay.service - Liferay Tomcat service
Loaded: loaded (/etc/systemd/system/liferay.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2017-05-22 19:27:22 UTC; 10s ago
Process: 16141 ExecStart=/var/liferay/tomcat-8.0.32/bin/startup.sh (code=exited, status=0/SUCCESS)
Main PID: 16155 (java)
└─16155 /usr/bin/java -Djava.util.logging.config.file=/var/liferay/tomcat-8.0.32/conf/logging.properties -Dja...
May 22 19:27:22 liptan-pc systemd: Starting Liferay Tomcat service...
May 22 19:27:22 liptan-pc liferay: Tomcat started.
May 22 19:27:22 liptan-pc systemd: Started Liferay Tomcat service.
You can now access your web application on the following URL through your favorite web browser.
Instead of using the application on Port 8080, you can use Apache to run on port 80 or 443 in the case of using SSL. This way the main application will run on port 8080, and Apache will work as a reverse proxy. Install Apache web server and mod_ssl using the following command.
yum -y install httpd mod_ssl
Now start Apache web server and enable it to automatically start at boot time using the following commands.
systemctl start httpdsystemctl enable httpd
Now we will need to generate SSL certificates from Let's Encrypt client. If you can want to use commercial SSL certificates instead, you can purchase SSL certificates from HostPresto.
To install Let's Encrypt client also called Certbot, You will need to add EPEL repository also. Run the following command for same.
yum -y install epel-releaseyum -y update
Now install Certbot using the following command.
yum -y install python-certbot-apache
Once the installation finishes, run the following command to obtain the SSL certificates from Let's Encrypt. Make sure that your domain is pointed to the server, the Let's Encrypt will check the domain authority before providing the certificates.
certbot certonly --apache -d yourdomain.com
This command will run Let's Encrypt client to obtain the certificates only but not to install it. It may ask you which SSL configuration to use during authentication, choose ssl.conf. Finally, provide your email address and accept the terms and condition. Once the certificates are generated, they are likely to be stored in the following directory.
Where yourdomain.com is your actual domain. In the directory, you will find cert.pem which is your domains certificate and privkey.pem which is your certificate's private key.
Let's Encrypt SSL expires in 90 days, so it is recommended to set an automatic renewal for your certificates. Run the following command to open your crontab file.
crontab -e Enter the following line into the crontab file.
In the above configuration change yourdomain.com to your actual domain. Also, make sure that the path to your SSL certificate and private key are correct. Once done, you will have to restart your Apache server so that the changes made can take effect.
systemctl restart httpd
Now you will need to disable your SELinux because reverse proxy creates errors with SELinux policies. To temporary disable SELinux without restarting the server, run the following command.
To completely disable the SELinux you will need to edit /etc/selinux/config file.
Find the following line:
Change it to:
Now you will need to reboot your server so that the new configuration can take effect. Now you can start the Liferay service if not started already using the following command.
systemctl start liferay
You can now browse the following URL in your favorite browser.
You will see the following page to enter basic configuration.
Enter your portal name, choose a language and provide Administrator details. Select the database type as MariaDB and provide the root username and password again. Click Finish Configuration button once done. You will be shown the terms and conditions to use the software, click I Agree to proceed. Now you will need to provide the password and password hint for the admin account. Finally, you will be taken to your portal dashboard which will look like shown below.
If you find your cPanel disk space filling up, or an email address has hit its disk space quota, cPanel has a helpful built in Email Disk Usage tool. This will provide you with a simple to understand breakdown of how much disk space each folder for a particular email...
Although WHM will normally automatically keep itself up to date, you may want to manually check for server updates / push through an update that is pending, or it may be that you have automatic updates switched off on your cPanel server. In this guide we will show you how...
You may sometimes need to manually adjust the PHP settings on your cPanel server – for example if a site is hitting the PHP memory, or file size upload limit. WHM allows you to quickly change the settings of any PHP version installed on the server when needed, using the...