Monday, November 27, 2017

Install Apache Maven

1. This assumes you already have Java 7+ already up and running:

java -version

 

2. Download latest Apache Maven package from https://maven.apache.org/download.cgi

and move it to /usr/local folder.

Alternatively you can download directly on your linux instance using wget:

wget http://www-eu.apache.org/dist/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz

3. Untar the zip:

sudo tar xzf apache-maven-3.5.2-bin.tar.gz

4. It is by default extracted to an apache-maven-3.5.2 folder. For ease, can create a symbolic link for maven:

ln -s apache-maven-3.5.2  maven

5. Get proper path in place:

export PATH=/usr/local/maven/bin:${PATH} 

6. Test by checking maven installed version:

mvn -version



7. To make it work, it also needs a settings.xml file. This file needs to be under /home/user/.m2 folder and can have following sections:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">


<localRepository>/user/local/.m2/repository</localRepository><interactiveMode>true</interactiveMode>
<usePluginRegistry>false</usePluginRegistry>
<offline>false</offline>
<pluginGroups>
</pluginGroups>
<servers/>

<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>

8. If you have an already existing project, you can test from within project folder the following command - it shall build succesfully and download any dependency to the repository:

mvn clean install -s /home/user/.m2/settings.xml






Cent OS - Enable NTPD to synch datetime

1. Install ntpd service:

yum install ntp


3. Start ntpd service and make sure it is also enabled:

systemctl start ntpd
systemctl enable ntpd
systemctl status ntpd


4. Run following command and make sure date is properly updated:

date

Sunday, November 26, 2017

Find out Maven (mvn) home directory

Just run the following command:

mvn -v

You'll get a line as the below with Maven home:

Maven home: /usr/share/maven

Start Apache Sling environment on CentOS

1. Download latest Sling version from:
https://sling.apache.org/downloads.cgi

2. Copy jar file to your desired location on CentOS

3. Start Apache Sling using the following command:
java -jar org.apache.sling.launchpad-8.jar

4. You'll get starting status right on the screen:



5. Also you get logs under:
/slinghome/sling/logs

Here you can properly tail error.log to see what's going on:
tail -500f error.log

6. As you can see from step 4, Sling by default starts on port 8080. As for that you can launch IP:8080 and get Sling Welcome Page:

 



7. Admin Console is also accessible at IP:8080/system/console. Please be aware that default user/pass is admin/admin: