Unable to install apache2 on an Ubuntu server with cPanel installed.
I've been trying to set up my server on a new machine running Ubuntu 22.04 that has cPanel version 130.0.7 installed on it. I've tried to run a2enmod, but I would get the error `sudo: a2enmod: command not found`. So in order to fix that, I've tried to install apache with `sudo apt-get install apache2` but I get the following error:
N: Ignoring file 'imunify360-testing.list.example' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
(Reading database ... 222589 files and directories currently installed.)
Preparing to unpack .../apache2-data_2.4.52-1ubuntu4.16_all.deb ...
Unpacking apache2-data (2.4.52-1ubuntu4.16) ...
dpkg: error processing archive /var/cache/apt/archives/apache2-data_2.4.52-1ubuntu4.16_all.deb (--unpack):
trying to overwrite '/usr/share/apache2/error/HTTP_BAD_GATEWAY.html.var', which is also in package ea-apache24 2.4.65-4+5.1.cpanel
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../apache2-utils_2.4.52-1ubuntu4.16_amd64.deb ...
Unpacking apache2-utils (2.4.52-1ubuntu4.16) ...
dpkg: error processing archive /var/cache/apt/archives/apache2-utils_2.4.52-1ubuntu4.16_amd64.deb (--unpack):
trying to overwrite '/usr/bin/ab', which is also in package ea-apache24-tools 2.4.65-4+5.1.cpanel
Preparing to unpack .../apache2_2.4.52-1ubuntu4.16_amd64.deb ...
Unpacking apache2 (2.4.52-1ubuntu4.16) ...
dpkg: error processing archive /var/cache/apt/archives/apache2_2.4.52-1ubuntu4.16_amd64.deb (--unpack):
trying to overwrite '/usr/sbin/apachectl', which is also in package ea-apache24 2.4.65-4+5.1.cpanel
Errors were encountered while processing:
/var/cache/apt/archives/apache2-data_2.4.52-1ubuntu4.16_all.deb
/var/cache/apt/archives/apache2-utils_2.4.52-1ubuntu4.16_amd64.deb
/var/cache/apt/archives/apache2_2.4.52-1ubuntu4.16_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Based on this, it looks like the problem is that these files were installed by the cPanel installation script, but I don't know to resolve this issue without possibly breaking cPanel.
-
Hey there! If you installed cPanel on the server you should *not* need to do anything else to install Apache - we preinstall Apache, PHP, MySQL, and many other pieces of software as part of the cPanel installation. If this did work, this would likely break the installation.
I'd encourage you to check your WHM interface and look at the EasyApache 4 page to see what all is already installed on your system: https://docs.cpanel.net/ea4/
0 -
The commands I need to run are
sudo a2enmod proxy proxy_http ssl headers
sudo a2ensite quiz.conf
Under the EasyApache4 menu in WHM, it shows mod-mpm-prefork, mod-bwlimited, mod-cgi, mod-deflate, mod-expires, mod-headers, mod-prox, mod-proxy-fcgi, mod-proxy-http, mod-proxy-wstunnel, mod-remoteip, mod-ruid, mod-security2, mod-ssl, and mod-unique-id as installed. From what I understand, a2enmod is doing the same as what enabling those in the EasyApache4 menu would, so while I still can't run a2enmod, everything it would enable is already enabled.
However, I'm still unable to run a2ensite, and I'm not sure what the equivalent functionality for that command would be in WHM.
0 -
You need to stop thinking of your Apache on your Ubuntu server as "Apache installed on Ubuntu as a standalone service".
The whole Apache install / control / management, on a cPanel server, regardless of whether it is running on Ubuntu or RHEL / CL / Almalinux etc is all handled within WHM.
What you are doing is creating site confs manually. In WHM, when you create a new hosting account, which is tied to a domain name, the appropriate information is added to httpd.conf for that new site to work. You don't have to manually make up quiz.conf and enable it. You need to add a hosting account. Or you can use just one hosting account and host multiple domains under it.
If you were to add a hosting account in WHM called quizno25 tied to the domain quizknowz.com, you'd have a user account added with:
/home/quizno25 as the home directory
/home/quizno25/public_html as the web root (where you put your website)
And it would set up DNS (on the server) for quizknowz.com. And it would set up Apache automatically to serve up the content under /home/quizno25/public_html when Apache sees the host header referencing quizknowz.com.
You seem to be doing everything manually, treating Apache as a standalone application to be managed manually. And that is not the intent on a WHM/cPanel platform.
0
Please sign in to leave a comment.
Comments
3 comments