Category Archives: Unix

How to uninstall and remove Apache2 on Ubuntu

The first step is to stop any running instance of Apache2, because Apache2 will not be properly removed while it is running.

sudo service apache2 stop

Then uninstall Apache2 and its dependent packages. Use purge option instead of remove with apt-get command. The former option will try to remove dependent packages, as well as any configuration files created by them. In addition, use autoremove option as well, to remove any other dependencies that were installed with Apache2, but are no longer used by any other package.

sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove

Finally, check if there is any configuration files or manual pages belonging to Apache2, which are still not removed.

whereis apache2

apache2: /etc/apache2
In this example, /etc/apache2 directory still exists. Since this directory (as well as any configuration files in it) is no longer necessary, go ahead and remove it manually.

sudo rm -rf /etc/apache2

And that’s it!

 

Install phpmyadmin in vagrant box using provision

Inside provision.sh file have this:

# Install phpmyadmin

sudo apt-get install phpmyadmin

# Create symbolic link for phpmyadmin

sudo ln -s /usr/share/phpmyadmin/ /vagrant/phpmyadmin

 

sudo cat >> /etc/nginx/sites-available/default <<'EOF'

#################### PHPMYADMIN ####################
server {

listen 80;

server_name phpmyadmin.app;

root /vagrant/phpmyadmin/;
index index.php;

location / {
try_files $uri $uri/ /index.php?$uri&$args;
}

sendfile off;

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 200;
}

}

EOF

Then outsite vagrant box runĀ vagrant provision

 

Edit cron jobs via SSH

1. Login with ssh

2. Then use this command:


crontab -e

3. Press “a” to enter edit mode

4. Make any necessary changes*

5. Press ESC then write -wq to save and exit

 

* Necessary changes:

For example, use this


5 * * * * curl http://google.com

to execute the curl every 5 minutes

Also, on top of the cron file, you can have the email notification like this line:


MAILTO=daniel.oraca@gmail.com

and this will send email notifications each time the cron job gets executed