introduction
in previous article > we have discussed how to install APache2 on SLES with test page
but this is NOT enough
in next 2 articles > we will extend our knowledge about how to install fully web site on SLES using [Wordpress ] the hero of Content management system CMS
this topic is divided into two categories :
- Part1 : prepare LAMP : which stand for [ Linux , Apache ,MySQL ,PHP ]
- Part 2 : install and Configure wordpress [as local site ]
Concepts
as we are doing in Networks Pioneers : it’s worthy to get familiar with some concepts before diving inside configuration
Content management System CMS
As per Wikipedia definition: A content management system (CMS) is a software application that can be used to create and modify digital content. [text and embed graphics, photos, video, audio, maps and program code that display content and interact with the user]
There is hundreds of CMS in the internet [some are free and some need license ]
List of CMS please click here
Microsoft has robust CMS solution which is SharePoint server , it will be fully discussed in separate course from A-Z
Today we will talk about the most famous CMS used in the internet: WordPress
WordPress
(WordPress.org) is a free and open-source content management system (CMS) written in PHP and integrated with any Database engine like a MySQL , MS SQL …etc.
maintained by Apache Software Foundation, Apache is an open source software available for free. It runs on 67% of all web servers in the world. It is fast, reliable, and secure
MySQL
MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation.
The MySQL website (http://www.mysql.com/) provides the latest information about MySQL software
some IT Manager prefer to use MariaDB
PHP
PHP is a server side scripting language. that is used to develop Static websites or Dynamic websites or Web applications.
PHP stands for Hypertext Pre-processor, that earlier stood for Personal Home Pages.
PHP scripts can only be interpreted on a server that has PHP installed.
The client computers accessing the PHP scripts require a web browser only.
LAMP
Linux , Apache , MySQL ,PHP
LAMP is an open source Web development platform that uses Linux as the operating system, Apache as the Web server, MySQL as the relational database management system and PHP as the object-oriented scripting language.
(Sometimes Perl or Python is used instead of PHP.)
LAMP Network Diagram
before Diving into configure LAMP
let us to have a look to above network diagram
SLES124 will be configured as :
- apache HTTP server
- MySQL as Database Server
- PHP scripting Lang server
- WordPress as CMS Content Management System
since SLES124 in DMZ [servers farm] : we we have to consider network firewall [which is PFsense in our case ]
Step 01 : install and start Apache
install apache2
To start off we will install Apache. Open up the Terminal or connect to SLES124 using SSH [Secure Shell ] with port 22
zypper install apache2
Start Apache service
Start the Apache by using the following command.
systemctl start apache2.service
To make the apache to start during the every boot, type the following on terminal and hit enter.
systemctl enable apache2.service
start and enable firewall
start and enable SLES firewall if it’s NOT started
systemctl start firewalld
then enable firewall when SLES rearted
systemctl enable firewalld
Firewall Rule
create firewall rule to enable apache services
firewall-cmd --permanent --add-service=apache2
then reload firewall
firewall-cmd --reload
Testing Apache:
To make sure everything installed correctly we will now test Apache to ensure it is working properly.
Open up any web browser and then enter the following into the web address:
http://SLES124 / or http://172.15.100.124
You will get the web page saying “Access forbidden!”> this confirms that the Apache is working fine.
Apache’s default document root is /srv/www/htdocs/ on SLES ,
the configuration file is /etc/apache2/httpd.conf.
Additional configurations are stored in the /etc/apache2/conf.d/ directory.
Step 02 : Install ind Configure MySQL
Next is to install and configure MySQL on SLES124 ,
MYSQL is a MariaDB package.
Install mariaDB
zypper install mariadb
Start MySQL server.
systemctl start mysql.service
To make the MySQL to start during the every boot, Type the following
systemctl enable mysql.service
firewall rule
create firewall rule to open mariadb
firewall-cmd --permanent --add-service=mysql
firewall-cmd --reload
secure mariadb
Nex is to make the MariaDB secure by using command thne follow wizard
mysql_secure_installation .
This program enables you to improve the security of your MariaDB installation in the following ways:
- You can set a password for root
- You can remove root accounts that are accessible from outside the local host.
- You can remove anonymous-user accounts.
- You can remove the test database (which by default can be accessed by all users, even anonymous users), and privileges that permit anyone to access databases with names that start with test_.
mysql_secure_installation
below image for all commands above
Step 03 : install and configure PHP
Install PHP:
By default Apache server supports the HTML language only; not PHP,
So …. we need to install PHP.
To install : use the following command .
zypper install php7 php7-mysql apache2-mod_php7
a2enmod php5
Restart service
You need to restart the server after the installation of the PHP, to do that type the following on the terminal.
systemctl restart apache2.service
Testing PHP:
To test PHP: create a PHP file on to the default directory of the Apache.
The document root of the default web site is /srv/www/htdocs/.
We will now create a small PHP file (index.php) in that directory and call it in a browser.
The file will display lots of useful details about our PHP installation, such as the installed PHP version.
- use the following command
vim /srv/www/htdocs/index.php
This will open up a file called index.php.
- inserte this line into the phpinfo file:
phpinfo(); ?>
- Save and close the file. use Esc + :wq for saving the file.
- Now open you’re web browser and type the following into the web address:
http://sles124/index.php
or
http://172.16.100.124/index.php
below images for all steps above
Conclusion
in this part : we have successfully installed and configured
LAMP [Linux Apache MySQL PHP ]
in next article part 2 : we will install and configure WordPress site on SLES124
thank you for joining us