尝试在Ubuntu 20.04上安装Apache2时出错

oxcyiej7  于 2023-10-17  发布在  Apache
关注(0)|答案(1)|浏览(189)

我尝试安装Apache 2,但遇到以下错误。如果我在安装cpanel/whm之前安装Apache 2,它就可以工作。但是在安装capanel/whm之后,apache 2无法安装。
请帮帮我,非常感谢!

  1. root@my-server-ip:~# sudo apt-get install apache2
  2. Reading package lists... Done
  3. Building dependency tree
  4. Reading state information... Done
  5. The following additional packages will be installed:
  6. apache2-data apache2-utils
  7. Suggested packages:
  8. apache2-doc apache2-suexec-pristine | apache2-suexec-custom
  9. The following NEW packages will be installed:
  10. apache2 apache2-data apache2-utils
  11. 0 upgraded, 3 newly installed, 0 to remove and 11 not upgraded.
  12. Need to get 0 B/338 kB of archives.
  13. After this operation, 1,821 kB of additional disk space will be used.
  14. Do you want to continue? [Y/n] y
  15. (Reading database ... 173660 files and directories currently installed.)
  16. Preparing to unpack .../apache2-data_2.4.41-4ubuntu3.14_all.deb ...
  17. Unpacking apache2-data (2.4.41-4ubuntu3.14) ...
  18. dpkg: error processing archive /var/cache/apt/archives/apache2-data_2.4.41-4ubuntu3.14_all.deb (--unpack):
  19. trying to overwrite '/usr/share/apache2/error/HTTP_BAD_GATEWAY.html.var', which is also in package ea-apache24 2.4.57-3+4.1.cpanel
  20. dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
  21. Preparing to unpack .../apache2-utils_2.4.41-4ubuntu3.14_amd64.deb ...
  22. Unpacking apache2-utils (2.4.41-4ubuntu3.14) ...
  23. dpkg: error processing archive /var/cache/apt/archives/apache2-utils_2.4.41-4ubuntu3.14_amd64.deb (--unpack):
  24. trying to overwrite '/usr/bin/ab', which is also in package ea-apache24-tools 2.4.57-3+4.1.cpanel
  25. dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
  26. Preparing to unpack .../apache2_2.4.41-4ubuntu3.14_amd64.deb ...
  27. Unpacking apache2 (2.4.41-4ubuntu3.14) ...
  28. dpkg: error processing archive /var/cache/apt/archives/apache2_2.4.41-4ubuntu3.14_amd64.deb (--unpack):
  29. trying to overwrite '/usr/sbin/apachectl', which is also in package ea-apache24 2.4.57-3+4.1.cpanel
  30. Errors were encountered while processing:
  31. /var/cache/apt/archives/apache2-data_2.4.41-4ubuntu3.14_all.deb
  32. /var/cache/apt/archives/apache2-utils_2.4.41-4ubuntu3.14_amd64.deb
  33. /var/cache/apt/archives/apache2_2.4.41-4ubuntu3.14_amd64.deb
  34. E: Sub-process /usr/bin/dpkg returned an error code (1)
e7arh2l6

e7arh2l61#

你可以试试

  1. sudo apt-get clean
  2. sudo apt-get update
  3. sudo apt install apache2
  4. sudo apt-get -f install
  1. or you could install through source
  1. Download and get utilities:
  2. # apt install build-essential libssl-dev libexpat-dev libpcre3-dev libapr1-dev libaprutil1-dev
  3. Download the Apache source code under the /usr/local/src/ directory. Unzip the archive file and get inside the directory.
  4. Change the directory to src
  5. # cd /usr/local/src/
  6. Use wget to download the Apache source code package
  7. # wget https://dlcdn.apache.org//httpd/httpd-2.4.57.tar.bz2
  8. Unzip the downloaded package. Package will be unzipped into a directory
  9. # tar -xf httpd-2.4.57.tar.bz2
  10. Change the directory
  11. # cd httpd-2.4.57
  12. Build the installation package from the source using the configuration command as shone here.
  13. Create a new directory for the installation. We cant install Apache in the same directory we have the source.
  14. # mkdir /usr/local/apache2.4.57
  15. Use configure command to build the installation package. Specify the installation directory with prefix parameter.
  16. # ./configure –prefix=/usr/local/apache2.4.57 –enable-shared=max
  17. You can install the package upon the successful build. You should see the summary of the build after the successful completion.
  18. Run this make and make install commands to install the Apache server on Ubuntu.
  19. # make && make install
  20. You can start, stop, restart the Apache server with apachectl command from its bin directory.
  21. # /usr/local/apache2.4.57/bin/apachectl start
  22. # /usr/local/apache2.4.57/bin/apachectl stop
  23. # /usr/local/apache2.4.57/bin/apachectl restart
  24. Run this command to check the status of the Apache service.
  25. # ps -ef | grep apache2
展开查看全部

相关问题