Skip to content
Search

Apache:Httpd:HowToInstall

lastmod 2018-08-17created 2015-04-228 edits

Notes on how to install Apache.

Ubuntu

First, install it as follows.

$ apt-get install apache2

Cent OS 7

The installation steps below are based on Cent OS 7.

First, install it as follows.

$ yum -y install httpd

If you need SSL, install it as follows.

$ yum -y install mod_ssl

To change the SSL port number, edit the /etc/httpd/conf.d/ssl.conf file as follows.

Listen 8888 https
## ...
<VirtualHost _default_:8888>
## ...

Also, register the changed port with SELinux, and open it in the firewall using firewalld1.

## SELinux setting:
$ semanage port -a -t http_port_t -p tcp 8888

## firewalld setting:
$ firewall-cmd --permanent --zone=public --add-port=8022/tcp
$ firewall-cmd --reload

Beyond that, check the SELinux information of the DocumentRoot directory2 with ls -Z, verify the permissions and user, and then restart Apache.

$ apachectl restart

You cannot use chkconfig to register it as a service.3 You must use systemctl.

$ systemctl enable httpd

LAMP

Linux + Apache httpd + MySQL MariaDB + PHP + (optionally OpenSSL)

$ yum install -y httpd
$ yum install -y mariadb-server
$ yum -y install php
$ yum -y install mod_ssl

See also

References


  1. Before Cent OS 6, iptables ↩

  2. /var/www/html ↩

  3. httpd is not registered ↩