sirleech / gist:1813307
Purge is required to remove all the config files — if you delete the config files but only remove the package, then this is remembered & missing config files are not reinstalled by default.
Footer
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Я хочу удалить Apache в Ubuntu. Как это сделать?

Это краткое руководство показывает студентам и новым пользователям, как удалить Apache и/или очистить Ubuntu 20.04 | 18.04.
Если вы веб-мастер и хотите удалить веб-сервер Apache со своего хоста, вам помогут следующие шаги.
Существует два основных способа удаления или удаления программ из систем Ubuntu и Linux.
Вы можете запустить apt remove или apt purge.
Когда вы используете опцию remove с apt, команда удалит программный пакет из системы, но оставит файлы конфигурации.
Использование очистки с apt приведет к удалению пакета программного обеспечения, включая все файлы конфигурации и настройки.
Если вы хотите удалить Apache из Ubuntu, выполните следующие действия:
Удалить Apache
Опять же, если вы запустите apt с опцией удаления, он удалит Apache с главного компьютера, но сохранит весь файл конфигурации без изменений.
Если вы думаете об удалении Apache для переустановки, вы можете использовать опцию очистки.
Если вы просто хотите удалить пакет Apache, но сохраните все файлы конфигурации, выполните следующие команды:
Приведенные выше команды удаляют Apache, но файлы конфигурации сайта в каталоге /etc/apache2 остаются без изменений, включая каталог содержимого в /var/www .
Очистить Apache
Параметр очистки с apt удалит Apache и все файлы конфигурации из Ubuntu.
Если вы хотите полностью удалить Apache, включая файлы конфигурации и настройки, используйте опцию очистки.
Файлы в каталоге /etc/apache2 будут удалены. Однако содержимое сайта в /var/www останется в покое.
Выполните приведенные ниже команды, чтобы удалить Apache вместе с его файлами конфигурации.
Переустановка Apache
Когда вы используете опцию переустановки с apt, команда удаляет apache и устанавливает.
Параметр переустановки не изменяет и не удаляет какой-либо файл конфигурации или содержимое сайта в /var/www .
Он просто удалит и переустановит пакеты apache.
Чтобы переустановить apache, выполните следующие команды:
Это должно сработать!
Вывод:
В этом посте показано, как удалить, очистить или переустановить apache. Если вы обнаружите какую-либо ошибку выше, пожалуйста, используйте форму комментария ниже, чтобы сообщить.
Как удалить веб-сервер Apache из Ubuntu
В этом руководстве мы рассмотрим пошаговые инструкции по удалению веб-сервера Apache из Ubuntu Linux . Ubuntu предлагает нам два варианта удаления программного обеспечения: «удалить» или «очистить». Прочтите, чтобы узнать разницу и узнать, как выполнять ту или иную функцию.
В этом уроке вы узнаете:
- Как удалить, очистить или переустановить веб-сервер Apache из Ubuntu

Удаление веб-сервера Apache из Ubuntu
| Категория | Требования, условные обозначения или используемая версия программного обеспечения |
|---|---|
| Система | Ubuntu Linux |
| Программного обеспечения | Apache |
| Другой | Привилегированный доступ к вашей системе Linux с правами root или через судо команда. |
| Условные обозначения | # — требует данных команды linux для выполнения с привилегиями root либо непосредственно как пользователь root, либо с использованием судо команда $ — требует данных команды linux для выполнения от имени обычного непривилегированного пользователя. |
Удалить, очистить или переустановить веб-сервер Apache
Ubuntu APT менеджер пакетов дает нам два разных варианта удаление пакетов из системы: удалить и прочистить.
Удалять удалит Apache из системы, но оставит файлы конфигурации. В частности, это означает, что файлы конфигурации сайта в /etc/apache2 каталог остаются в покое. Если у вас есть намерение переустановить Apache в будущем, вам следует использовать опцию удаления вместо очистки. Конечно, сами файлы сайта, хранящиеся внутри /var/www также не будут удалены в процессе удаления.
Откройте терминал и введите следующую команду, чтобы Удалить Веб-сервер Apache.
Удалять удалит Apache из системы вместе с файлами конфигурации внутри /etc/apache2 . Этот каталог будет полностью удален. Если /var/www не является пустым, то процесс удаления оставляет его нетронутым, поэтому вам не нужно беспокоиться об удалении всего вашего веб-сайта. Если вы не планируете переустанавливать Apache в будущем и не нуждаетесь в ваших файлах конфигурации (или уже сделали их резервную копию), тогда вариант очистки для вас. На всякий случай рекомендуется сделать резервную копию файлов вашего веб-сайта перед очисткой.
Откройте терминал и введите следующую команду, чтобы удалять Веб-сервер Apache.
Переустановить удалит Apache из вашей системы, а затем установит его снова. Он не внесет изменений в ваши файлы конфигурации или /var/www каталог. Вместо этого удаляются и заменяются системные файлы Apache. Ваша установка Apache должна быть изрядно запутанной, чтобы оправдать этот вариант, но он есть на тот случай, если он вам понадобится.
Откройте терминал и введите следующую команду, чтобы переустановить Веб-сервер Apache.
Заключительные мысли
В этом руководстве мы увидели несколько различных вариантов удаления веб-сервера Apache из Ubuntu Linux. Диспетчер пакетов Ubuntu APT упрощает удаление программного обеспечения. Возможность удаления vs purge также защищает пользователей от случайного удаления важных файлов, которые они могут захотеть позже (например, если они решат переустановить Apache).
Имейте в виду, что в вашей системе все еще могут быть установлены другие компоненты веб-хостинга. Например, PHP и MySQL. Это отдельные пакеты, обслуживаемые вне Apache, поэтому вам нужно будет удалить их по отдельности, если вы больше не хотите, чтобы это программное обеспечение было в вашей системе.
Подпишитесь на новостную рассылку Linux Career Newsletter, чтобы получать последние новости, вакансии, советы по карьере и рекомендуемые руководства по настройке.
LinuxConfig ищет технических писателей, специализирующихся на технологиях GNU / Linux и FLOSS. В ваших статьях будут представлены различные руководства по настройке GNU / Linux и технологии FLOSS, используемые в сочетании с операционной системой GNU / Linux.
Ожидается, что при написании статей вы сможете идти в ногу с технологическим прогрессом в вышеупомянутой технической области. Вы будете работать самостоятельно и сможете выпускать как минимум 2 технических статьи в месяц.
- 08/08/2021
- 0
- МонтажUbuntuВеб серверАдминистрация

Отключить / выключить экран блокировки в Ubuntu 22.04 Jammy Jellyfish Linux
- 27/04/2022
- 0
- ГномUbuntuАдминистрацияРабочий стол
Цель этого руководства — показать читателю, как отключить автоматическую блокировку экрана на Убунту 22.04 Рабочий стол Jammy Jellyfish Linux GNOME. Это предотвратит блокировку экрана из-за бездействия, что может раздражать, когда вы необходимо по.

Ubuntu 22.04 Рабочий стол Unity
- 28/04/2022
- 0
- МонтажUbuntuАдминистрацияРабочий стол
Среда рабочего стола Unity была создана Canonical и когда-то использовалась в качестве графического интерфейса по умолчанию для выпусков Ubuntu. Позже Canonical отказалась от него и взяла на себя другие сопровождающие. Сегодня он по-прежнему досту.

Установите инструменты VMware на Ubuntu 22.04 Jammy Jellyfish Linux
- 29/04/2022
- 0
- МонтажUbuntuВиртуализацияАдминистрация
Если вы бежите Убунту 22.04 внутри виртуальной машины VMware установка программного обеспечения VMware Tools поможет вам получить максимальную отдачу от системы. VMware Tools предоставит машине больше возможностей, таких как общий буфер обмена с х.
How to Upgrade Apache on Ubuntu 22.04 or 20.04
If you are currently running Ubuntu LTS, your version of Apache is probably not the latest stable release from the Apache Foundation. This outdated version could result in you missing out on useful new features and enhancements, ultimately impacting your web server’s performance. Furthermore, non-security-related bug fixes may be absent in Ubuntu LTS, leading to instability issues for your web server.
Please enable JavaScript
Fortunately, a straightforward solution exists for most users who do not want to compile Apache independently. You can install the latest Apache version using a third-party repository, such as the one provided by Ondřej Surý, well-known for his work as a PHP maintainer for Debian/Ubuntu.
This guide will provide step-by-step instructions on upgrading Apache on your Ubuntu 22.04 Jammy Jellyfish or Ubuntu 20.04 Focal Fossa desktop or server using Ondřej Surý’s custom third-party repository. By following this guide, you can ensure that your web server has access to the latest Apache version and runs efficiently and stably.
Step 1: Update Ubuntu
To avoid any potential conflicts during the installation process, it is highly recommended that you update your system before beginning. This ensures that all packages on your system are up-to-date and compatible with the installation, ultimately leading to a smoother and more successful upgrade process.
If you are interested or wish to review the updates that will be installed, you have the option to list them. This can be particularly useful for those curious about the updates and who would like to understand the changes being made to their system. However, it is important to note that this step is optional and can be skipped if desired.
To upgrade any outdated packages on your system, you can proceed with the following command. This will ensure that your system has access to the latest software versions, which can result in improved performance and security:
Step 2: Import Apache LaunchPAD PPA
The initial step towards upgrading the Apache webserver to the latest version involves adding Ondřej Surý’s repository. Before proceeding, it is recommended that you run the following command to confirm that the necessary packages are installed. It is worth noting that most users should already have these packages installed on their systems:
If you are new to importing GPG keys from Ubuntu’s KeyServer, you may encounter an issue where the necessary directories are not created in your command line terminal. However, there is a simple solution to this problem with a straightforward command; you can easily generate the required directories, ensuring that launching PPAs on Launchpad runs smoothly. So, there is no need to worry if you encounter this issue – it can be quickly resolved with this command.
Although it is optional, it is recommended that you run the following command to import the required GPG key. You can re-try the command if you encounter any issues during the process. Once the GPG key is successfully imported, you can proceed to the next task.
The next step involves importing the Apache PPA repository, which can be accomplished using the following command. It is worth noting that this command is suitable for all currently supported Ubuntu LTS versions. You can access the latest Apache version, with all the latest features and enhancements, by completing this step.
Step 3: Install or Upgrade Apache
The next step involves updating your repository to reflect the new changes. To do this, run the following command:
Once you have added the PPA, you can install the latest version of Apache or upgrade your existing one. For most users, it is recommended to run the installation command even if Apache is already on the system. This ensures that the latest version is installed and all necessary dependencies are updated. To install the latest Apache version, use the following command:
Finally, confirming which version and source of Apache2 is installed using the apt-cache policy command is important. This will ensure that Apache2 is installed from the PPA. To check this, run the following command:
Example output of apt-cache policy for Apache:

To ensure that Apache is running properly, you can use the systemctl command. This command allows you to check the status of Apache and verify that it is up and running as intended.

If Apache is not currently activated or running, you can use the following command to start the web server application:
To ensure that Apache is enabled on system boot, you can use the following command:
By using Ondřej Surý’s repository, you can be assured that your Apache version will be maintained and updated consistently. This means that whenever a new version of Apache is available, Ondřej Surý will typically update his repository within a few days to a few weeks. This is due to his extensive maintenance work on the PHP, Nginx, and Apache repositories he built, making him highly consistent with updating practices. So, by relying on his repository, you can trust that your Apache version will remain up-to-date and secure, with access to the latest features and enhancements.
Additional Tips
Configure UFW Firewall for Apache
After installing or upgrading Apache, it is important to modify the UFW rules if you have UFW (Uncomplicated Firewall) installed. This ensures that outside access is allowed to the default web ports, which is necessary for your web server to be accessible to visitors. Fortunately, during the installation process, Apache registers itself with UFW to provide several profiles that can be used to enable or disable access, making it quick and easy to configure.
If you do not have UFW installed, you can install it using the following command:
Once UFW is installed, you can enable it to start and be active on system boot using the following command:
To view the available Apache profiles, use the following command:
The output should display the following profiles: Apache, Apache Full, and Apache Secure. Apache runs on port 80 (HTTP), Apache Secure runs on port 443 (HTTPS), and Apache Full allows both. The most commonly used profiles are Apache Full or Apache Secure.
This guide since SSL has not been set up; the guide will enable the (Apache) profile using the following command:
After running this command, the rules will be added for IPV4 and IPV6. It is worth noting that you can disable this profile and enable secure-only or disable the Apache rule and use the Apache Full rule instead at a later time.
By following these steps, you can ensure that outside access is allowed to your web server, making it accessible to visitors while maintaining the security and protection offered by UFW.
Update Apache
To update Apache on Ubuntu Linux, you can use the APT package manager. To begin, run the standard APT update commands with the following command:
If an update for Apache is available, you can upgrade it by running the following command:
Alternatively, you can upgrade Apache on its own by using the following command:
By completing these steps, you can ensure that your Apache version is up-to-date and running smoothly.
Remove Apache Upgrade
If you need to remove the upgraded Apache version and restore the standard Ubuntu version, you can do so by following these steps:
First, stop the Apache service by using the following command:
Next, remove Apache by using the following command:
If you had imported the PPA to upgrade Apache, you could remove it by using the following command:
Finally, to reflect the changes made to the APT sources list entries, run the following command:
At this point, you can re-install the standard Apache version.
Conclusion
In conclusion, updating Apache on Ubuntu is a straightforward process that can be accomplished using the APT package manager and Ondřej Surý’s repository. By upgrading to the latest version of Apache, you can take advantage of new features and improvements, enhance your web server’s performance, and improve its overall stability. Additionally, modifying the UFW rules can ensure that your web server is accessible to visitors while maintaining necessary security and protection.
By following these steps, you can ensure that your web server is up-to-date, secure, and running efficiently, providing visitors and users with a reliable and responsive experience.
Frequently Asked Questions
Q: How can I check which version of Apache I am currently running on Ubuntu?
A: To check which version of Apache is currently installed on your Ubuntu system, you can use the following command: “apache2 -v”. This will display the Apache version and build information.
Q: Can I upgrade Apache on Ubuntu without using Ondřej Surý’s repository?
A: Yes, you can upgrade Apache on Ubuntu without using Ondřej Surý’s repository by using the APT package manager. However, using the repository is recommended to ensure your Apache version is always up-to-date and secure.
Q: Is it necessary to modify the UFW rules after upgrading Apache?
A: Yes, modifying the UFW rules is necessary to allow outside access to the default web ports and make your web server accessible to visitors. This can be accomplished by using the available Apache profiles registered with UFW during installation.
Q: How can I remove the upgraded Apache version and return to the standard Ubuntu version?
A: To remove the upgraded Apache version and return to the standard Ubuntu version, you can use the following steps: stop the Apache service, remove Apache, remove the imported PPA (if used), and run an APT update to reflect the changes. Once these steps are completed, you can re-install the standard Apache version.
Q: Will upgrading Apache on Ubuntu affect my existing web applications?
A: Upgrading Apache on Ubuntu should not affect your existing web applications as long as they are compatible with the latest Apache version. However, it is recommended that you test your web applications after upgrading to ensure they are functioning correctly.
Q: How can I troubleshoot any issues that arise after upgrading Apache on Ubuntu?
A: If you encounter any issues after upgrading Apache on Ubuntu, you can troubleshoot them by reviewing the Apache error logs, which can be found at “/var/log/apache2/error.log”. Try rolling back to the previous Apache version or consult the Apache documentation and community forums for additional support if possible.
Q: Can I upgrade Apache on Ubuntu without stopping the web server?
A: Yes, it is possible to upgrade Apache on Ubuntu without stopping the web server by using the APT package manager. However, it is recommended that you stop the Apache service during the upgrade process to ensure that the upgrade completes successfully and without issues.
Q: Is it recommended to upgrade Apache on a production web server?
A: Yes, it is recommended to upgrade Apache on a production web server to ensure that it remains up-to-date, secure, and running efficiently. However, it is recommended that you test the upgrade process and your web applications on a staging environment before applying the upgrade to your production environment.
Q: What are some benefits of upgrading Apache on Ubuntu?
A: Upgrading Apache on Ubuntu can improve performance, security, and access to the latest features and enhancements. Additionally, upgrading to the latest Apache version ensures that your web server remains up-to-date and compatible with the latest web technologies and standards.