Search blog

Sunday, March 26, 2017

[SOLVED] - Add Currently Logged in User to Apache User & Group [www-data:www-data]

If you are experiencing permission issues with your web directories and files, use the following commands to resolve it, This solution is very helpful if you are trying to run Wordpress/Other CMS in localhost environment:

1. Adds the currently logged in user to the www-data group.

 sudo usermod -aG www-data $USER  

2. Changes the ownership of the /var/www directory to www-data group.
 sudo chown -R www-data:www-data /var/www directory_name

3. Sets the proper permissions so you can upload files via sftp, manage files via command-line, and upload plugins and media directly in WordPress.
 sudo chmod -R 774 /var/www directory_name

Saturday, March 11, 2017

How to Zip/Compress files using Terminal in Ubuntu/Linux

Use the following commands to compress your files using terminal. First, make sure you have Zip already installed in your system.

>> To install Zip: Open you terminal (CTRL+ALT+T) and enter the command below:
 sudo apt-get install zip gzip tar  

>> To Zip:
 zip -r compressed_filename.zip foldername  

where:
  • r: recursive
  • compressed_filename.zip: name of your .zip folder you want to create. Example: magento-file-sys.zip
  • folder_name: name of the folder that you want to compress
Seems to be much faster and consume almost 80%-90% less CPU processes than the one using GUI/Archive Manager.; but file size seems to be large by 10-20 MB than the one created using the menu option available in GUI/Archive Manager.

>> To Unzip:
 unzip my_arch.zip  

Zip stores relative path names by default. There are several parameter-options available for zip. For that read: the manual (man zip). For a starting this will do.

Most often you will see .tar.gz endings in linux-world. That's the product of two tools: TAR (the tape archiver) and GZIP (the GNU-Zip). Tar has got the call option to automatically gzip/gunzip files after "taring".
 tar -cvzf may_arch.tar.gz my_folder  

where:
  • -c means "create"
  • -v means "verbose" (sometimes bothersome and slowing down...)
  • -z means "use (GNU)zip"
  • -f XYZ declares the name of the output file. (You should chose a helping name like XYZ.tar.gz)
There may also be .tar.bz2 endings. This is the product of the -j parameter instead of the -z parameter: you will choose compression with BZIP2 (-> man bzip2).

To extract you simply use -x (eXtract) instead of -c (Create):
 tar -xvzf may_arch.tar.gz  

Wednesday, March 8, 2017

[SOLVED] - W: GPG error: .. The following signatures were invalid: BADSIG ... Ubuntu Extras Archive Automatic Signing Key

While trying to UPDATE/UPGRADE your Ubuntu system from the terminal, you might be bumping, time and again into what is called the BAD SIGNATURE error. Something like this:

W: GPG error: http://01.archive.ubuntu.com trusty Release: The following signatures were invalid: BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key <ftpmaster@ubuntu.com>

To solve the bad signature error in your Ubuntu Installation try the following solution:
 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys your_key_number  
 Example: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192  
Rebuild your software cache:
 sudo apt-get clean   
 cd /var/lib/apt   
 sudo mv lists oldlist   
 sudo mkdir -p lists/partial   
 sudo apt-get clean   
 sudo apt-get update  
If the above solution doesn't work, you may try the solution below:
 $ sudo -i  
 # apt-get clean  
 # cd /var/lib/apt  
 # mv lists lists.old  
 # mkdir -p lists/partial  
 # apt-get clean  
 # apt-get update  

Top 5 Posts (Weekly)