The Apache web server is a widely used open-source solution favored for its reliability and flexibility. It runs effectively on Linux distributions such as openSUSE and SUSE Linux Enterprise Server (SLES), which are prized for their stability and enterprise-friendly features. These platforms are popular for hosting production environments where performance and security are critical.
Installing and configuring Apache on openSUSE or SLES involves using the zypper package manager to fetch and manage necessary dependencies. Correct installation helps maintain a secure and robust web hosting setup that can serve multiple sites and handle high traffic loads. Familiarity with this process ensures effective control over modules, services, and server-specific settings.
Technical knowledge of both Apache and zypper is advantageous for fine-tuning performance, enabling advanced modules, and implementing security measures such as firewall rules. Understanding how to adjust ownership and permissions within the DocumentRoot and related directories further strengthens server integrity. Careful attention to configuration details yields an efficient, scalable environment suitable for various web applications.
Steps to install and configure Apache on openSUSE or SLES:
- Open the terminal.
- Refresh zypper package list.
> sudo zypper refresh [sudo] password for root: Retrieving repository 'Update repository of openSUSE Backports' metadata ...........[done] Building repository 'Update repository of openSUSE Backports' cache ................[done] Retrieving repository 'Non-OSS Repository' metadata ................................[done] Building repository 'Non-OSS Repository' cache .....................................[done] Retrieving repository 'Open H.264 Codec (openSUSE Leap)' metadata ..................[done] Building repository 'Open H.264 Codec (openSUSE Leap)' cache .......................[done] Retrieving repository 'Main Repository' metadata ...................................[done] Building repository 'Main Repository' cache ........................................[done] Retrieving repository 'Update repository with updates from SUSE Linux Enterprise 15'[done] Building repository 'Update repository with updates from SUSE Linux Enterprise 15' c[done] Retrieving repository 'Main Update Repository' metadata ............................[done] Building repository 'Main Update Repository' cache .................................[done] Retrieving repository 'Update Repository (Non-Oss)' metadata .......................[done] Building repository 'Update Repository (Non-Oss)' cache ............................[done] All repositories have been refreshed.
- Install apache2 package using zypper.
> sudo zypper install --no-confirm apache2 Loading repository data... Reading installed packages... Resolving package dependencies... The following recommended package was automatically selected: w3m The following 8 NEW packages are going to be installed: apache2 apache2-prefork apache2-utils libapr1 libapr-util1 libgc1 system-user-wwwrun w3m 8 new packages to install. Overall download size: 2.8 MiB. Already cached: 0 B. After the operation, additional 14.3 MiB will be used.
- Configure Apache options as necessary.
> sudo vi /etc/apache2/httpd.conf
Related: Understanding Apache web server configuration files
Related: Guide listing for Apache - Test the Apache configuration for errors.
> sudo apachectl configtest AH00557: httpd-prefork: apr_sockaddr_info_get() failed for host AH00558: httpd-prefork: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message Syntax OK
- Restart apache2 service once you're done with yur configuration.
> sudo systemctl restart apache2
- Enable apache2 to start automatically on 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/multi-user.target.wants/apache2.service → /usr/lib/systemd/system/apache2.service.
- Open ports 80 (http) and 443 (https) in the firewall if needed.
> sudo firewall-cmd --permanent --add-service=http --add-service=https success
- Reload firewall for rule changes to take effect.
> sudo firewall-cmd --reload success
- Add DirectoryIndex file to DocumentRoot folder.
> sudo vi /srv/www/htdocs/index.html
- Make sure DocumentRoot folder has correct ownership.
> sudo chown --recursive wwwrun:wwwrun /srv/www/
- Verify the web server setup by accessing the website.
> curl 127.0.0.1 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Welcome to Apache on SUSE</title> ##### snipped
There's no default DirectoryIndex file in the DocumentRoot folder. The output here depends on the content of the index.html file that you've created in the previous steps.

Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
Comment anonymously. Login not required.