SUSE Linux Enterprise Server or SLES is the recommended version of SUSE for server deployment though the installation and related documentation are not as polished as other major Linux distributions.

Apache webserver can be installed on both openSUSE and SLES using zypper from the command line. It requires further configuration before being usable as the installer package does not automatically configure some of the options like other major Linux distributions.

Steps to install and configure Apache on openSuSe or SLES:

  1. Launch terminal application.
  2. Refresh zypper package list.

    > sudo zypper refresh [sudo] password for root: Repository 'Main Repository (NON-OSS)' is up to date.                                                           Repository 'Main Repository (OSS)' is up to date.                                                               Repository 'Main Update Repository' is up to date.                                                              Repository 'openSUSE-20191225-0' is up to date.                                                                 All repositories have been refreshed.

  3. Install apache2 package using zypper.

    > sudo zypper install --no-confirm  apache2 Loading repository data... Reading installed packages... Resolving package dependencies...  The following 6 NEW packages are going to be installed:   apache2 apache2-prefork apache2-utils libgc1 system-user-wwwrun w3m  The following recommended package was automatically selected:   w3m  6 new packages to install. Overall download size: 2.5 MiB. Already cached: 0 B. After the operation, additional 7.7 MiB will be used. Continue? [y/n/v/...? shows all options] (y): y

  4. Configure Apache options as necessary.

    > sudo vi /etc/apache2/httpd.conf

  5. Test configured Apache options for errors.

    > sudo apachectl configtest AH00558: httpd-prefork: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message Syntax OK
  6. Restart apache2 service once you're done with yur configuration.

    > sudo systemctl restart apache2

  7. Configure apache2 service to automatically start during system boot.

    > sudo systemctl enable apache2 Created symlink /etc/systemd/system/httpd.service → /usr/lib/systemd/system/apache2.service. Created symlink /etc/systemd/system/apache.service → /usr/lib/systemd/system/apache2.service. Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/apache2.service.

  8. Enable network access to port 80 (http) and 443 (https) if firewall is enabled.

    > sudo firewall-cmd --permanent --add-service=http --add-service=https success

  9. Reload firewall for rule changes to take effect.

    > sudo firewall-cmd --reload success

  10. Add DirectoryIndex file to DocumentRoot folder.

    > sudo vi /srv/www/htdocs/index.html

  11. Make sure DocumentRoot folder has correct ownership.

    > sudo chown --recursive wwwrun:wwwrun /srv/www/

  12. Access the website using browser or command line tools to test if your Apache web server is up and running.

    > curl <h1>Your Apache service is up and running</h1> Congratulation.