How to
install a LAMP stack on Oracle-Linux
The CentOS disaster, you might be scrambling to discern out
what you will use as a base for a web server going forward. Fortunately, you've
got lots of options, together with the quickly-to-be launched AlmaLinux and
Rocky Linux. Or, you may opt for a similar distribution that is been around for
some time and gives yet any other drop-in substitute for CentOS. That
distribution is Oracle Linux.
Oracle now not handiest gives an organisation-great server
distribution, in addition they offer guide contracts. Although you can use
their Linux variant free of charge, the guide contracts do come with a price,
but we're not right here to talk approximately assist. We're right here to talk
LAMP.
·
Linux
·
Apache
·
MySQL
·
PHP
I'm going to stroll you thru the process of installing a
LAMP stack on Oracle Linux--it is now not almost as difficult as you would
possibly think. In truth, if you can set up this stack on CentOS, you could do
it on Oracle.
SEE: MSP great practices: Server deployment tick list
(TechRepublic Premium)
What you may need
In order to get this done, you'll want a running instance of
Oracle Linux and a consumer with sudo privileges. If you've got now not set up
Oracle Linux, there may be no need to strain because it's simply as clean a
mission as installing CentOS.
How to install Apache
The first aspect we are going to do is deploy the Apache
internet server. Unlike Ubuntu where you may install the whole LAMP stack with
a single command, that is finished one piece at a time. The first piece is
Apache.
To deploy the Apache web server, log in to your Oracle Linux
server and trouble the command:
sudo dnf install httpd -y
When that installation completes, begin and enable the web
server with the instructions:
sudo systemctl begin httpd
sudo systemctl enable httpd
You'll also want to allow the internet server thru the
firewall with the commands:
sudo firewall-cmd --permanent --upload-carrier=http,https
sudo firewall-cmd --reload
Before you continue on, make certain you can view the Apache
check page via pointing a browser to http://SERVER (wherein SERVER is either
the IP address or area of the web hosting server).
How to install MariaDB
Next, we're going to deploy the MariaDB database server.
This is finished with the command:
sudo dnf set up mariadb mariadb-server -y
After the database is mounted, start and allow it with the
commands:
sudo systemctl start mariadb
sudo systemctl empower mariadb
We now essential to create a MariaDB admin consumer
password. For that, trouble the command:
sudo mysql_secure_installation
When requested for the modern root password, hit Enter to
your keyboard (Figure A).
Figure A
You'll then be requested if you want to set a root user
password. Type "y" and then (when induced) type and verify a new
password for the MariaDB admin consumer. Answer "y" to the closing
questions and you are geared up to move on.
How to install PHP
Next we'll deploy PHP, in conjunction with a few different
bits to make it work in conjunction with the net and database servers. This is
carried out with the command:
sudo dnf installation Hypertext Preprocessor personal home
page-fpm php-mysqlnd php-opcache Hypertext Preprocessor-gd Hypertext
Preprocessor-xml Hypertext Preprocessor-mbstring -y
Since we're the use of the PHP fast procedure manager
(PHP-FPM), we need to start and enable it with the commands:
sudo systemctl start personal home page-fpm
sudo systemctl enable Hypertext Preprocessor-fpm
How to check to make sure PHP is operating
Let's test to make certain PHP is running on the system.
Create a PHP info file with the command:
sudo nano /var/www/html/info.Hypertext Preprocessor
In that report, paste the following contents:
<?Php
phpinfo();
?>
Save and close the document. Restart the Apache server with
the command:
sudo systemctl restart httpd
Open an internet browser and point it to
http://SERVER/data.Hypertext Preprocessor (where SERVER is the IP cope with or
area of the website hosting server). You need to see the PHP statistics page,
detailing what PHP modules are enabled (Figure B).