STEP 2: Login to mariadb and create wordpress user and wordpress database and give privileges
mysql -u root -p
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'kan123'; CREATE DATABASE wpdb; GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost'; FLUSH PRIVILEGES; exit;
A LAMP stack is a bundle of four different software technologies that developers use to build websites and web applications.
LAMP is acronymn for Linux – Operating System, Apache – Web Server, MYSQL – Database Server, PHP – Programming Language.
All four of these technologies are open source, which means they are community maintained and freely available for anyone to use.
Developers use LAMP stacks to create, host, and maintain web content.
LINUX – Linux is open source operating system, that you can install and configure to meet different application requirements.
APACHE – Apache is an open source web server that forms the second layer of the lamp stack. The Apache module stores websites files and exchanges information with a browser using HTTP, an internet protocol for transferring websire information in plain text. When a browser request a webpage, the Apache HTTP server does the following steps:
Receives the request
Processes the request and finds the required page file
Sends the relevant information back to the browser
MySQL – MYSQL is an open-source relational database management system and is the third layer of the LAMP stack. The LAMP model uses MySQL for storing, managing, and querying information in relational databases.
PHP – PHP which stands for PHP: Hypertext Preprocessor, is the fourth and final layer of the LAMP stack. It is a scripting language that allows websites to run dynamic processes. A dynamic process involves information in software that constantly changes. Web developers embed the PHP programming language in HTML to show real-time or updated information on websites.
mysql_secure_installation Enter current password for root (enter for none): enter Set root password? [Y/n] Y New password:****** Re-enter new password:****** Remove anonymous users? [Y/n]Y Disallow root login remotely? [Y/n]Y Remove test database and access to it? [Y/n]Y Reload privilege tables now? [Y/n]Y
STEP 2: Login to mariadb and create wordpress user and wordpress database and give privileges
mysql -u root -p
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'kan123'; CREATE DATABASE wpdb; GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost'; FLUSH PRIVILEGES; exit;
A LAMP stack is a bundle of four different software technologies that developers use to build websites and web applications.
LAMP is acronymn for Linux – Operating System, Apache – Web Server, MYSQL – Database Server, PHP – Programming Language.
All four of these technologies are open source, which means they are community maintained and freely available for anyone to use.
Developers use LAMP stacks to create, host, and maintain web content.
LINUX – Linux is open source operating system, that you can install and configure to meet different application requirements.
APACHE – Apache is an open source web server that forms the second layer of the lamp stack. The Apache module stores websites files and exchanges information with a browser using HTTP, an internet protocol for transferring websire information in plain text. When a browser request a webpage, the Apache HTTP server does the following steps:
Receives the request
Processes the request and finds the required page file
Sends the relevant information back to the browser
MySQL – MYSQL is an open-source relational database management system and is the third layer of the LAMP stack. The LAMP model uses MySQL for storing, managing, and querying information in relational databases.
PHP – PHP which stands for PHP: Hypertext Preprocessor, is the fourth and final layer of the LAMP stack. It is a scripting language that allows websites to run dynamic processes. A dynamic process involves information in software that constantly changes. Web developers embed the PHP programming language in HTML to show real-time or updated information on websites.
mysql_secure_installation Enter current password for root (enter for none): enter Set root password? [Y/n] Y New password:****** Re-enter new password:****** Remove anonymous users? [Y/n]Y Disallow root login remotely? [Y/n]Y Remove test database and access to it? [Y/n]Y Reload privilege tables now? [Y/n]Y
Step 1: Install mariadb Step 2:create root password for mariadb Step 3: 1:create database Step 4:create tables Step 5:insert, view, filter, delete records in tables Step 6:delete database, tables Step 7:create remote db user , password , grant privileges Step 8:access remote db from local machine
Step 1: To install Mariadb. Run the below command on Ubuntu terminal.
Step 2: To Check the status of Mariadb, type the below command.
Step 3: Irrespective of reboot, to have Mariadb is up(Running) all the time, Run the below command.
Step 4: To Configure, Mariadb root password
Step 5: To login to Mariadb
Database prompt looks likebelow
Step 6: To view Databases
Default Mariadb Database table will show
Step 7: To create a Database
Step 8: To view the database name “AMariaDB”. type the command” show databases; “
Created CMariaDB and BMariaDB
Step 9: To use database
Step 10: To view tables in a AMariaDB Database, Type the below command.
Step 11: To create a table with name ” friends“.
Step 12: To check table name friends created.
Step 13: To create a record in table ” friends “.
Step 14: To view the record created in table ” friends “.
Step 15: To create multiple records in table “friends”.
To view the record created in table ” friends “.
Step 16: To view a particular record from the table ” friend “
Step 17: To delete a particular record from the table ” friends “
Step 18: To delete a table ” friends “
Step 19:To delete a database ” AMariaDB
Before database deletion ” AMariaDB”
After database deletion ” AMariaDB”
Step 20: To access a remote database , create a user myuser and password for the user, grant all privileges.
Step 21: edit the config file bind address from 127.0.0.1 to 0.0.0.0
Before edit
After edit
Step 22: Restart your MariaDB service , type the below command
Step 23: From your local machine. Type the below command.
$ mysql -u myuser -p -h <remote_dbserver_ip> MariaDB [(none)]>
Step 24: To make mariadb to connect in custom port instead of 3306/TCP Use the commands below to change the default MySQL/MariaDB Database port in Linux.
vim /etc/mysql/mariadb.conf.d/50-server.cnf
Step 25: Add the parameter under [mysqld] port = 4406
port = 4406 : wq! save and exit sudo systemctl restart mariadb.service
Step 26: connect remote db with custom port 4406
mysql -u myuser -p -h <remote_dbserver_ip> -P 4406 mysql -u kaniyam -p -h kaniyam.hopto.org -P 4406
Steps for Apache WebServer Service On Linux Terminal
Step 1: To install Apache Webserver. Run the below command on Ubuntu terminal.
Step 2: To check the system status whether Apache2 server is running, Run the below Linux command.
Step 3: Irrespective of reboot, to have Apache server is up(Running) all the time, Run the below command
Step 4: Run the below Linux command to check where the Apache2 server files are?
Step 5: To check what files are available in html folder, Run the below command
Step 6:Ubuntu default Apache2 page is available in “index.html”. Go to web browser, and type localhost, Ubuntu default Apache2 page appears.
Step 7:Using IP address also can view Ubuntu Apache2 default page, open web browser and type 127.0.0.1
Step 8:If you have bad memory to remember IP address, its possible to rename the IP address to any other name. Run the below command in terminal.
Step 9: To rename the localhost press ‘ i ‘ and type “kaniyam.in” . To save the file and exit from the vim editor, press [Esc] + :wqor [Esc] +
Step 10: Go to web browser and type ” kaniyam.in ” . Ubuntu default page Apache2 appears!.
Step 11: To see what is inside the “index.html” i.e; Ubuntu default Apache2 page, run the below command.
Step 12: index.html page
Step 13: To remove the ” index.html “, type the below command.
Step 14: Creating a new html file with an image. Save the html file as ” CustomisedIndex.html “. The image file “January1st.jpeg” should be in the same in folder as html file. Run the below command.
Step 15: To list all the files and to check html file and image are in same folder. Type the below command.
Step 16: Copy html file (CustomisedIndex.html) to Apache default html directory (/var/www/html/). Type the below command.
Step 17: To Check CustomisedIndex.html is copied to html directory. Type the Linux command.
Step 18:Copy image file (January1st.jpeg) to Apache default html directory (/var/www/html/). Type the below command.
Step 19: To Check January1st.jpeg image file is copied to html directory. Type the Linux command.
Step 20: Open Web browser, type localhost/CustomisedIndex.html
Step 21: Type the below command to check all the Apache2 web server configuration files
Step 22: Apache2 by default run on port 80, port number can be customise too.
Step 23: Nginx is another Open source Web Server.Follow the same steps as Apache2 Web server.
Step 1: Install mariadb Step 2:create root password for mariadb Step 3: 1:create database Step 4:create tables Step 5:insert, view, filter, delete records in tables Step 6:delete database, tables Step 7:create remote db user , password , grant privileges Step 8:access remote db from local machine
Step 1: To install Mariadb. Run the below command on Ubuntu terminal.
Step 2: To Check the status of Mariadb, type the below command.
Step 3: Irrespective of reboot, to have Mariadb is up(Running) all the time, Run the below command.
Step 4: To Configure, Mariadb root password
Step 5: To login to Mariadb
Database prompt looks likebelow
Step 6: To view Databases
Default Mariadb Database table will show
Step 7: To create a Database
Step 8: To view the database name “AMariaDB”. type the command” show databases; “
Created CMariaDB and BMariaDB
Step 9: To use database
Step 10: To view tables in a AMariaDB Database, Type the below command.
Step 11: To create a table with name ” friends“.
Step 12: To check table name friends created.
Step 13: To create a record in table ” friends “.
Step 14: To view the record created in table ” friends “.
Step 15: To create multiple records in table “friends”.
To view the record created in table ” friends “.
Step 16: To view a particular record from the table ” friend “
Step 17: To delete a particular record from the table ” friends “
Step 18: To delete a table ” friends “
Step 19:To delete a database ” AMariaDB
Before database deletion ” AMariaDB”
After database deletion ” AMariaDB”
Step 20: To access a remote database , create a user myuser and password for the user, grant all privileges.
Step 21: edit the config file bind address from 127.0.0.1 to 0.0.0.0
Before edit
After edit
Step 22: Restart your MariaDB service , type the below command
Step 23: From your local machine. Type the below command.
$ mysql -u myuser -p -h <remote_dbserver_ip> MariaDB [(none)]>
Step 24: To make mariadb to connect in custom port instead of 3306/TCP Use the commands below to change the default MySQL/MariaDB Database port in Linux.
vim /etc/mysql/mariadb.conf.d/50-server.cnf
Step 25: Add the parameter under [mysqld] port = 4406
port = 4406 : wq! save and exit sudo systemctl restart mariadb.service
Step 26: connect remote db with custom port 4406
mysql -u myuser -p -h <remote_dbserver_ip> -P 4406 mysql -u kaniyam -p -h kaniyam.hopto.org -P 4406
Steps for Apache WebServer Service On Linux Terminal
Step 1: To install Apache Webserver. Run the below command on Ubuntu terminal.
Step 2: To check the system status whether Apache2 server is running, Run the below Linux command.
Step 3: Irrespective of reboot, to have Apache server is up(Running) all the time, Run the below command
Step 4: Run the below Linux command to check where the Apache2 server files are?
Step 5: To check what files are available in html folder, Run the below command
Step 6:Ubuntu default Apache2 page is available in “index.html”. Go to web browser, and type localhost, Ubuntu default Apache2 page appears.
Step 7:Using IP address also can view Ubuntu Apache2 default page, open web browser and type 127.0.0.1
Step 8:If you have bad memory to remember IP address, its possible to rename the IP address to any other name. Run the below command in terminal.
Step 9: To rename the localhost press ‘ i ‘ and type “kaniyam.in” . To save the file and exit from the vim editor, press [Esc] + :wqor [Esc] +
Step 10: Go to web browser and type ” kaniyam.in ” . Ubuntu default page Apache2 appears!.
Step 11: To see what is inside the “index.html” i.e; Ubuntu default Apache2 page, run the below command.
Step 12: index.html page
Step 13: To remove the ” index.html “, type the below command.
Step 14: Creating a new html file with an image. Save the html file as ” CustomisedIndex.html “. The image file “January1st.jpeg” should be in the same in folder as html file. Run the below command.
Step 15: To list all the files and to check html file and image are in same folder. Type the below command.
Step 16: Copy html file (CustomisedIndex.html) to Apache default html directory (/var/www/html/). Type the below command.
Step 17: To Check CustomisedIndex.html is copied to html directory. Type the Linux command.
Step 18:Copy image file (January1st.jpeg) to Apache default html directory (/var/www/html/). Type the below command.
Step 19: To Check January1st.jpeg image file is copied to html directory. Type the Linux command.
Step 20: Open Web browser, type localhost/CustomisedIndex.html
Step 21: Type the below command to check all the Apache2 web server configuration files
Step 22: Apache2 by default run on port 80, port number can be customise too.
Step 23: Nginx is another Open source Web Server.Follow the same steps as Apache2 Web server.
Step 2: Click on ” 64-bit PC (AMD64) desktop image
Step 3 : Go to Downloads folder, Click on jammy-desktop-arm64.iso – click open
What s UTM?
UTM is Universal Turing Machine.
UTM (based on QEMU), is fully featured system emulator and Virtual machine host for iOS and MacOS
QEMU is free and open source emulator.
UTM allows you run Windows, Linux and more on your Mac, iPhone and iPad.
UTM runs only on MacOS(11.0 or later).
If your Mac uses an Apple Silicon (M1 or M2) chip, you can virtualize a copy of macOS that is compiled for ARM64 (aarch64) unmodified. This means that you can run another copy of macOS (or as many as the system memory allows) directly on your Mac CPU.
if you try to run a copy of Windows that is compiled for x86 or AMD64 on an Apple Silicon Mac, you cannot use virtualization. This is because the Windows OS is compiled for a different architecture (which is x86 or AMD64) while Apple Silicon is using ARM64 (aarch64). Instead, you have to use emulation.
Step 2: Click on ” 64-bit PC (AMD64) desktop image
Step 3 : Go to Downloads folder, Click on jammy-desktop-arm64.iso – click open
What s UTM?
UTM is Universal Turing Machine.
UTM (based on QEMU), is fully featured system emulator and Virtual machine host for iOS and MacOS
QEMU is free and open source emulator.
UTM allows you run Windows, Linux and more on your Mac, iPhone and iPad.
UTM runs only on MacOS(11.0 or later).
If your Mac uses an Apple Silicon (M1 or M2) chip, you can virtualize a copy of macOS that is compiled for ARM64 (aarch64) unmodified. This means that you can run another copy of macOS (or as many as the system memory allows) directly on your Mac CPU.
if you try to run a copy of Windows that is compiled for x86 or AMD64 on an Apple Silicon Mac, you cannot use virtualization. This is because the Windows OS is compiled for a different architecture (which is x86 or AMD64) while Apple Silicon is using ARM64 (aarch64). Instead, you have to use emulation.
Download ➜ Move to Applications folder ➜ Double ClickIf you don’t move Postgres.app to the Applications folder, some features may not work (more info)
Click “Initialize” to create a new server
Configure your $PATH to use the included command line tools (optional):sudo mkdir -p /etc/paths.d && echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
Step 3:- Scroll little down the page, click on link Postgres.app
Step 4:- click on downloads icon.
Step 5:- click on latest release Download icon.
Step 6:- It takes few seconds to download and is visible on top roght side of the screen with down arrow in blue color. Double click on pop_up box.
Step 7:- Once you double click on download box, postgres blue dialogue box will appear with symbol of elephant and application folder as shown below. place the cursor on elephant and drag the elephant to application.
Step 8:- Go to down left most screen with happyface(Finder)- click on it, screen will appear, click on Applications, scroll down to see Postgres. click on it.
Step 9:- Click on open.
Step 10:- Three Default database icons will dispaly after initialisation.
Step 11:- Open Terminal on mac and type to configure your path:
PostgreSQL is an advanced, enterprise-class, and open-source relational database system.
PostgreSQL supports both SQL (relational) and JSON (non-relational) querying.
PostgreSQL is a powerful, open source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads.
PostgreSQL is a highly stable database backed by more than 20 years of development by the open-source community.
PostgreSQL is used as a primary database for many web applications as well as mobile and analytics applications.
The project was originally named POSTGRES, in reference to the older Ingres database which also developed at Berkeley. The goal of the POSTGRES project was to add the minimal features needed to support multiple data types.
In 1996, the POSTGRES project was renamed to PostgreSQL to clearly illustrate its support for SQL. Today, PostgreSQL is commonly abbreviated as Postgres.
Since then, the PostgreSQL Global Development Group, a dedicated community of contributors continues to make the releases of the open-source and free database project.
Originally, PostgreSQL was designed to run on UNIX-like platforms. And then, PostgreSQL was evolved run on various platforms such as Windows, macOS, and Solaris.
Common Use cases of PostgreSQL
The following are the common use cases of PostgreSQL.
A robust database in the LAPP stack -LAPP stands for Linux, Apache, PostgreSQL, and PHP (or Python and Perl). PostgreSQL is primarily used as a robust back-end database that powers many dynamic websites and web applications.
General purpose transaction database -Large corporations and startups alike use PostgreSQL as primary databases to support their applications and products.
Geospatial database-PostgreSQL with the PostGIS extension supports geospatial databases for geographic information systems (GIS).
Language support
PostgreSQL support most popular programming languages:
Python
Java
C#
C/C+
Ruby
JavaScript (Node.js)
Perl
Go
Tcl
Many companies have built products and solutions based on PostgreSQL. Some featured companies are Apple, Fujitsu, Red Hat, Cisco, Juniper Network, Instagram, etc.
List of various features found in PostgreSQL
Data Types
Primitives: Integer, Numeric, String, Boolean
Structured: Date/Time, Array, Range / Multirange, UUID
Parallelization of read queries and building B-tree indexes
Table partitioning
All transaction isolation levels defined in the SQL standard, including Serializable
Just-in-time (JIT) compilation of expressions
Reliability, Disaster Recovery
Write-ahead Logging (WAL)
Replication: Asynchronous, Synchronous, Logical
Point-in-time-recovery (PITR), active standbys
Tablespaces
Security
Authentication: GSSAPI, SSPI, LDAP, SCRAM-SHA-256, Certificate, and more
Robust access-control system
Column and row-level security
Multi-factor authentication with certificates and an additional method
Extensibility
Stored functions and procedures
Procedural Languages: PL/pgSQL, Perl, Python, and Tcl. There are other languages available through extensions, e.g. Java, JavaScript (V8), R, Lua, and Rust
SQL/JSON path expressions
Foreign data wrappers: connect to other databases or streams with a standard SQL interface
Customizable storage interface for tables
Many extensions that provide additional functionality, including PostGIS
Internationalisation, Text Search
Support for international character sets, e.g. through ICU collations
Case-insensitive and accent-insensitive collations
Full-text search
Disadvantages of PostgreSQL
Postgres is not owned by one organization. …
Changes made for speed improvement requires more work than MySQL as PostgreSQL focuses on compatibility.
Many open source apps support MySQL, but may not support PostgreSQL.
Constructor : ArrayList have three constructor which are ArrayList(), ArrayList(int capacity) ArrayList(int Collection c) while HashSet have four constructor which are HashSet(), HashSet(int capacity), HashSet(Collection c) and HashSet(int capacity, float loadFactor)
Ordering : ArrayList maintains the order of the object in which they are inserted while HashSet is an unordered collection and doesn’t maintain any order.
Indexing : ArrayList is index based we can retrieve object by calling get(index) method or remove objects by calling remove(index) method while HashSet is completely object based. HashSet also does not provide get() method.
Null Object: ArrayList not apply any restriction, we can add any number of null value while HashSet allow one null value.
Basic Operation’s Time complexity :-
ArrayList common operation’s time complexity
add() – takes O(1) time;( tbd)? get() – it takes constant time O(1); remove() –it takes linear time complexity O(n) . It iterate the entire array to find the element qualifying for removal. contains() – It also take linear time complexity O(n).
For HashSet, the add(), remove() and contains() operations cost constant O(1) time
The Java String class charAt() method returns a char value at the given index number.
The index number starts from 0 and goes to n-1, where n is the length of the string.
It returns StringIndexOutOfBoundsException, if the given index number is greater than or equal to this string length or a negative number.
Signature
publicchar charAt(int index)
Method Name = charAt
Parameter = int index
Return type = char
The method accepts index as a parameter.
The starting index is 0.
It returns a character at a specific index position in a string.
It throws StringIndexOutOfBoundsException if the index is a negative value or greater than this string length.
Example
Java String length()
The Java String class length() method finds the length of a string. The length of the Java string is the same as the Unicode code units of the string.
Signature
publicint length()
Method Name = length()
Parameter =
Return type = int
Returns
Length of characters. In other words, the total number of characters present in the string.
EXAMPLE
Java String isEmpty()
The Java String class isEmpty() method checks if the input string is empty or not. Here empty means the number of characters contained in a string is zero.
Signature
publicboolean isEmpty()
Method Name = isEmpty()
Parameter =
Return type = boolean (true if length is 0 otherwise false)
Returns
true if length is 0 otherwise false.
Example
Java String trim()
The Java String class trim() method eliminates leading and trailing spaces. The Unicode value of space character is ‘\u0020’. The trim() method in Java string checks this Unicode value before and after the string, if it exists then the method removes the spaces and returns the omitted string.
The string trim() method doesn’t omit middle spaces.
Signature
public String trim()
Method Name = trim()
Parameter =
Return type = String
Returns
string with omitted leading and trailing spaces
EXAMPLE
Java String toLowerCase()
The java string toLowerCase() method returns the string in lowercase letter. In other words, it converts all characters of the string into lower case letter.
The toLowerCase() method works same as toLowerCase(Locale.getDefault()) method. It internally uses the default locale.
Signature
There are two variant of toLowerCase() method. The signature or syntax of string toLowerCase() method is given below:
public String toLowerCase()
public String toLowerCase(Locale locale)
The second method variant of toLowerCase(), converts all the characters into lowercase using the rules of given Locale.
Method Name = toLowerCase()
Parameter =
Return type = String in lowercase letters
Returns
string in lowercase letter.
EXAMPLE
Java String toUpperCase()
The java string toUpperCase() method returns the string in uppercase letter. In other words, it converts all characters of the string into upper case letter.
The toUpperCase() method works same as toUpperCase(Locale.getDefault()) method. It internally uses the default locale.
Signature
public String toUpperCase()
public String toUpperCase(Locale locale)
The second method variant of toUpperCase(), converts all the characters into uppercase using the rules of given Locale.
Method Name = toUpperCase()
Parameter =
Return type = String in Uppercase letters
Returns
string in uppercase letter.
EXAMPLE
Java String contains()
The Java String class contains() method searches the sequence of characters in this string.
It returns true if the sequence of char values is found in this string otherwise returns false.
Signature
publicboolean contains(CharSequence sequence)
Method Name = contains()
Parameter = CharSequence sequence
Return type = true if the sequence of char value exists, otherwise false.
Parameter
sequence : specifies the sequence of characters to be searched.
Returns
true if the sequence of char value exists, otherwise false.
EXAMPLE
Java String concat
The Java String class concat() method combines string at the end of the string. It returns a combined string. It is like appending another string.
Signature
public String concat(String anotherString)
Method Name = concat()
Parameter = string
Return type = combined string
Parameter
anotherString : another string i.e., to be combined at the end of this string.
Returns
combined string
EXAMPLE
Java String startsWith()
The Java String class startsWith() method checks if this string starts with the given prefix. It returns true if this string starts with the given prefix; else returns false.
Signature
publicboolean startsWith(String prefix)
publicboolean startsWith(String prefix, int offset)
Parameter
prefix : Sequence of character
offset: the index from where the matching of the string prefix starts.
Returns
true or false
EXAMPLE
Java String endsWith()
The JavaString class endsWith() method checks if this string ends with a given suffix. It returns true if this string ends with the given suffix; else returns false.