Search blog

Tuesday, January 19, 2016

Steps for Creating SSH Connection in Ubuntu 14.04

1. First you should generate an SSH key pair on your Linux distribution. Open up your terminal and execute the following commands:

 user@localhost: ssh-keygen -t dsa  
 Generating public/private dsa key pair.  
 Enter file in which to save the key (/home/user/.ssh/id_dsa): (just press Enter here)  
 Enter passphrase (empty for no passphrase):  
 Enter same passphrase again:  
Once you've entered the passphrase you will see the following message as below:
 Your identification has been saved in id_dsa.  
 Your public key has been saved in id_dsa.pub.  
 The key fingerprint is:  
 16:8e:e8:f2:1d:c9:b9:cf:43:9a:b3:3c:c1:1f:95:93 user@localhost  

This will create a private key written to /home/user/.ssh/id_dsa and a public key written to /home/user/.ssh/id_dsa.pub. The passphrase is used to protect your key. You will be asked for it when you connect via SSH.

2. If you are using cPanel then log into it and open the SSH section. Then open the file 'id_dsa.pub' in a text editor like Gedit. The file will be located at '/home/user/.ssh/id_dsa.pub.' The '.ssh' directory might be hidden so press 'CTRL+H' to view hidden files & folders. Select ALL & COPY the content of the file inside the box with the label 'Public Key (DSA only):' Look at the image below.



3. Logging in to your Web Hosting account via SSH in Linux:

 user@localhost: ssh-add /home/user/.ssh/id_dsa  
 Enter passphrase for id_dsa:  
 Identity added: id_dsa (id_dsa)  

(The passphrase is the same as the one you have set during the generation of the SSH key in Step 1).

Then you should initiate an SSH connection:

user@localhost: ssh USER@HOST_NAME -pPORT

  • USER - the user for which you want to establish the SSH connection; this will be the same username as the one you use to log in to your cPanel.
  • HOST_NAME (or IP address) - here you should enter the host/IP of the server to which you wish to connect (e.g. siteground300.com);
  • PORT - the port for the connection - here you should enter the port provided by your Web Host; try something like -p18765
Press "Enter" and if everything has been set up properly, you will establish an SSH connection to your account.

Sunday, January 3, 2016

Updating PHP & MySQL in Ubuntu 14.04

1. Updating PHP 5.5 to PHP 5.6

To upgrade to a newer version of PHP 5.6 on Ubuntu 14.04, you can use Ondřej Surý's PPA. He is one of the Debian maintainers of the php5 package. Also not that this update will overwrite any change you made to your 'php.ini' files. So, I recommend you make a back up of your 'php.ini' file and later on you can use it as a reference file to make changes in your new 'php.ini' file.

To add the PPA and upgrade your packages, run:

 sudo apt-get install software-properties-common  
 sudo add-apt-repository ppa:ondrej/php5-5.6  
 sudo apt-get update  
 sudo apt-get upgrade  
 sudo apt-get install php5  

1. Updating MySQL 5.5 to MySQL 5.6

 step 1 : take a backup  
 mysqldump --lock-all-tables -u root -p --all-databases > dump.sql  
 step 2 : remove old mysql  
 sudo apt-get remove mysql-server  
 sudo apt-get autoremove  
 step 3 : install new version of mysql  
 sudo apt-get install mysql-client-5.6 mysql-client-core-5.6  
 sudo apt-get install mysql-server-5.6  
 step 4 : restore your data  
 mysql -u root -p < dump.sql  

3. If error after logging into phpMyAdmin:

If you happen to get an error as below:

'Your PHP MySQL library version 5.5.46 differs from your MySQL server version 5.6.27.....'

Run the following commands:

 sudo apt-get remove php5-mysql  

You might have to reinstall your phpMyadmin.

To reinstall phpMyadmin enter the following commands:

 sudo apt-get install phpmyadmin  

Top 5 Posts (Weekly)