Thursday, February 13, 2020

Updating the password of a user in MySQL

Hi All,

In this post I will be giving you the hints to update the password of a user in MySql Database Server...

This is going to be a very short post, hope you like it....

There are many ways to achieve this, but the one I am going to talk about is straight forward SQL statement...

Well before you try to do what is going to be said, have the user credentials of the root user of mysql handy....

Let's start it...

This post assumes that you have the mysql database server installed and running.

Logging in as root user

Log into the database server as root

Open up a command line window and fire the command given below...

> mysql -u root -p

The above command would prompt you to key in the password, provide the one associated with the account.

You should be having the mysql prompt now to proceed...

The general form the SQL command is given below, you can change the statement and execute it accordingly...

UPDATE mysql.user SET authentication_string=PASSWORD('<password>') WHERE USER='<username>';

For Eg...

UPDATE mysql.user SET authentication_string=PASSWORD('welcome') WHERE USER='admin';

Well that is it and now you can query the database to confirm the change using the command below....

> SELECT `User`, authentication_string FROM mysql.`user` where User = '<username>';

This post is concluded here and I hope you had great time.

Thanks.


Tuesday, February 11, 2020

Creating a simple and new site helloworld.com using Apache Web Server in Ubuntu

Hi All,

In this post i am going to talk about creating a simple site called "helloworld.com" using Apache Web Server in Ubuntu

The details discussed or furnished here is not specific to a particular version of ubuntu, you can apply these steps to other version of ubuntu as well...

Without wasting time let us get on with business...

Installation of Apache Web Server

The first and foremost steps involved in the process is the installation of Apache Web Server, usually the ubuntu distributions comes along with apache web server pre-installed but if you do not find one in the distribution you use, you can install the same using the following commands

> sudo apt update
> sudo apt install apache2

Make sure the above commands executed successfully...

if the command executions were successfull, we could confirm the same using the browser by typing the address "localhost" in the address bar and the browser should display a page something like the one given below...



Creating folder and files

Open up a terminal, and fire the commands below at the prompt...

> cd /var/www
> sudo mkdir /var/www/helloworld
> cd /var/www/helloworld
> sudo touch index.html

Open the file "index.html" using your favourite text editor, in my case it is going to be "vi" and fill in the file with some test contents as given below
sudo vi index.html
<html>
<head>
  <title> HelloWorld </title>
</head>
<body>
  <p> Greeting from HelloWorld.</p>
</body>
</html>

Save the file and exit from the text editor.

Virtual Host Configuration

Open a terminal and fire the command at the prompt one after the other...

> cd /etc/apache2/sites-available/
> sudo cp 000-default.conf helloworld.conf
> sudo vi helloworld.conf

now is the time to update the newly created or copied configuration file called "helloworld.conf"

There are three important configuration items you could see in the configuration file...

1. ServerAdmin
2. DocumentRoot
3. ServerName

Now update these configuration items accordingly, I believe the above mentioned configuration items are self explanatory in case if you want an example you can refer below...

Example:

ServerAdmin      admin@helloworld.com
DocumentRoot   /var/www/helloworld/
ServerName       helloworld.com
With that we have finished the virtual host configuration.

Updating hosts file

We have to include the domain "helloworld.com" in the hosts configuration file, to do that...

Open a terminal and execute the command below...
> sudo vi /etc/hosts

Include the host configuration as mentioned below...



Save the file and exit form the text editor.

Activating VirtualHost

We are at the final step to have our site up and running...

Open a terminal and navigate to the location of the file "helloworld.conf" i.e as given below...
> cd /etc/apache2/site-available

Fire the below commands to have the site activated...
> sudo a2ensite helloworld.conf
> service apache2 reload

Testing
Open up a browser and hit the address bar with the following address...

"helloworld.com"

You should have something like the image given below....

Well that is it, we have successfully created a new site using Apache Web Server.

Hope you had great time reading...

Thanks.


Thursday, October 31, 2019

Import and Upgrade of Liferay-6.2.0 Theme to Liferay-7.1.0 using NPM, Yeoman and Gulp in Ubuntu

In this post, we are going to discuss how to import and upgrade liferay-6.2.0 portal themes to liferay-7.1.0 themes.

Follow the instructions carefully to have a successful import and upgrade....

Before we Import and Upgrade, there are pre-requisites has to be met, make sure you have following tools available in your local environment.

Prerequisites
Name Version Download Page Direct Link
Node 11.15.0 Node Package Manager Download Page Click to Download Directly

You can use the following links to install Node Package Manager, Yeoman and Gulp.

Installation of Node Package Manager
The node package manager version given in the pre-requisite secition is different than the one that is mentioned in the link, but the installation procedure remains the same
Node Package Manager Installation

Installation of Yeoman and Gulp
Yeoman and Gulp Installation

Import and Upgrade of Liferay 6.2.0 Theme

Import of liferay-theme is a straight forward approach, but the way I want to discuss here is slightly different than the one what has been said in other tutorials or articles. I am not going to refer 6.2.0 theme directly instead I make a copy of it in a separate workspace and then import the same...

To have this done, follow the instructions carefully....

Open a terminal and navigate to one of your favourite locations and create folders to hold the components of the theme...

> mkdir hello-world-theme
> mkdir -p hello-world-theme/docroot
> mkdir -p hello-world-theme/docroot/_diffs
> mkdir -p hello-world-theme/docroot/WEB-INF

Now create the following files as mentioned....

> touch hello-world-theme/build.xml
> touch hello-world-theme/docroot/WEB-INF/liferay-look-and-feel.xml
> touch hello-world-theme/docroot/WEB-INF/liferay-plugin-package.properties

Updating build.xml file
Copy and Paste the content given below in build.xml file.

<?xml version="1.0"?>
<!DOCTYPE project>

<project name="hello-world-theme" basedir="." default="deploy">
<import file="../build-common-theme.xml" />

<property name="theme.parent" value="_styled" />
</project>

Updating liferay-look-and-feel.xml
Copy and Paste the below contents to liferay-look-and-feel.xml file and save it.

<?xml version="1.0"?>
<!DOCTYPE look-and-feel PUBLIC "-//Liferay//DTD Look and Feel 6.2.0//EN" "http://www.liferay.com/dtd/liferay-look-and-feel_6_2_0.dtd">

<look-and-feel>
<compatibility>
<version>6.2.1+</version>
</compatibility>
<theme id="hello-world-theme" name="hello-world-theme">
<template-extension>ftl</template-extension>
<color-scheme id="01" name="Green">
<css-class>theme_green</css-class>
<color-scheme-images-path>${images-path}/color_schemes/green</color-scheme-images-path>
</color-scheme>
<color-scheme id="02" name="Orange">
<css-class>theme_orange</css-class>
<color-scheme-images-path>${images-path}/color_schemes/orange</color-scheme-images-path>
</color-scheme>
</theme>
</look-and-feel>

Updating liferay-plugin-package.properties file
Copy and Paste the following content in liferay-plugin-package.properties file and save it.

name=hello-world-theme
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
long-description=
change-log=
page-url=http://www.liferay.com
author=Liferay, Inc.
licenses=LGPL
liferay-versions=6.2.0+

#required-deployment-contexts=\
#    resources-importer-web

resources-importer-developer-mode-enabled=true

Now Copy and Paste the folders available in _diffs folder of the original 6.2.0 theme folder to the _diffs of hello-world-theme/docroot/_diffs

We are almost at the end of making things right...

Importing 6.2.0 Theme
Now everything is set to import the theme from 6.2.0 to 7.1.0

Run the command below to import the theme..
> yo liferay-theme:import
The above command would ask you to provide the absolute path of the theme folder, provide the one we have just created in previous steps...

You can refer the same in the image given below... in case you need it.


The console looks the one below when you provide the absolute path of the theme's root folder.


Press enter to execute the import.


At the end of the command execution, the console window ask you to provide the absolute path to the local application server, please provide the one which you have installed in your local machine.

In my case, I have given the Tomcat Application Server associated with the liferay portal, the image below would detail it in a comprehensive manner...



Once the theme is imported successfully we will have the directory called hello-world-theme in our workspace.
> cd hello-world-theme
> ls

Use the above command to check it out, you should see something like the one given in the image below..


This concludes the import of liferay 6.2.0 theme.

Theme Upgrade from 6.2.0 to 7.1.0

Now we have successfully imported the theme, the next step is to upgrade it to 7.1.0.

To upgrade the 6.2.0 theme to 7.1.0, use the following command

> gulp upgrade

The execution of the above command is depicted in pictures given below...the images are self explanatory.












This upgrade process converts the components from 6.2.0 to 7.1.0 to its best, but there would be certain errors which has to be fixed manually.

Correcting errors manually is a daunting task but ..... "Patience is a virtue".

This concludes the upgrade of liferay 6.2.0 themes to 7.1.0

Thanks.

Wednesday, October 30, 2019

Creating Liferay 7.1.0 Layout using NPM, Yeoman and Gulp

Hi

This blog post talks about creating liferay 7.1.0 layout using NPM, Yeoman and Gulp. There are many ways liferay offers developing layout for the theme, using the above mentioned tools is yet an other way of developing the same.

Without wasting much of our time lets get it started...

Before you start developing or creating layout, you should have the following prerequisites to proceed..

Prerequisites
Name Version Download Page Direct Link
Node 11.15.0 Node Package Manager Download Page Click to Download Directly

The afore mentioned tool(s) should be installed and to install the same you can refer an other post(s) by visiting the links given below...

Installation of Node Package Manager
The node package manager version given in the pre-requisite secition is different than the one that is mentioned in the link, but the installation procedure remains the same
Node Package Manager Installation

Installation of Yeoman and Gulp
Yeoman and Gulp Installation

Creating Liferay 7.1.0 Layout
To creat a layout, Open a terminal and fire the command below...

> yo liferay-theme:layout

The above command would initiate an interactive session with the user, as a user we have to answer those questions to have the layout to be deployed, the interactive session would appear something like the one given in the picture below...


Provide the name of the layout, in our case let the name be test-one,  The image given below compiles out the questions we answered and let us analyse each one of them



From the image above,

The first two questions takes in test-one as the name and id of the layout, the third question questions the liferay version we are using.

From here on, the questions are much concerned about the divisions of layout into rows and columns...

The fourth question is about adding the first row in the layout.... the point is to be considered is that, each row is split into 12 columns, you can decide how many columns to be there in the first row in our case, we have just one column i.e the entire row is treated as column now.

Once done the subsequent questions would be adding more rows and columns into it, likewise we can add as many rows and columns in a layout.

The following picture depicts the layout structure we have created....



Once we finalise our layout structure, we can hit Finish Layout option to complete the layout creation something like the one given below...



The last question of the interactive session would be the path to the local application server, provide the absolute path to the server's root directory, in our case, I have given the tomcat's directory path which comes as part of the liferay portal.

Now you can witness the layout created at the location where we started the interactive session and the layout can be deployed using the following command

> gulp deploy

With this we have concluded the creation of Layout for Liferay Themes.

Hope you had good time learning

Ciao.

Tuesday, October 29, 2019

Liferay Portal in Developer Mode in Ubuntu

Hi,

In this post, we shall see how to have liferay portal to run in developer mode. This mode of the portal becomes handy when we develop theme for the sites in liferay.

Without talking lets get in to action right away...

Prerequisites
Name Version Download Page Direct Link
Java 1.7 Java Download Page Click to Download Directly
Mysql 14.14 N/A N/A
Liferay Portal 7.1.0 - CE Lifeay Portal Download Page Click to Download Directly

I am going to use liferay-7.1.0 Community Edition as lab rat for our discussion.

For the installation of MySQL you can refer to an other post from the following link below...

MySQL Server Installation in Ubuntu 18.10

The installation details of the software packages mentioned in pre-requisite section is beyond the scope of discussion... you can refer online articles for their installation(s).

Let us assume you have the liferay portal 7.1.0-CE up and running on your local machine, following the instruction below to have the portal running in developer mode...

At the root of the liferay's portal directory, you must see a file called portal-ext.properties, if you do not then create one and append the file with the following property...

include-and-override=portal-developer.properties

The property include-and-override holds the reference of the property file portal-develper.properties, this property file holds all the necessary properties to have the portal run developer mode.

Once done, shut down the portal and restart it again, this will ensure the liferay portal up and running in developer mode.

Well this has concluded the discussion, hope you had great time.

Thanks.

Thursday, October 24, 2019

Developing Liferay-7.1.0 Theme using Node, NPM, Yeoman and Gulp

Hi

In this post I am going to discuss how to develop liferay-7.1.0 theme using Node, NPM, Yeoman and Gulp

Prerequisites
Name Version Download Page Direct Link
Node 11.15.0 Node Package Manager Download Page Click to Download Directly


Installation of Node Package Manager
Download the Node Package Manager archive from the links given in the prerequisite section.... the installation of Node Package Manager has been described in an other blog for you to refer, please refer the link below for the installation.

Though the versions are different, the installation procedure is same as that of the one given in the link.

Node Package Manager Installation

The following sections or the portions of the blog assumes the Node Package Manager is installed and working as expected...

Installation of Yeoman and Gulp
For the Installation of Yeoman and Gulp, you can refer the next blog post from the link given below...

Yeoman and Gulp Installation

Installation of Liferay Theme Generator
After installing the required packages for creating themes in Liferay-7.1.0, now is the time to install the Theme Generator... to do this

Open up a terminal and execute the command given below
> npm install -g generator-liferay-theme@^8.x.x
The execution of the above command would result something like the one given in the image below...


With that we have concluded the installation of Liferay Theme Generator

The following sections details the actual theme creation for Liferay-7.1.0

Creating Themes...
Open a terminal window and move to any directory of your choice to create themes

Fire the command below to have your theme created
> yo liferay-theme
the above command would ask you a set of questions provide answers to those for the successful creation of one, the sampled one is given below for you to refer...




This concludes the successful creation of the theme...

Now the next part is important, i.e deploying the theme.. please follow the section below to deploy the theme created.

Deploying the Theme
Move to the root directory of the theme which we did create and fire the command below...

Make sure your liferay portal is up and running.

> gulp deploy

if the command execution is successful, then you would have something as depicted in the images given below...




On the server console, the deployment of the new theme can be verified as depicted below...



With that we have concluded the theme development of liferay-7.1.0 using NPM, Yeoman and Gulp.

Hope you find this article useful.

Thanks.

Wednesday, October 23, 2019

Installing Yeoman and Gulp using NPM in Ubuntu

Hi,

In this post I am going to talk about installing Yeoman and Gulp in Ubuntu, the version of Ubuntu I was using was 16.04, the procedure followed here for the installation of Yeoman and Gulp should be pretty much the same for the feature versions and to some extent recent past versions of Ubuntu

Since Yeoman and Gulp is depending on NodeJs Package Manager for their installation, first let us have NodeJs Package Manager(NPM) installed.

To Install NodeJs Package Manager or NPM, please refer to an other post of mine whose link is given below...

Installation of Node Package Manager or NPM

The following sections assumes you have NodeJs and NPM in place to proceed...

Installation of Yeoman

Open up a terminal and execute the following command at the prompt
> npm install -g yo

When everything goes fine, you should see something as shown in the image below...



This concludes the installation of Yeoman.

Installation of Gulp

Installation of gulp is very straight forward, just execute the commands given below and wait till it completes... you can verify the result of the command with the image given at the tail of each one of them.

> npm install --global gulp-cli


> gulp --version



With this we have concluded the installation of Yoeman and Gulp.

Hope you had wonderful time.

Thanks.

Installing Python and Creating Virtual Environment for Pip for package installations in Ubuntu

Hi, In this post we are going to look at how to install Python and PIP and installing packages in virtual environments.. Without wasting...