Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, June 8, 2022

Upgrade php 7 to 8 (7.4 to 8.0)

 For Redhat(RHEL 7)  or centos 7


sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

 1001  sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm

 1002  sudo yum -y install yum-utils

 1003  sudo yum-config-manager --disable 'remi-php*'


 1005  sudo dnf install php php-cli php-common

 1006  sudo yum-config-manager --disable remi-php54

 1007  sudo yum-config-manager --disable remi-php74

 1008  sudo yum-config-manager --enable remi-php80

 1009  sudo yum update

 1010  php -v


* Want to disable last remi and enable new remi

Tuesday, June 14, 2016

Use different PHP version CLI executable for one command

Maybe you can try to fix the environnement!
$ php -v
PHP 5.4.x (cli) ...
$ set PATH="/usr/lib64/php5.6/bin:$PATH"
$ php -v
PHP 5.6.x (cli) ...
Or, if you don't want to modify the PATH for your shell session, you can scope the change for the current command only:
$ php -v
PHP 5.4.x (cli) ...
$ env PATH="/usr/lib64/php5.6/bin:$PATH" php -v
PHP 5.6.x (cli) ...
$ php -v
PHP 5.4.x (cli) ...
If you can't change path then you can execute command as follows,(Eg: php -v)
First you want to know php-cli path
$ /php-cli-path -v

Eg:-
/usr/local/php70/bin/php-cli -v

rsync

rsync - how to suppress "skipping non-regular file" messages:-

Three basic behaviors are possible when  rsync  encounters  a  symbolic
       link in the source directory.

       By  default,  symbolic  links  are  not  transferred at all.  A message
       "skipping non-regular" file is emitted for any symlinks that exist.

       If --links is specified, then symlinks are recreated with the same tar-
       get on the destination.  Note that --archive implies --links.

       If  --copy-links is specified, then symlinks are "collapsed" by copying
       their referent, rather than the symlink.

       Rsync can also distinguish "safe"  and  "unsafe"  symbolic  links.   An
       example  where  this  might be used is a web site mirror that wishes to
       ensure that the rsync module that is copied does not  include  symbolic
       links  to  /etc/passwd  in  the  public  section  of  the  site.  Using
       --copy-unsafe-links will cause any links to be copied as the file  they
       point  to  on  the  destination.   Using --safe-links will cause unsafe
       links to be omitted altogether.  (Note that you  must  specify  --links
       for --safe-links to have any effect.)

       Symbolic  links  are  considered  unsafe  if they are absolute symlinks
       (start with /), empty, or if they contain  enough  ".."  components  to
       ascend from the directory being copied.

       Here's  a summary of how the symlink options are interpreted.  The list
       is in order of precedence, so if your combination of options isn't men-
       tioned, use the first line that is a complete subset of your options:

       --copy-links
              Turn all symlinks into normal files (leaving no symlinks for any
              other options to affect).

       --links --copy-unsafe-links
              Turn all unsafe symlinks into files and duplicate all safe  sym-
              links.

       --copy-unsafe-links
              Turn  all unsafe symlinks into files, noisily skip all safe sym-
              links.

       --links --safe-links
              Duplicate safe symlinks and skip unsafe ones.

       --links
              Duplicate all symlinks.

Saturday, June 11, 2016

How to unzip/extract a .tar.gz file in linux?

Type man tar for more information, but this command should do the trick:
tar -xvzf community_images.tar.gz
To explain a little further, tar collected all the files into one package, community_images.tar. The gzip program applied compression, hence the gz extension. So the command does a couple things.
  • f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.
  • z: tells tar to decompress the archive using gzip
  • x: tar can collect files or extract them. x does the latter.
  • v: makes tar talk a lot. Verbose output shows you all the files being extracted.

Copying Files Over SSH

Secure copy is a really useful command, and it’s really easy to use. The basic format of the command is as follows:
scp [options] original_file destination_file
The biggest kicker is how to format the remote part. When you address a remote file, you need to do it in the following manner:
user@server:path/to/file
The server can be a URL or an IP address. This is followed by a colon, then the path to the file or folder in question. Let’s look at an example.
scp –P 40050 Desktop/url.txt yatri@192.168.1.50:~/Desktop/url.txt
This command features the [-P] flag (note that it’s a capital P). This allows me to specify a port number instead of the default 22. This is necessary for me because of the way I’ve configured my system.

Monday, March 9, 2015

How can I use grep to find a word inside a folder?

grep -nr yourString* .
The dot at the end searches the current directory, and -r searches sub-directories.
grep -nr MobileAppSer* . (Will search for MobileAppServlet.java or .class or .txtMobileAppASer*.* is another way to do the same thing.)

Tuesday, March 3, 2015

How To Install the Firefox Developer Edition in Linux Ubuntu 14.10, Ubuntu 14.04 & Others

Method 1

  • Install Firefox Developer Edition, formerly know as Aurora by running the following commands:

    sudo add-apt-repository ppa:ubuntu-mozilla-daily/firefox-aurora
    sudo apt-get update
    sudo apt-get install firefox

    Ubuntu versions supported: Utopic (14.10), Trusty (14.04), Precise (12.04).
Note that this method will replace your current Firefox installation.

Method 2

  • Download the firefox developer edition here:
    https://www.mozilla.org/en-US/firefox/developer/
  • Extract the file manually to /opt/firefox/
  • Open Nautilus: Go to Edit->Preferences-> Behavior-> click on “Run executable text files when they are opened”
  • Go to the file ‘firefox’ in /opt/firefox/
  • Right click and select Properties–> Permissions–> Execute: Allow executing file as a program.
  • Open terminal and type:
  • 'gnome-desktop-item-edit' not installed in your computer then you want to run following command
sudo apt-get install gnome-panel
then run following command
gnome-desktop-item-edit ~/.local/share/applications --create-newCreate a shortcut and it’s done.


Tuesday, January 27, 2015

How to use open ssh key?

The OP already has a key, it is a .ppk which is a format used by Putty. The OP has converted it to an open ssh key already.
To use the key,
First, by default, the key should stored in ~/.ssh with permissions of 600 as outlined above.
Second, you have two options to use the key.
Option 1 - Use putty - You can install and use putty in Linux. Putty can use the key in either format.
Option 2 - Use ssh on the command line
ssh -i ~/.ssh/your_key user@server
If you have any errors , post them here.

How to establish ssh key pair when “Host key verification failed”

I have set up ssh key pairs between my desktop and two servers, and from the servers to my desktop, but after reinstalling the OS on my desktop, I can't re-establish the keypair going into my desktop by this:
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t 
ssh-copy-id username@server
I get the following error:
(names in italics changed to protect the innocent My desktop is Ubuntu, and I can't find the answerhere)
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is ab:cd:ef:gh Please contact your system administrator. Add correct host key in /home/user/.ssh/known_hosts to get rid of this message. Offending key in /home/user/.ssh/known_hosts:1 RSA host key for user.server has changed and you have requested strict checking. Host key verification failed.

Solution

ssh-keygen -R hostname
This deletes the offending key from the known_hosts
The man page entry reads:
-R hostname Removes all keys belonging to hostname from a known_hosts file. This option is useful to delete hashed hosts (see the -H option above).

How to convert .ppk key to OpenSSH key under Linux (ubuntu)

Do it with Putty.
  • Linux: with your package manager, install PuTTY (or the more minimal PuTTY-tools):
    • Ubuntu sudo apt-get install putty-tools
Place your keys in some directory, e.g. your home folder. Now convert the PPK keys to SSH keypairs:cache search
To generate the private key:
cd ~
puttygen id_dsa.ppk -O private-openssh -o id_dsa
and to generate the public key:
puttygen id_dsa.ppk -O public-openssh -o id_dsa.pub
Move these keys to ~/.ssh and make sure the permissions are set to private for your private key:
mkdir -p ~/.ssh
mv -i ~/id_dsa* ~/.ssh
chmod 600 ~/.ssh/id_dsa
chmod 666 ~/.ssh/id_dsa.pub
If you have already tried to perform a 'git clone' operation you might need to do this also
chmod 666 ~/.ssh/known_hosts