About installing apache after uninstalling apache under linux

The facts show that good memory is not as good as bad writing, not to mention that if you don’t have good memory, you need to make some necessary records, because with the passage of time, many things will gradually be forgotten. At this time, if you look at the previous notes, you can get twice the result with half the effort. !


In the past, a system monitoring software zabbix was configured under linux, and it was generally used well. Because it needs to be displayed on the web page, it is necessary to set up a lamp environment, and then configure apache2 to open the local web page and display that as the home page. I will never touch it again. , I didn’t record it. The configuration file and information at that time had long been forgotten. Later I made a fool of myself and found that the apache service couldn’t run anymore. I opened the configuration file and found that it was empty without any information, so I started apache2的重装.


Simply remove and install apache2 for the first time. When I started, I found that it still failed to start, and the configuration file was empty. So I searched the Internet and solved the problem. Then I integrated the online methods.


First, run the following commands:

sudo apt-get --purge remove apache2
sudo apt-get --purge remove apache2.2-common
sudo apt-get autoremove


Then, find the configuration files that have not been deleted, and delete them all

sudo find /etc -name "*apache*" -exec rm -rf {} \;

sudo rm -rf / var / www


After running the above command, you may also need to delete the relevant information of the mysql database. Anyway, I uninstalled all the database before running the above command. I don’t know if it will work if mysql is not uninstalled. First, remember the operation of uninstalling mysql. Come down.

  1. sudo apt-get autoremove --purge mysql-server-5.0  
  2. sudo apt-get remove mysql-server  
  3. sudo apt-get autoremove mysql-server  
  4. sudo  apt-get  remove  mysql-common  //This is very important 
sudo apt-get install mysql-server (reinstall)

In fact, I have long wanted to reinstall the mysql database. I didn’t know why I forgot the root user’s password when I installed it. Then it’s a tragedy. After the reinstallation is complete, you will be asked to enter the root user’s password, and then I lost mine. Common passwords. But after opening the database, it is found that the previously created tables and databases are still there. Maybe the data has not been deleted, but this is not bad, and there is no need to create new tables and databases.


Finally, reinstall apache2, run sudo apt-get install apache2, and then the installation is complete, open the configuration file to see that it is all initialized, and then enter localhost in the browser, and it works to indicate that the apache installation is complete, of course, the premise is that you have After installing the LAMP environment.



Guess you like

Origin blog.csdn.net/u012457196/article/details/38357001