Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee
Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Monday, November 2, 2020

How Ubuntu used in government sector?

November 02, 2020
How Ubuntu used in government sector?

Is 700mb DVD sufficient to burn ubuntu in it?

November 02, 2020
Is 700mb DVD sufficient to burn ubuntu in it?

Wednesday, September 2, 2020

How to Setup Monitoring for Docker Containers using Prometheus on Ubuntu 18.04

September 02, 2020
How to Setup Monitoring for Docker Containers using Prometheus on Ubuntu 18.04

 Requirment 

1. docker should be installed

2. docker-compose also be installed


Installation of docker

1.  sudo apt-get install docker.io or sudo apt  install docker.io

2. docker --version

3. sudo apt-get install docker-compose

 

Creating a Configuration files of prometheus

1. create a new file prometheus.yml and copy paste below

sudo nano ~/ prometheus.yml  or sudo nano /etc/prometheus/prometheus.yml

# prometheus.yml
global:
 scrape_interval: 5s
 external_labels:
   monitor: 'my-monitor'
rule_files:
 - 'alert.rules'
scrape_configs:
 - job_name: 'prometheus'
   static_configs:
     - targets: ['your_server_ip:9090']

2. create a new file docker-compose.yml and copy paste below

sudo nano ~/docker-compose.yml or sudo nano /etc/prometheus/docker-compose.yml

# docker-compose.yml
version: '2'
services:
  prometheus:
     image: prom/prometheus:latest
     volumes:
       - ./prometheus.yml:/etc/prometheus/prometheus.yml            
     command:
       - '--config.file=/etc/prometheus/prometheus.yml'
     ports:
       - '9090:9090'

 3. Run the docker compose file

cd /etc/prometheus/ or sudo ~/docker-compose up

sudo docker-compose up

 4. Open browser

http://your_server_ip:9090

 5. Install Node exporter

sudo nano ~/docker-compose.yml or sudo nano /etc/prometheus/docker-compose.yml
 
copy paste at last line
node-exporter:
     image: prom/node-exporter
     ports:
       - '9100:9100'
 sudo nano ~/ prometheus.yml  or sudo nano /etc/prometheus/prometheus.yml
 
copy paste at last line 
- job_name: 'node-exporter'
   static_configs:
     - targets: ['node-exporter:9100'] 

 6. Restart docker-composer

cd /etc/prometheus/ or sudo ~/docker-compose restart

sudo docker-compose restart

7. Install Grafana

sudo nano ~/docker-compose.yml or sudo nano /etc/prometheus/docker-compose.yml

copy paste at last line  

grafana:
     image: grafana/grafana
     user: "0" #[ Execute  id -u in terminal to find the user id from where you are invoking docker compose]
     volumes:
       - ./grafana_db:/var/lib/grafana
     environment:
       - GF_SECURITY_ADMIN_PASSWORD=yourpass
     depends_on:
       - prometheus
     ports:
       - '3000:3000'

 4. Open browser

http://your_server_ip:3000

 

 

Wednesday, June 10, 2020

How to solve command could not be located because '/bin' is not included in the path environment variable

June 10, 2020
How to solve command could not be located because '/bin' is not included in the path environment variable
ERROR
command could not be located because '/bin' is not included in the path environment variable


SOLUTION 1
cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

ls -l /etc/environment
-rw-r--r-- 1 root root 79 2010-03-16 14:44 /etc/environment

JUST TYPE
export PATH=/usr/bin:/bin

=========================================
SOLUTION 2
sudo nano ~/.bashrc
CP & PST AT LAST LINE OR BOTTOM
export PATH=/usr/bin:$PATH

source ~/.bashrc
==========================================




Monday, March 30, 2020

How to Install IntelliJ IDEA on Ubuntu 18.04 LTS, Debian and Linux Mint

March 30, 2020
How to Install IntelliJ IDEA on Ubuntu 18.04 LTS, Debian and Linux Mint
How to Install IntelliJ IDEA on Ubuntu 18.04 LTS, Debian and Linux Mint

Requirment
    login: user with root privileges
    OS: Ubuntu 18.04 64-bit
    RAM: Minimum 2 GB RAM, 8 GB RAM recommended
    Harddisk Space: 1.5 GB hard disk space, 5 GB + at least 1 GB for caches
    CPU: 2
    screen resolution: 1024x768 minimum
    Download Size : 774MB

Offically Website of IntelliJ IDEA
https://www.jetbrains.com/idea/download/#section=linux

Offically Website of jetbrains
https://www.jetbrains.com/toolbox-app/

    IntelliJ IDEA Community Edition (Free)
    IntelliJ IDEA Ultimate Edition (Paid version with extra features)
    IntelliJ IDEA Educational (Ultimate Edition but free for students and faculty members)

Method 1
Install using the Snap
Installing IntelliJ IDEA community Edition
Step1 :- sudo snap install intellij-idea-community --classic

Installing IntelliJ IDEA Educational Edition
Step1 :- sudo snap install intellij-idea-educational --classic

Installing IntelliJ IDEA Ultimate Edition 30Day
Step1 :- sudo snap install intellij-idea-Ultimate --classic

After Successful Installation
Step2 :- intellij-idea-community

Method 2
Install using the Toolbox App
Step1 :- sudo apt update
Step2 :- sudo wget https://download.jetbrains.com/toolbox/jetbrains-toolbox-1.16.6319.tar.gz
Step3 :- cd /tmp  OR  cd /opt
Step4 :- sudo tar -xzf jetbrains-toolbox-1.16.6319.tar.gz -C /opt

Need to Register in IntelliJ IDEA
  

Method 3
Using Official Package or Standalone installation of community or Ultimate Edition
Step1 :- sudo apt update
Step2 :- sudo wget https://download.jetbrains.com/idea/ideaIU-2019.3.4.tar.gz
Step3 :- cd /tmp  OR  cd /opt
Step4 :- sudo tar -xzf ideaIU.tar.gz -C /opt

How To Install Git and Git-Gui on Ubuntu 18.04 LTS, Debian and Linux Mint

March 30, 2020
How To Install Git and Git-Gui on Ubuntu 18.04 LTS, Debian and Linux Mint
How To Install Git and Git-Gui on Ubuntu 18.04 LTS, Debian and Linux Mint

Offically Website of GitHub
https://github.com/git/git

Offically Website of Git
https://git-scm.com/downloads

Method 1
Installing Git
Step1 :- sudo apt update
Step2 :- sudo apt install git  OR  sudo apt-get install git-gui

Verify
Step3 :- git --version

Method 2
Installing Git from Source
Step1 :- sudo apt update
Step2 :- sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
Step3 :- cd /tmp  OR  cd /usr/src/
Step4 :- sudo wget https://github.com/git/git/archive/v2.26.0.zip -O git.zip  
      OR sudo wget https://github.com/git/git/archive/v2.26.0.tar.gz -O git.tar.gz    
Step5 :- sudo unzip git.zip
      OR sudo tar -xf git.tar.gz
Step6 :- cd git-*
Step7 :- sudo make prefix=/usr/local all
Step8 :- sudo make prefix=/usr/local install
 
ERROR
cache.h:21:10: fatal error: zlib.h: No such file or directory
 #include <zlib.h>
          ^~~~~~~~
compilation terminated.
Makefile:2387: recipe for target 'fuzz-commit-graph.o' failed
make: *** [fuzz-commit-graph.o] Error 1

SOLUTIONS   
Step1 :- sudo apt-get install libz-dev
Step2 :- sudo apt install zlib1g-dev

Step9 :- git --version

Clone the Git
Step10 :- cd ~
Step11 :- git clone https://github.com/git/git.git  OR  git clone https://github.com/git/git
Step12 :- cd git
Step13 :- sudo make prefix=/usr/local all
Step14 :- sudo make prefix=/usr/local install

Configuring Git
Step15 :- git config --global user.name "Cloud Network"
Step16 :- git config --global user.email "itcloudnet@gmail.com"

Verify
Step17 :- git config --list

configuration file of Git
Step18 :- nano ~/.gitconfig

Sunday, March 29, 2020

How To Install Node.js and npm Ubuntu 18.04, Debian and Linux Mint

March 29, 2020
How To Install Node.js and npm Ubuntu 18.04, Debian and Linux Mint
How To Install Node.js and npm Ubuntu 18.04, Debian and Linux Mint

Officially Website
https://nodejs.org/en/download/

Stable release: 12.15.0

Offically Github
https://github.com/nvm-sh/nvm

METHOD 1
Step1 :- sudo apt-get update

Step2 :- sudo apt install nodejs

Step3 :- node -v OR node --version OR nodejs -v

Step4 :- npm -v OR npm --version

METHOD 2
Installing Using PPA
sudo apt-get update

sudo apt-get upgrade

sudo apt-get install python-software-properties

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
OR
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh

sudo apt install nodejs

node --version
nvm --version

sudo apt install build-essential

METHOD 3
Installing Using NVM
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.3/install.sh | bash
nvm ls  OR nvm ls-remote
nvm install (Latest LTS)  OR nvm install --lts
nvm use (Latest LTS)
node --version
nvm ls
nvm alias default (Latest LTS)
nvm use default
nvm install node
npm install express
npm install -g express
npm link express
nvm help
nvm --version

Removing Node.js
sudo apt remove nodejs
sudo apt purge nodejs
sudo apt autoremove
sudo apt remove nodejs npm

nvm current
nvm uninstall node_version
nvm deactivate

How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint

March 29, 2020
How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint
How to Install and Configure pgAdmin 4 v4.19 on Ubuntu 18.04, Debian and Linux Mint

Visit the Pgadmin 4 Ubuntu download site:
https://www.pgadmin.org/download/

METHOD 1
Importing GPG key
sudo apt install wget ca-certificates

Install Pgadmin4 from Ubuntu repositories
Step1 :- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Add PostgreSQL APT repository
Step2 :- sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Updating
Step3 :- sudo apt update

Installation pgadmin4
Step4 :- sudo apt install pgadmin4 pgadmin4-apache2 -y  OR  sudo apt-get install pgadmin4 pgadmin4-apache2

Check Status
Step :- systemctl status apache2

UFW Firewall Configured
Step :- sudo ufw allow http
Step :- sudo ufw allow https

Verify Open Browser
http://[SERVERIP OR LOCALHOST OR DOMAIN]/pgadmin4/

Login with your email address and password.
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD
===================================================================================================================================

METHOD 2
Creating a New User
Step5 :- useradd -m -s /bin/bash itcloudnet
Step6 :- passwd STRONGPASSWORD

Creating Log Directory
Step7 :- sudo mkdir -p /var/log/pgadmin4/ OR  sudo mkdir /var/log/pgadmin4
Step8 :- sudo mkdir -p /var/lib/pgadmin4/{sessions,storage}
OR
Step8 :- sudo mkdir -p /var/lib/pgadmin4/sessions
Step8 :- sudo mkdir /var/lib/pgadmin4/storage

Changing the Owner of all Directory
Step9 :- sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4/ /var/lib/pgadmin4/

Install Dependencies
Step10 :- sudo apt install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev -y

Install Apache2
Step11 :- sudo apt install apache2 apache2-utils libapache2-mod-wsgi libexpat1 ssl-cert python -y

Creating Virtual Env
Step11 :- su - itcloudnet
Step12 :- virtualenv pgadmin4
Step13 :- cd pgadmin4/
Step14 :- source bin/activate

Installation pgadmin4
Step15 :- wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v3.6/pip/pgadmin4-4.19-py2.py3-none-any.whl

Install Package through pip command
sudo apt-get install python-pip
Step16 :- pip install pgadmin4-4.19-py2.py3-none-any.whl

Creating New Configuration file
Step17 :- cd lib/python2.7/site-packages/pgadmin4/
Step18 :- nano config_local.py

Now Copy & Paste
LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'
SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'
SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'
STORAGE_DIR = '/var/lib/pgadmin4/storage'
SERVER_MODE = True

Run
Step19 :- python setup.py

Step20 :- pip install psycopg2-binary
Step21 :- sudo chown -R www-data:www-data /var/lib/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/lib/pgadmin4
Step22 :- sudo chown -R www-data:www-data /var/log/pgadmin4/ OR sudo chown -R itcloudnet:itcloudnet /var/log/pgadmin4

Configure Apache2
Step23 :- cd /etc/apache2/sites-available/

Change the 'ServerName' with your own domain name
Step24 :- sudo nano pgadmin4.conf
          ServerName pgadmin.itcloudnet.blogspot.com

Now test the configuration and activate the pgAdmin4 virtual hosts
Step25 :- apachectl configtest
Step26 :- a2ensite pgadmin4

Restart Apache2 Service
Step27 :- systemctl restart apache2

URL Access
http://pgadmin.itcloudnet.blogspot.com

===================================================================================================================================
HOW TO CONNECT POSTGRESQL DB VIA or WITH PGADMIN4

Login with your email address and password
Email Address :- itcloudnet@gmail.com
Password :- STRONGPASSWORD

Step28 :- "Add New Server" Button then type PostgreSQL Server or Local details and then save.

Click on General -->
Name : postgresql-local OR localhost
Server group : Servers
Comments : Local PostgreSQl Server

Click on Connection -->
Maintenance : postgres (DB host)
Username : postgres (DB name)
password : itcloudnet$123! (DB passwrod)

Save

Thats it.........

How To Install Elasticsearch, Logstash and Kibana on Ubuntu 18.04

March 29, 2020
How To Install Elasticsearch, Logstash and Kibana on Ubuntu 18.04
How To Install Elasticsearch, Logstash and Kibana on Ubuntu 18.04

Requirment
    login: user with root privileges
    OS: Ubuntu 18.04
    RAM: 4GB
    CPU: 2
    Java: Oracle JDK 8 version

The same instructions apply for Ubuntu 17.04/16.04, Linux Mint, Debian, Kubuntu and Elementary OS

Update/upgrade
1. sudo apt update
2. sudo apt-get upgrade -y
-------------------------------------------------------
Install dependencies and java 8
1. sudo add-apt-repository ppa:webupd8team/java
2. sudo apt-get update OR sudo apt update
3. sudo apt install openjdk-8-jdk

Verify the Java
1. java -version
-------------------------------------------------------
ELASTICSEARCH

Install and configure Elasticsearch
1. cd /tmp
2. wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.2-amd64.deb
3. sudo dpkg -i elasticsearch-7.5.2-amd64.deb

Elasticsearch configuration file
1. sudo nano /etc/elasticsearch/elasticsearch.yml
network.host to [local, eth0]
nano /etc/init.d/elasticsearch

Locate the line:
# network.host: localhost

start and enable the service
1. sudo systemctl enable elasticsearch.service
2. sudo systemctl start elasticsearch.service
       sudo systemctl status elasticsearch.service
OR
/etc/init.d/elasticsearch start
3. /etc/init.d/elasticsearch status


Verify Elasticsearch
1. curl -X GET "localhost:9200/"

open web browser
1. http://server_ip:9200/ or http://localhost:9200/

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:5.0.0
-------------------------------------------------------
KIBANA

Now, Install and configure Kibana
1. cd /tmp
2. wget https://artifacts.elastic.co/downloads/kibana/kibana-7.5.2-amd64.deb
3. sudo dpkg -i kibana-7.5.2-amd64.deb

Configuration file Kibana
1. sudo nano /etc/kibana/kibana.yml

    Locate the following lines:
#server.host: "localhost"
#elasticsearch.url: "http://localhost:9200"
to
Change those lines to:
server.host: "SERVER_IP"
elasticsearch.hosts: "http://SERVER_IP:9200"

1. sudo sysctl -w vm.max_map_count=262144

start and enable the service
1. sudo systemctl enable kibana.service
2. sudo systemctl start kibana.service
3. sudo systemctl status kibana.service

open web browser
1. http://server_ip:5601/ or ip_address:5601
-------------------------------------------------------

LOGSTASH

Now, Install and configure Logstash
1. cd /tmp
2. wget https://artifacts.elastic.co/downloads/logstash/logstash-7.5.2.deb
3. sudo dpkg -i logstash-7.5.2.deb

Configuration file logstash
1. sudo nano /etc/logstash/logstash.yml

Locate the line:
# http.host: "127.0.0.1"

start and enable the service
1. sudo systemctl enable logstash.service
2. sudo systemctl start logstash.service
3. sudo systemctl status logstash.service

Friday, March 27, 2020

How to Install and Configure PostgreSQL v12.2 on Ubuntu 18.04, Debian and Linux Mint

March 27, 2020
How to Install and Configure PostgreSQL v12.2 on Ubuntu 18.04, Debian and Linux Mint

Visit the PostgreSQL Ubuntu download site:
https://www.postgresql.org/download/linux/ubuntu/

First check PostgreSQL Verison Available in Ubuntu
apt show postgresql

Install PostgreSQL from Ubuntu repositories

Updating
Step1 :- sudo apt update

Installation
Step2 :- sudo apt install postgresql postgresql-contrib

Verify
sudo -u postgres psql -c "SELECT version();"

Login into Useraccount
Postgres Account or Login
Step4 :- sudo -i -u postgres  
Step4 :- sudo su - postgres

Exit
Step5 :- \q

Login into Database
Without Switching Accounts
Step6 :- sudo -u postgres psql

Exit
Step7 :- \q

Creating New PostgreSQL Role

Inside the Postgres
Step8 :- createuser --interactive
OR
Outside the Postgres
Step9 :- sudo -u postgres createuser --interactive
OR
Step9 :- sudo su - postgres -c "createuser itcloudnet"

For More Information
man createuser

Creating New PostgreSQL Database

Inside Postgres
Step10 :- createdb itcloudnet
OR
Outside Postgres
Step11 :- sudo -u postgres createdb itcloudnet
OR
Step11 :- sudo su - postgres -c "createdb itcloudnetdb"

Grant Permission
Step12 :- sudo -u postgres psql
Step13 :- grant all privileges on database itcloudnetdb to itcloudnet;

Opening with New Role
Step12 :- sudo adduser itcloudnet

New Database Connect
Step13 :- sudo -i -u itcloudnet 
OR
Step13 :- sudo -u itcloudnet psql
Step14 :- psql

To Connect Different Database
Step15 :- psql -d postgres

To Check Connection Information
Step16 :- \conninfo

Creating and Deleting Tables
Step17 :- CREATE TABLE cloudnetwork (
    equip_id serial PRIMARY KEY,
    type varchar (50) NOT NULL,
    color varchar (25) NOT NULL,
    location varchar(25) check (location in ('north', 'south', 'west', 'east', 'northeast', 'southeast', 'southwest', 'northwest')),
    install_date date
);

Output with Sequence
Step18 :- \d

Without Sequence
Step19 :- \dt

Adding, Querying and Deleting Data in Table
Step20 :-
INSERT INTO cloudnetwork (type, color, location, install_date) VALUES ('slide', 'blue', 'south', '2020-04-20');
INSERT INTO cloudnetwork (type, color, location, install_date) VALUES ('swing', 'yellow', 'northwest', '2019-08-16');


Step21 :- SELECT * FROM cloudnetwork;

Step22 :- DELETE FROM cloudnetwork WHERE type = 'slide';


Adding and Deleting Columns from a Table
Step23 :- ALTER TABLE cloudnetwork ADD last_maint date;

Step24 :- SELECT * FROM cloudnetwork;

Step25 :- ALTER TABLE cloudnetwork DROP last_maint;

Updating Data in a Table
Step26 :- UPDATE cloudnetwork SET color = 'red' WHERE type = 'swing';

Step27 :- SELECT * FROM cloudnetwork;

TO RESET PASSWORD
ALTER USER postgres WITH PASSWORD 'itcloudnet$123!';

Enable remote access to PostgreSQL server
sudo nano /etc/postgresql/10/main/postgresql.conf
listen_addresses = '*'

sudo service postgresql restart
ss -nlt | grep 5432

sudo nano /etc/postgresql/10/main/pg_hba.conf
i case of 10 it can be 11 version
Replace with peer ---> md5
sudo service postgresql restart

Tuesday, November 5, 2019

How to Install Java JDK v13.0.1 on Ubuntu 19.10

November 05, 2019
How to Install Java JDK v13.0.1 on Ubuntu 19.10

Website :- https://www.oracle.com/technetwork/java/javase/downloads/jdk13-downloads-5672538.html

Step1 :-  Download the file and show in below screen shot
              Then Extract the .tar.gz file 

After extract there will be a folder name JDK-13.0.1 need to move into /opt directory
Step2 :- sudo mv jdk-13.0.1  /opt/

Set Variables JAVA_HOME and PATH in Ubuntu profile
Step3 :- sudo tee /etc/profile.d/jdk13.0.1env.sh <<EOF  (copy and past one by one into terminal)
export JAVA_HOME=/opt/jdk-13.0.1
export PATH=\$PATH\$JAVA_HOME/bin
EOF

Step4 :- source /etc/profile.d/jdk13.0.1env.sh

Now validate and executed
Step5 :- echo $JAVA_HOME 
         echo $PATH

For Verify which version im using
Step6 :- java -version



Thursday, October 24, 2019

How to Install and Configure Linux, Apache, MySQL, PHP(LAMP) in Ubuntu

October 24, 2019
How to Install and Configure Linux, Apache, MySQL, PHP(LAMP) in Ubuntu

LAMP Server Installation Steps


LAMP is a combination of operating system and open-source software stack. The acronym LAMP came from the first letters of Linux, Apache HTTP Server, MySQL or MariaDB database, and PHP/Perl/Python. This tutorial describes how to install LAMP stack on Ubuntu 19.04, and previous versions such as Ubuntu 18.04 etc.

Install Apache:
Apache is an open-source multi-platform web server. It provides a full range of web server features including CGI, SSL and virtual domains.

sudo apt-get install apache2

To Verify Apache Installed or Not
Open your web browser and navigate to http://localhost/ or http://server-ip-address/.

Install MySQL:
MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases, though SQLite probably has more total embedded deployments.


MySQL :-
sudo apt-get install mysql-server mysql-client

During installation, you’ll be asked to setup the MySQL “root” user password. Enter the password and click Ok.

Re-enter the password.

To Verify MySQL Installed or Not
sudo systemctl status mysql

Install MariaDB
In case you want to use MariaDB instead of MySQL community edition, follow the steps given below.

MariaDB is a drop in replacement for MySQL. It is a robust, scalable and reliable SQL server that comes rich set of enhancements.

First you have to remove existing MySQL packages if any. To completely uninstall MySQL along with its configuration files, enter the following commands one by one:

sudo systemctl stop mysql
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql/
sudo rm -rf /etc/mysql/


After removing MySQL, run the following command to install MariaDB.
sudo apt-get install mariadb-server

Alternatively Method :
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.kaist.ac.kr/mariadb/repo/10.0/ubuntu utopic main'

Update the software sources list and install MariaDB using following commands:
sudo apt-get update
sudo apt-get install mariadb-server
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.kaist.ac.kr/mariadb/repo/10.0/ubuntu utopic main'

Update the software sources list and install MariaDB using following commands:
sudo apt-get update
sudo apt-get install mariadb-server

During installation you will be asked to set mysql ‘root’ user password. Enter the password twice, and complete the installation.

Note: In Ubuntu 18.04, MariaDB won’t ask you to set root user password during installation.

Also, you can’t set password using command:
mysql_secure_installation

It will throw the following error.
ERROR 1698 (28000): Access denied for user 'root'@'localhost'


To fix this error, log in to mysql prompt without password as root user:
sudo mysql -u root

Then, run the following commands one by one in the mysql prompt:
use mysql;
update user set plugin='' where User='root';
flush privileges;
\q
That’s it. Now, set database administrative “root” user password using command. Press Enter and go with the default settings.
mysql_secure_installation

To Verify mariadb Installed or Not
sudo service mysql status

PHP:
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

sudo apt-get install php5 libapache2.mod.php5 
                             or
sudo apt-get install php5 php5-mysql libapache2-mod-php5

To Create a Sample testphp.php in Apache document root folder.
sudo nano /var/www/html/testphp.php

mkdir /var/www

sudo gedit /var/www/testphp.php

<?php phpinfo(); ?>
OR
<?php
phpinfo();
?>


Restart Apache:
sudo /etc/init.d/apache2 restart

To Verify MySQL Installed or Not
http://localhost/testphp.php

PHPMyAdmin: (Optional)
sudo apt-get install libapache2-mod-auth-mysql phpmyadmin
sudo gedit /etc/apache2/apache2.conf

Include /etc/phpmyadmin/apache.conf

sudo /etc/init.d/apache2 restart

To Verify MySQL Installed or Not
http://localhost/phpmyadmin