Your data center has most likely reached the point where Linux is a necessity, whether it’s for internal systems, external services, or any number of possibilities.
One platform you might be considering is openSUSE. Not only is the operating system a solid solution for many of your data center needs, it’s as flexible as any variation of Linux. Along with testing out openSUSE, you get the added bonus of becoming familiar with SUSE, should you eventually migrate to a more enterprise-ready platform.
If you want to add a LAMP server to your openSUSE installation, you’re in luck–the process is not that difficult. Let’s walk through setting up a LAMP server on the openSUSE Leap platform. It will take you about 20 minutes to have this incredibly powerful web server up and running.
What you’ll need
- A running openSUSE installation: You need to make sure everything is up to date before starting the installation process.
- An admin account: You’ll use sudo to aid in the installation.
Unlike some other platforms, you cannot install the LAMP server with a single command. To that end, we’ll install LAMP one piece at a time. First up…Apache.
Open a terminal window and issue the command sudo zypper in apache2, which will install the Apache server. Once installed, we want to ensure the service starts and starts upon every reboot. Do this with the following two commands:
- sudo systemctl start apache2
- sudo systemctl enable apache2
Out of the box, Apache will be accessible from the local machine. If you want to allow other machines to access the web server, you’ll need to do the following:
- Open the file /etc/sysconfig/SuSEfirewall2 with your favorite text editor.
- Add the line FW_CONFIGURATIONS_EXT=”apache2″
- Save and close the file.
- Restart the firewall with the command sudo systemctl restart SuSEfirewall2
Let’s test our installation. We’ll create a test html file called /srv/www/htdocs/index.html with the contents:
<h1>Welcome to Apache2 on openSUSE</h1>
Save that file and then point your browser to http://IP_ADDRESS_OF_SERVER (IP_ADDRESS_OF_SERVER is the actual IP address of the openSUSE server). You should see the message “Welcome to Apache2 on openSUSE” in your browser.
Install the database
We’re going with MariaDB. To install that, do the following:
- Open your terminal window.
- Issue the command sudo zypper in mariadb.
- Once installed, start the database with the command sudo systemctl start mysql.
- Set the database to run at boot with the command sudo systemctl enable mysql.
- Set the root database password with the command sudo mysqladmin -u root password PASSWORD (where PASSWORD is the actual password you want to use).
Your database is ready.
It’s time to install the final piece to the puzzle…PHP. To do this, issue the following commands:
- sudo zypper in php5 php5-mysql apache2-mod_php5
- sudo a2enmod php5
Let’s test the PHP installation. Create the file /srv/www/htdocs/testphp.php, with the content:
Restart Apache with the command sudo systemctl restart apache2 and then point your browser to http://IP_OF_SERVER/testphp.php and you should see a listing of information about your PHP installation.
That’s it…you’re ready to use your openSUSE web server.
Make something of it
Although installing the LAMP server on openSUSE isn’t quite as easy as it is on Ubuntu and its derivatives, it’s not that much of a challenge. Now that you have the openSUSE LAMP server up and running, it’s time for you to make something of it.