Tuesday, April 27, 2021

How to Install XAMPP on linux ?

 What is XAMPP?



XAMPP is the most popular PHP development environment.

XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl.


Download the latest version from here


wget https://www.apachefriends.org/xampp-files/7.4.16/xampp-linux-x64-7.4.16-0-installer.run


After download change the permission :


chmod 755 xampp-linux-x64-7.4.16-0-installer.run


sudo ./xampp-linux-x64-7.4.16-0-installer.run


If it linux server Press all Yes during installation. 

If it is the desktop version of linux press next during installation. 



Now need to change the permission for htdocs :


cd /opt/lampp/



chmod -R 777 htdocs


cd htdocs


create one demo.php file and write code :


<?php

echo “Welcome to linux for freshers” 

?>


To start the XAMPP service :


sudo /opt/lampp/lampp start


Starting XAMPP for Linux 7.4.16-0...

XAMPP: Starting Apache...ok.

XAMPP: Starting MySQL...ok.

XAMPP: Starting ProFTPD...ok.




To run the php file:

http://localhost/demo.php


Or 


http://lip_address/demo.php




To stop the XAMPP service:


sudo /opt/lampp/lampp stop


Stopping XAMPP for Linux 7.4.16-0...

XAMPP: Stopping Apache...ok.

XAMPP: Stopping MySQL...ok.

XAMPP: Stopping ProFTPD...ok.



Friday, April 23, 2021

how to send broadcast messages to all currently logged on users in linux ?

 Wall displays the contents of a file or, by default, its standard input, on the terminals of all currently logged-in users. The command will cut over 79 character long lines to new lines. Short lines are white space padded to have 79 characters. The command will always put the carriage return and new line at the end of each line.


Only the super-user can write on the terminals of users who have chosen to deny messages or are using a program that automatically denies messages.


Reading from a file is refused when the invoker is not a superuser and the program is suid or sgid.


Usually, system administrators send messages to announce maintenance and ask users to log out and close all open programs. The messages are shown to all logged-in users with a terminal open.


Syntax:


wall [-n] [-t timeout] [message | file]




The most straightforward way to broadcast a message is to invoke the wall command with the message as the argument:


Example: 


wall "The system will be restarted in 10 minutes."


Output:


Broadcast message fromroot@linuxforfreshers (pts/0) (Mon Jan  4 13:22:07 2021):


The system will be restarted in 10 minutes.


The message will be broadcasted to all users that are currently logged in.



To suppress the banner and show only the text you types to the logged-in users, invoke the command with the -n (--nobanner) option:


Example: 


wall -n "The system will be restarted in 10 minutes."


Output: 

The system will be restarted in 10 minutes.




If you want to write multi-line messages, invoke the command without an argument:


wall


The wall command will wait for you to enter text. When you’re done typing the message, press Ctrl+D to end the program and broadcast the message.



You can also use the here-string redirection or pipe the output of another command to wall. Here is an example showing how to use the echo command to broadcast multi-line messages:


Example:


echo "The system will be restarted in 10 minutes. \nPlease save your work."  | wall


Output:


Broadcast Message from root@linuxforfreshers                                       

        (/dev/pts/1) at 13:36 ...                                              

                                                                               

The system will be restarted in 10 minutes. \nPlease save your work.        


Broadcasting a Message From a File 


If you are regularly sending the same messages, you can write each one of them to a file, so that you don’t need to re-type the same text. wall reads from the file only when invoked as root.


To broadcast the contents of a file, invoke the wall command followed by the file name:


cat message1_file.txt

The system will be restarted in 10 minutes.


Example:


wall message1_file.txt


OUTPUT:


Broadcast message from root@linuxforfreshers (pts/0) (Mon Jan  4 13:30:07 2021):


The system will be restarted in 10 minutes.


Thursday, April 8, 2021

How to change python default version in ubuntu?

 In ubuntu By default python version was 2.7. We need to use python3 to run the python files with the latest version.


Steps to change the default python version to 3


Check the current version 


#python --version

Python 2.7.17



Execute this command to switch to python 3.6. 


#sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1


Output:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1

update-alternatives: using /usr/bin/python3 to provide /usr/bin/python (python) in auto mode


Check python version


python --version

Python 3.6.9



Tuesday, April 6, 2021

How to Install innotop in linux?

Innotop is an efficient command-line monitoring tool for local and remote MySQL servers running under Innodb. It helps to monitoring several operations like MySQL replication status, user statistics, query list, InnoDB buffers, InnoDB I/O information etc.



To Install Innotop


Run the following command to install Innotop


In RedHat


yum install innotop


In Ubuntu


Fetch innotop from its GIT repository:


Install Perl dependency:


sudo apt install libterm-readkey-perl libclass-dbi-perl libclass-dbi-mysql-perl make 


sudo apt-get install git

git clone https://github.com/innotop/innotop.git


Or 



wget https://github.com/innotop/innotop/archive/refs/heads/master.zip




cd innotop/

perl Makefile.PL


Note:If there no warnings and errors (in case you have to fix other dependencies), proceed with the installation of this good MySQL InnoDB real-time monitor:



sudo make install


Innotop can be launched in several ways, the easiest is to provide, on the command line, username and password (with -u [user] and -p [password]) of a privileged user.


Syntax:


sudo innotop -uuser -ppassword


Now the terminal will be logged in.



Press " ?" help symbol to view the various option available.


To Monitor the remote mysql server


If you want to monitor the remote mysql server, run the below command. Login the remote mysql server enter the mysql username, password and hostname.


sudo innotop -uuser -ppassword -hip_address