Thursday, June 19, 2014

How to Reinstall apache2 properly in linux

If you have issues with apache2 and you want to reinstall it but you are getting errors,then here it isthe solution for you.

For example, me i had an issue with apache, when i tried to start it i got this error message  :

root@pirat9-desktop:/etc/apache2# /etc/init.d/apache2   start
.: 45: Can't open /etc/apache2/envvars
Now i want to reinstall apache, but first i need to remove it completely  (If you currently have it removed improperly, reinstall it by “sudo apt-get install apache2″ before to use the command bellow). To do that i will use this command :
 sudo apt-get remove --purge apache2 apache2-utils
This command will completely remove all apache2 configuration files and directories.
- Reinstall again apache using the normal command
sudo apt-get install apache2

Now your config files and directories in /etc/apache2 all be back and at their defaults as well as the “apache2-utils previously removed.

root@pirat9-desktop:/etc/apache2# /etc/init.d/apache2   start
 * Starting web server apache2                                  using for ServerName
httpd (pid 7235) already running   [ OK ]

No comments:

Post a Comment