Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB

sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
grub-install /dev/sda

or

grub-install --recheck /dev/sda
update-grub
exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt

References :
http://howtoubuntu.org/how-to-repair-restore-reinstall-grub-2-with-a-ubuntu-live-cd

Configure Xdebug for debugging PHP on Ubuntu

sudo apt-get install php5-xdebug
find / -name 'xdebug.so'

Now update the options in PHP.INI – /etc/php5/apache2/php.ini

# Added for xdebug
zend_extension="/usr/lib/php5/20121212/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.max_nesting_level=300

Restart Apache2, and you are ready to go!

sudo service apache2 restart

References :
http://ubuntuforums.org/showthread.php?t=525257
http://wylbur.us/2014-06-17-add-xdebug-to-ubuntu-1404
http://purencool.com/installing-xdebug-on-ubuntu
https://www.jetbrains.com/phpstorm/help/configuring-xdebug.html

Install WordPress on Ubuntu

Install Apache

sudo apt-get install apache2

Install MySQL

sudo apt-get install mysql-server php5-mysql

Install PHP

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-curl
sudo apt-get install php5-cli

Create a MySQL Database and User for WordPress

mysql -u root -p
create database wordpressdb;
create user wordpressuser@localhost identified by 'pass1234';
grant all privileges on wordpressdb.* to wordpressuser@localhost;
FLUSH PRIVILEGES;

exit

Download WordPress

wget http://wordpress.org/latest.tar.gz

or

sudo apt-get install wordpress
sudo apt-get install php5-gd libssh2-php

The group ownership we will give to our web server process, which is www-data. This will allow Apache to interact with the content as necessary.

sudo chown -R :www-data /var/www/html/wordpress

MySQL Error: : ‘Access denied for user ‘root’@’localhost’

  1. Open & Edit /etc/my.cnf or /etc/mysql/my.cnf, depending on your distro.
  2. Add skip-grant-tables under [mysqld]
  3. Restart Mysql
  4. You should be able to login to mysql now using the below command mysql -u root -p
  5. Run mysql> flush privileges;
  6. Set new password by ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassword';
  7. Go back to /etc/my.cnf and remove/comment skip-grant-tables
  8. Restart Mysql
  9. Now you will be able to login with the new password mysql -u root -p

Refernces :

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-14-04
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
https://kyup.com/tutorials/install-wordpress/
https://help.ubuntu.com/community/WordPress
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-16-04
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04
https://stackoverflow.com/questions/41645309/mysql-error-access-denied-for-user-rootlocalhost

Swappiness

– Open a terminal
– type in or copy/paste:

sudo gedit /etc/sysctl.conf

– a file will be opened
– add the following line at the bottom of that file:

# Swappiness
vm.swappiness = 10
vm.vfs_cache_pressure = 50

– save the file and close it.

After rebooting the swappiness is set to 10. This can be checked by running the following command in a terminal:

sudo cat /proc/sys/vm/swappiness

References :

https://sites.google.com/site/tipsandtricksforubuntu/system-tips/swappiness
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04