Wednesday, October 24, 2018

MariaDB & phpMyAdmin on CentOS 7

MariaDB & phpMyAdmin on CentOS 7

Video URL : https://youtu.be/SM_Efy40zso?list=PLEiDY15kH-ieq5E63exIhVkd-Ldie3PTy
Video Title : How to Install Mariadb / Mysql in CentOS 7
Youtube upload URL : https://www.youtube.com/watch?v=SM_Efy40zso&feature=youtu.be&list=PLEiDY15kH-ieq5E63exIhVkd-Ldie3PTy
Youtube upload Title : MariaDB setup on CentOS7-by-NCD0318H021
Task 1 : Install and configure MariaDB in CentOS7
Solution :
Step1 :
#Login into Guest VM on centos7
#Add MariaDB Yum Repository as MariaDB.repo under /etc/yum.repo.d
#Add below content to the MariaDB.repo
 vi  /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
SAVE and CLOSE the file

Step2 :
#install MariaDB as below#
yum install MariaDB-server MariaDB-client -y
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo systemctl status mariadb
#Start, enable and check the status of MariaDB by below commands#

Step 3 :#Now setup the user secure password by the following command
sudo mysql_secure_installation
root MariaDB password set during installation:
Enter current password for root (enter for none):
Then, assuming you set a strong root password, go ahead and enter n at the following prompt:
Change the root password? [Y/n] n
Remove anonymous users, Y:
Remove anonymous users? [Y/n] Y
Disallow root logins remotely, Y:
Disallow root login remotely? [Y/n] Y
Remove test database and access to it, Y:
Remove test database and access to it? [Y/n] Y
And reload privilege tables, Y:
Reload privilege tables now? [Y/n] Y

Step 4 :##Login  into the MariaDB by the below command##
mysql -u root -p

##Now we are inside the MariaDB
#Give the below command to see Data bases available##

Step 5 : 
##See more information about mariadb by using below commands
show database;
use mysql;
show tables;
describe mysql.user;
##Describe command will list the database tables


Task 2 : Create a New MariaDB User , Database and Datatable
Solution : 

Step 1 :
###create a database by the below command ###
create database Database1;

Step 2 :
##create a user
create user 'ncodeitadm'@192.168.11.192 identified by 'password';

Step 3 :
##Give permissions to user on Database
grant all on Database.* to 'ncodeitadm' identified by 'password';
exit

Step 4 :
##Creation of a Database Table
##Login to mariaDB user
mysql -u root -p
## To connect the above user to Database use below command ##
use Database1

##create Sample Database table with the name  SampleTB##
##This creates a table with a customer ID field of the type INT for integer (auto-incremented for new records, used as the primary key), as well as two fields for storing the  SampleTB name:
create table Sample (customer_id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name TEXT, last_name TEXT);

Step 5
##To view newly created tables use below command##
show tables;
exit





Video URL : https://youtu.be/8O5HCmI3Lyo?list=PLxlXdZ1Dia3o91pVS0HXdSfcPkicVdwI9
Video Title : How to install PhpMyAdmin on CentOS 6
Youtube upload URL : https://youtu.be/Zd7g3MQlPng?list=PLEiDY15kH-ieq5E63exIhVkd-Ldie3PTy

Youtube upload Title : MariaDB setup on CentOS7-by-NCD0318H021
Task 3 : Install And setup PHPMyAdmin on CentOS 7
Solution :
Prerequisites
 :
VM setup for CentOS7
Must have LAMP stack means Linux, Apache, MariaDB/Mysql , and PHP
Step1 :
sudo yum install epel-release -y

Step2 :
sudo yum install httpd php -y

Step3 :
sudo systemctl start httpd.service
sudo systemctl enable httpd.service
##Make sure php-fpm module is  available or not ##
##install module php-fpm
sudo yum install php-fpm
##Test PHP Processing on your Web Server by creating a file info.php
sudo vi /var/www/html/info.php
<?php phpinfo(); ?>
SAVE and CLOSE file
systemctl stop firewalld
systemctl disable firewalld

##access in browser
http://ip/info.php
sudo rm /var/www/html/info.php                    ##Its not necessary

Step4 :
##install phpMyAdmin
sudo yum install phpmyadmin

sudo vi /etc/httpd/conf.d/phpMyAdmin.conf                        ##Add the below content  ##
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8<IfModule mod_authz_core.c>
# Apache 2.4
#<RequireAny>
# Require ip 192.168.11.225
# Require ip ::1
#</RequireAny>
Order Deny,Allow
Allow from all
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Allow from All
</IfModule>
</Directory><Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 192.168.11.225
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 192.168.11.225
Allow from ::1
</IfModule>
</Directory>
Save and Close file
sudo vi etc/httpd/conf/httpd.conf                              ##Add below content##
<Directory /phpmyadmin >
#order deny,allow
#Allow from all
AllowOverride all
Require all granted
Allow from 192.168.11.225
</Directory><Directory /usr/share/phpmyadmin >
#order deny,allow
#Allow from all
AllowOverride all
Require all granted
Allow from 192.168.11.225
</Directory>
Save and Close file
sudo systemctl restart httpd.service

Step 5 :
##Now open browser
http://<IP>/phpMyAdmin
Now login with MariaDB user and password details.

Rundeck setup on CentOS 7

Rundeck setup on CentOS 7



  • Video Title : Rundeck: How to add Nodes


  • Youtube upload Title :   Rundeck: How to add Nodes by NCD0518H025

How to Add Nodes in rundeck

STEP 1:  after login to Rundeck server.Now create a new project to give access for jobs and Nodes
a)click on New Project
b)Name the project
c)check ssh , scp location
d) Create

STEP 2:Now create a new job for the project
a) click on “create job”
b) Give name to the job
c)Give name to “job group”
d) Give purpose of job Description
e) Add a command in Execute a remote command
f) Now Save the job

STEP 3 :Generate SSh Key and upload to rundeck server
1
                 # ssh-keygen -t rsa

STEP 4:use the cat command to view the key
1
                # cat .ssh/id_rsa
a)Now copy the key and upload to server in key storage
b)Key Type = Private Key
c) Enter Text = paste the key which is copied
d) Give Name=private.key
e) Save

STEP 5: Add a node to rundeck servera)Now go to Command Line Interface
1
           # cd /var/rundeck/projects/project name/etc

b) edit resources.xml file
1
           # sudo vi resources.xml

c)Give the node details in between <project> and </project>
d)Give details of “name”–>”description”–>”tags”–> “hostname”–>”osfamily”–>osNmae–>”username”–>”ssh-key-storage-path”

  • Hostname can be given or use ip-address
  • In ssh-key-storage-path which is to be given key storage /key/nodes/private.key
  • Save

≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡
  • Video Title :  How add node to rundeck server and run a job on remote node


  • Youtube upload Title : How add node to rundeck server and run a job on remote node by NCD0518H025

How to add node to rundeck server and run a job on remote node

STEP 1: Install java latest version and rundeck

1
              # sudo yum -y instal java-1.8.0-openjdk-devel
1
             # rpm -Uvh http://repo.rundeck.org/latest.rpm
1
             # sudo yum -y instal rundeck

STEP 2:   After installing ,the service must be started
1
              # sudo systemctl start rundeckd

STEP 3: change directory to ” /etc/rundeck’

a) choose an editor and open “framework.properties”
1
             # sudo vi framework.properties

b) Replace “Ip address of server” with “localhost”

c) open rundeck-config.properties
1
             # sudo vi rundeck-config.properties

d) Replace “loaclhost” to “Ip address of server” for “grails.serverURL”

STEP 4: Restart rundeck make sure it is running ,stop firewalld and access it on browser 
1
              # sudo systemctl stop firewalld
1
              # sudo systemctl disable firewalld
1
              http://serverip:4440

STEP 5: after login to Rundeck server.Now create a new project to give access for jobs and Nodes
a)click on New Project
b)Name the project
c)check ssh , scp location
d) Create

STEP 6:Now create a new job for the project
a) click on “create job”
b) Give name to the job
c)Give name to “job group”
d) Give purpose of job Description
e) Add a command in Execute a remote command
f) Now Save the job

STEP 7:Generate SSh Key and upload to rundeck server
1
               # ssh-keygen -t rsa
STEP 8:  use the cat command to view the key
1
               # cat .ssh/id_rsa
a)Now copy the key and upload to server in key storage
b)Key Type = Private Key
c) Enter Text = paste the key which is copied
d) Give Name=private.key
e) Save

STEP 9: Add a node to rundeck server
a)Now go to Command Line Interface
1
            # cd /var/rundeck/projects/project name/etc

b) edit resources.xml file
1
            # sudo vi resources.xml

c)Give the node details in between <project> and </project>
d)Give details of “name”–>”description”–>”tags”–> “hostname”–>”osfamily”–>osNmae–>”username”–>”ssh-key-storage-path”

  • Hostname can be given or use ip-address

  • In ssh-key-storage-path which is to be given key storage /key/nodes/private.key

STEP 10: Now copy the public key to rundeck server using “ssh-copy-id” command
a) copy public key being “root” user
1
            # ssh-copy-id username@ipaddress
b) copy public key being “rundeck” user
1
            #su - rundeck
1
            #ssh-copy-id username@ipaddress
STEP 11:now restart rundeck server
1
            # systemctl restart rundeckd
check status of server whether it is running
1
           #systemctl status rundeckd
STEP 12: Now go to nodes section in server and check new node is added

a) select the project check nodes has been added
b) choose all nodes and list which was updated recently

STEP 13: Run the job on new node