Setup Liferay 7.4 CE on Linux
Created: 19 November 2024 Modified:Steps to setup Liferay 7.4 CE
- Install and start Mariadb
Fedora shell commands
$ sudo dnf install mariadb
$ sudo dnf install mariadb-server
$ sudo systemctl enable mariadb
$ sudo systemctl start mariadb
$ sudo systemctl status mariadb
- Access Mariadb
Fedora Shell command
$ sudo mariadb
[sudo] password for user:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.11.10-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
- Create database and user. Grant permissions on database to user.
Mariadb commands
MariaDB [(none)]> create database lportal default character set utf8mb4 collate utf8mb4_unicode_ci;
MariaDB [(none)]> CREATE USER 'liferay'@'localhost' IDENTIFIED BY 'liferay';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON lportal.* TO 'liferay'@'localhost';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> SHOW GRANTS FOR 'liferay'@'localhost';
MariaDB [(none)]> quit
- Install Java JDK 17
Fedora shell commands
$ sudo dnf install java-17-openjdk
- Download Liferay CE. Extract the zip file and place the resulting liferay-portal directory in your home directory.
- Create a portal-ext.properties file in your home directory. Put the following entries into the file.
portal-ext.properties
jdbc.default.driverClassName=org.mariadb.jdbc.Driver
jdbc.default.url=jdbc:mariadb://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=liferay
jdbc.default.password=liferay
server.tomcat.main.host=localliferay
- Start Liferay CE server
Fedora Shell
$ cd ~/liferay-portal/tomcat/bin
$ ./startup.sh
Using CATALINA_BASE: /home/chris/liferay-portal/tomcat
Using CATALINA_HOME: /home/chris/liferay-portal/tomcat
Using CATALINA_TMPDIR: /home/chris/liferay-portal/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /home/chris/liferay-portal/tomcat/bin/bootstrap.jar:/home/chris/liferay-portal/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS: -Dfile.encoding=UTF-8 -Djava.locale.providers=JRE,COMPAT,CLDR -Djava.net.preferIPv4Stack=true -Duser.timezone=GMT -Xms2560m -Xmx2560m -XX:MaxNewSize=1536m -XX:MaxMetaspaceSize=768m -XX:MetaspaceSize=768m -XX:NewSize=1536m -XX:SurvivorRatio=7
Tomcat started.
- View log file located ~/liferay-portal/logs/liferay.2024-11-18.log. Example first start log file. There should not be errors and there should be several BundleSiteInitializer log entries
log file excerpt
2024-11-18 17:15:36.424 INFO [http-nio-8080-exec-1][BundleSiteInitializer:493] Initializing com.liferay.site.initializer.welcome for group 20117
2024-11-18 17:15:36.481 INFO [http-nio-8080-exec-1][BundleSiteInitializer:5547] Invoking addOrUpdateExpandoColumns took 8 ms
2024-11-18 17:15:36.485 INFO [http-nio-8080-exec-1][BundleSiteInitializer:5547] Invoking addSiteSettings took 0 ms
2024-11-18 17:15:36.487 INFO [http-nio-8080-exec-1][BundleSiteInitializer:5547] Invoking addOrUpdateOrganizations took 0 ms
2024-11-18 17:15:36.488 INFO [http-nio-8080-exec-1][BundleSiteInitializer:5547] Invoking addAccounts took 0 ms
2024-11-18 17:15:36.489 INFO [http-nio-8080-exec-1][BundleSiteInitializer:5547] Invoking addOrUpdateSAPEntries took 0 ms
2024-11-18 17:15:36.490 INFO [http-nio-8080-exec-1][BundleSiteInitializer:5547] Invoking addOrUpdateUserGroups took 0 ms
- Stop Liferay
Fedora shell command
$ cd ~/liferay-portal/tomcat/bin
$ ./shutdown.sh
Using CATALINA_BASE: /home/chris/liferay-portal/tomcat
Using CATALINA_HOME: /home/chris/liferay-portal/tomcat
Using CATALINA_TMPDIR: /home/chris/liferay-portal/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /home/chris/liferay-portal/tomcat/bin/bootstrap.jar:/home/chris/liferay-portal/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS: -Dfile.encoding=UTF-8 -Djava.locale.providers=JRE,COMPAT,CLDR -Djava.net.preferIPv4Stack=true -Duser.timezone=GMT -Xms2560m -Xmx2560m -XX:MaxNewSize=1536m -XX:MaxMetaspaceSize=768m -XX:MetaspaceSize=768m -XX:NewSize=1536m -XX:SurvivorRatio=7
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-opens=java.base/sun.util.calendar=ALL-UNNAMED --add-opens=jdk.zipfs/jdk.nio.zipfs=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
- Disable firewall if needed. Set hostname.
Fedora shell commands
$ sudo systemctl disable firewalld
$ sudo systemctl stop firewalld
$ sudo hostnamectl set-hostname fedora-liferay-1
- Start Liferay
- On the server connect to http://localhost:8080 using browser.
- Enter email test@test.com
- Verify database connection information matches what was placed in portal-ext.properties
- Go to Control Panel -> Instance Settings -> Platform -> Instance Configuration -> General
- Update Virtual Host to locallifary
- Restart Liferay
- Update server /etc/hosts file with entry 127.0.0.1 localliferay
- Update client PC C:\Windows\System32\drivers\etc\hosts with ip address of server and localliferay