Installing Liferay content management system on Raspberry PI - How to - CrowdComputing

Asset Publisher

Installing Liferay content management system on Raspberry PI

Installing Liferay content management system on Raspberry PI


Can you install a complex advanced content management system like  Liferay on a Raspberry PI? Yes. This site runs on Liferay  on a Raspberry Pi 2. It is not very fast, but it is fully functional. We installed Liferay 6.2 on a Raspberry Pi2 with a 16 Gbyte SD card. The network connection is Ethernet. We want to use it as s server.

How did we do it?

After downloading and flashing the Raspbian operating image to the SD card we started up the Raspberry Pi in Desktop mode (this is standard these days). Using raspi-config we then set the default mode to CLI, command line interface. We want to use it as a server so we do not want the Desktop environment to start up. The file system was also expanded. This was the last time we connected a screen and a USB keyboard to the system. The remaining configuration was done by remote login.

Liferay is Java based. It requires a lot of memory (for a Raspberry Pi). The standard Java VM size  is set at 1024 Mbyte. And sometimes, especially during the installation phase that is needed. In the Raspberry Pi 2 there is 1 Mbyte of memory. Non expandable. To be able to run anyway, we expanded the memory swap space. If the memory is completely used, additional space on the SD card can be used. We chose to expand the swap space to 2048 Mbyte. Perhaps less will be sufficient. But we did not try. Of course when the swap space is actually used it decreases performance a lot.

Standard steps:

sudo apt-get update

sudo apt-get upgrade

The enlarge the SWAP space. Look at Raspberry Pi: SWAP erweitern for more details.

pi@raspberrypi:~ $ sudo su -c 'echo "CONF_SWAPSIZE=2048" > /etc/dphys-swapfile'
pi@raspberrypi:~ $ sudo dphys-swapfile setup
want /var/swap=2048MByte, checking existing: deleting wrong size file (104857600), generating swapfile ... of 2048MBytes

pi@raspberrypi:~ $ sudo dphys-swapfile swapon

Next step is to create a user we call liferay. Could be abything, but we want to run Liferay under a user account other than the default user pi and not under root.

sudo adduser liferay

 

Then we install MYSQL. We want to run a production type of Liferay. Hence we need a separte database system.

 

sudo apt-get install mysql-server

Change the pasword for mysqsl user root.

 

Create user liferay in MYSQL and a database called lportal.  Of course you can choose other names too.

mysql> create user 'liferay'@'localhost'identified by 'chooseyourpassword'
    -> ;
Query OK, 0 rows affected (0.00 sec)

mysql> create database lportal;
Query OK, 1 row affected (0.01 sec)


mysql> grant all privileges on lportal.* to  'liferay'@'localhost' identified by 'chooseyourpassword' with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

Next we need to download and unzip the Liferay server. Go to https://www.liferay.com/downloads/liferay-portal/available-releases 

and select the latest community edition. Copy the download link (look for: "Problems with the download? Please use this direct link." on SourceForge) and use wget to download it to the Raspberry Pi.


For us it looked like the following sequence. For you the details for the filename, download mirror, etc. may be different.

wget "http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.2.5%20GA6/liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flportal%2Ffiles%2F%3Fsource%3Dnavbar&ts=1454532640&use_mirror=netix"
converted 'http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.2.5%20GA6/liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flportal%2Ffiles%2F%3Fsource%3Dnavbar&ts=1454532640&use_mirror=netix' (ANSI_X3.4-1968) -> 'http://downloads.sourceforge.net/project/lportal/Liferay Portal/6.2.5 GA6/liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip?r=http://sourceforge.net/projects/lportal/files/?source=navbar&ts=1454532640&use_mirror=netix' (UTF-8)
--2016-02-03 20:53:13--  http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.2.5%20GA6/liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip?r=http://sourceforge.net/projects/lportal/files/?source=navbar&ts=1454532640&use_mirror=netix
Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 216.34.181.59
Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://netix.dl.sourceforge.net/project/lportal/Liferay%20Portal/6.2.5%20GA6/liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip [following]
converted 'http://netix.dl.sourceforge.net/project/lportal/Liferay%20Portal/6.2.5%20GA6/liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip' (ANSI_X3.4-1968) -> 'http://netix.dl.sourceforge.net/project/lportal/Liferay Portal/6.2.5 GA6/liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip' (UTF-8)
--2016-02-03 20:53:13--  http://netix.dl.sourceforge.net/project/lportal/Liferay%20Portal/6.2.5%20GA6/liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip
Resolving netix.dl.sourceforge.net (netix.dl.sourceforge.net)... 87.121.121.2
Connecting to netix.dl.sourceforge.net (netix.dl.sourceforge.net)|87.121.121.2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 300963516 (287M) [application/octet-stream]
Saving to: 'liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip?r=http:%2F%2Fsourceforge.net%2Fprojects%2Flportal%2Ffiles%2F?source=navbar&ts=1454532640&use_mirror=netix'

liferay-portal-tomcat-6.2-c 100%[============================================>] 287.02M   186KB/s   in 26m 9s s

2016-02-03 21:19:22 (187 KB/s) - 'liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip?r=http:%2F%2Fsourceforge.net%2Fprojects%2Flportal%2Ffiles%2F?source=navbar&ts=1454532640&use_mirror=netix' saved [300963516/300963516]

converted 'http://liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip' (ANSI_X3.4-1968) -> 'http://liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip' (UTF-8)
--2016-02-03 21:19:22--  http://liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip/
Resolving liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip (liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip)... 127.0.53.53
Connecting to liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip (liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip)|127.0.53.53|:80... failed: Connection refused.
FINISHED --2016-02-03 21:19:22--
Total wall clock time: 26m 10s
Downloaded: 1 files, 287M in 26m 9s (187 KB/s)
pi@raspberrypi:~/Downloads $ ls
liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip?r=http:%2F%2Fsourceforge.net%2Fprojects%2Flportal%2Ffiles%2F?source=navbar&ts=1454532640&use_mirror=netix
pi@raspberrypi:~/Downloads $ mv "liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip?r=http:%2F%2Fsourceforge.net%2Fprojects%2Flportal%2Ffiles%2F?source=navbar&ts=1454532640&use_mirror=netix" liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip

Notice we renamed the file to "liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip"

We then move the file to the liferay user home directory and change the owner to liferay. Remember we want to run the Liferay portal under that user.

pi@raspberrypi:~/Downloads $ cd /home/liferay/
pi@raspberrypi:/home/liferay $ sudo chown liferay:liferay liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip

pi@raspberrypi:/home/liferay $ su liferay
Password:
liferay@raspberrypi:~ $ unzip liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip
Archive:  liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip
   creating: liferay-portal-6.2-ce-ga6/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/bin/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/conf/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/conf/Catalina/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/conf/Catalina/localhost/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/lib/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/lib/ext/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/logs/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/temp/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/temp/liferay/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/temp/liferay/com/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/temp/liferay/com/liferay/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/temp/liferay/com/liferay/portal/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/temp/liferay/com/liferay/portal/deploy/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/temp/liferay/com/liferay/portal/deploy/dependencies/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT/WEB-INF/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT/WEB-INF/classes/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT/WEB-INF/classes/META-INF/
   creating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT/WEB-INF/jsp/

and about 20.000 lines of other unzipping messages.

 inflating: liferay-portal-6.2-ce-ga6/tomcat-7.0.62/bin/version.sh  
   creating: liferay-portal-6.2-ce-ga6/data/
   creating: liferay-portal-6.2-ce-ga6/data/hsql/
  inflating: liferay-portal-6.2-ce-ga6/data/hsql/lportal.properties  
  inflating: liferay-portal-6.2-ce-ga6/data/hsql/lportal.script  
   creating: liferay-portal-6.2-ce-ga6/license/
  inflating: liferay-portal-6.2-ce-ga6/license/copyright.txt  
  inflating: liferay-portal-6.2-ce-ga6/license/versions.html  
  inflating: liferay-portal-6.2-ce-ga6/readme.html  
liferay@raspberrypi:~ $ ls
liferay-portal-6.2-ce-ga6  liferay-portal-tomcat-6.2-ce-ga6-20160112152609836.zip

 

The portal has been unzipped in the directory   liferay-portal-6.2-ce-ga6 .

From here on it is standard Liferay.

Go to /home/liferay/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/bin/ and start the Liferay server with ./startup.sh.

then wait for a long time (about half an hour) before the server has started. Then go to http://yourraspberryaddress:8080

in your browser. Again wait for some time. The first time you can enter your new login data and also tell the portal database on the MySQL server you just installed.

The portal is now ready for use.

Please note that next time you start up the server it again takes about 15 minutes to complete. Also the first time you access a servlet for the first time it can take a few minutes. But apart from that you have now a fully functional Liferay on a Raspberry Pi 2.