cloud cloud cloud

Setup Apache on Fedora 18


Setup Apache on Fedora 18

Setting up the Apache Webserver is a common task. The latest Fedora introduces a new firewall service - firewalld - which may be unfamiliar to some. To set up Apache with firewalld instead of system-config-firewall just follow the steps below.

  1. Install Apache via the repositories: yum install httpd.

  2. Start it and set it to start on boot.

    # systemctl start httpd
    # systemctl enable httpd
  1. Open port 80 in the firewall.

    This is where things are a little different from system-config-firewall. First run:

    # firewall-cmd --add-service=http

    Now you can access the Web server. However we’re not done yet.
    Something that may catch you unawares is that this only works until the server is next restarted. To set this option to be persistent between reboots you need to use the --permanent option. But note that with this option changes are not effective immediately, only after service restart or reboot so both commands are needed.1

    # firewall-cmd --permanent --add-service=http

When I first encountered firewalld I was dubious as to its merits. I quickly discovered it to be a nice system and feel it’s an improvement overall.

There is more information on the Fedora Wiki or the man pages. Some basic commands that you’ll need to use firewalld are here:

  • To get a list of available services: firewall-cmd --get-services
  • To open an arbitrary port: firewall-cmd --add-port=<port#>/<protocol>

Also, if you are unsure of a command use the --timeout option so the change only lasts for a given time (enough to test if it works) before making if permanent.

  1. This is similar to systemd start and enable