How to install LAMP on Solus-3 OS

To install LAMP on Solus 3 OS

LAMP is an archetypal model of web service stacks, named as an acronym of the names of its original four open-source components: the Linux operating system, the Apache HTTP Server, the MySQL relational database management system (RDBMS), and the PHP programming language. The LAMP components are largely interchangeable and not limited to the original selection. As a solution stack, the LAMP is suitable for building dynamic websites and web applications.

Installing LAMP

First, make sure you update your system by making use of the following command.

root@linuxhelp1 ~ # eopkg update-repo
Updating repository: Solus
eopkg-index.xml.xz.sha1sum     (40.0  B)100%    905.19 KB/s [00:00:00] [complete]
Solus repository information is up-to-date.

You need to install Apache, the web- browser by making use of the following command.

root@linuxhelp1 ~ # eopkg install httpd
Following packages will be installed:
apr  apr-util  httpd  postgresql
Total size of package(s): 9.00 MB
There are extra packages due to dependencies. Do you want to continue? (yes/no)y
.
.
Installed httpd
 [✓] Syncing filesystems                                                success
 [✓] Updating dynamic library cache                                     success
 [✓] Updating system users                                              success
 [✓] Updating systemd tmpfiles                                          success
 [✓] Reloading systemd configuration                                    success
 [✓] Updating mimetype database                                         success
 [✓] Updating manpages database                                         success

Once it is installed, you need to change the default directory of httpd as follows.

root@linuxhelp1 ~ # cd /usr/share/defaults/httpd/

And then, you need to create a directory by making use of the following command.

root@linuxhelp1 /etc # mkdir -p httpd/conf.d/

Once it is done, you need to restart the httpd service as follows.

root@linuxhelp1 /etc # systemctl restart httpd

And then you need to create a html file by making use of the following command.

root@linuxhelp1 /etc # vim /var/www/index.html
And in that file, you need to add the following lines. 
[..]
Welcome to Htppd
[..]

Once it is done, you should restart the httpd service

root@linuxhelp1 /etc # systemctl restart httpd


Once it is done, you need to open your browser.

And type the local IP address in the URL field.

Now, get the html page.

Now, you need to install and configure MariaDB, so run the following command

root@linuxhelp1 /etc # eopkg install mariadb-server
Following packages will be installed:
jemalloc  mariadb  mariadb-server
Total size of package(s): 19.56 MB
There are extra packages due to dependencies. Do you want to continue? (yes/no)y
.
.
Installed mariadb-server
 [✓] Syncing filesystems                                                success
 [✓] Updating dynamic library cache                                     success
 [✓] Updating system users                                              success
 [✓] Updating systemd tmpfiles                                          success
 [✓] Reloading systemd configuration                                    success
 [✓] Updating manpages database                                         success

Once it is done, you need to start and enable MariaDB service by making use of the following commands.

root@linuxhelp1 /etc # systemctl start mariadb.service
root@linuxhelp1 /etc # systemctl enable mariadb.service

And then, you need check status of MariaDB by running the following command.

root@linuxhelp1 /etc # systemctl status mariadb.service
● mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service  enabled  vendor preset: enabled)
   Active: active (running) since Fri 2018-02-23 05:30:27 IST  30s ago
 Main PID: 2292 (mysqld)
   Status: " Taking your SQL requests now..." 
    Tasks: 26 (limit: 7372)
   CGroup: /system.slice/mariadb.service
           └─2292 /usr/sbin/mysqld
Confguration of mysql installation

root@linuxhelp1 /etc # mysql_secure_installation
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!
.
.
Remove anonymous users? [Y/n] y
 ... Success!
.
.
Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...
All done!  If you' ve completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

You shall now login into MySQL as a root user and make the following configuration.

root@linuxhelp1 /etc # mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with   or g.
Your MariaDB connection id is 10
Server version: 10.1.29-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type ' help '  or ' h'  for help. Type ' c'  to clear the current input statement.
MariaDB [(none)]>  Ctrl-C -- exit!
Aborted

Now, you need to install PHP by making use of the following command.

root@linuxhelp1 /etc # eopkg install php -y
Following packages will be installed:
imap  libmcrypt  libzip  php  tidy-html5
Total size of package(s): 11.48 MB
.
.
Installed php
 [✓] Syncing filesystems                                                success
 [✓] Updating dynamic library cache                                     success
 [✓] Updating system users                                              success
 [✓] Updating systemd tmpfiles                                          success
 [✓] Reloading systemd configuration                                    success
 [✓] Updating manpages database                                         success

Once it is installed, you need to start the PHP FPM service in the following manner.

root@linuxhelp1 /etc # systemctl start php-fpm


And then, create PHP configuration file as follows.

root@linuxhelp1 /etc # vim /etc/httpd/conf.d/php.conf
And add the following to configure the file. 
[..]
LoadModule proxy_module lib64/httpd/mod_proxy.so
LoadModule proxy_fcgi_module lib64/httpd/mod_proxy_fcgi.so
< FilesMatch .php$> 
SetHandler " proxy:fcgi://127.0.0.1:9000" 
< /FilesMatch> 
< IfModule dir_module> 
DirectoryIndex index.php index.html
< /IfModule> 
[..]

Once it is done, you need to enable the PHP-FPM service.

root@linuxhelp1 /etc # systemctl enable php-fpm


And then, you need to check the status of your PHP service.

root@linuxhelp1 /etc # systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service  enabled  vendor preset: enabled)
   Active: active (running) since Fri 2018-02-23 05:33:51 IST  2min 16s ago
 Main PID: 2889 (php-fpm)
   Status: " Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec" 
    Tasks: 3 (limit: 7372)
   CGroup: /system.slice/php-fpm.service
           ├─2889 php-fpm: master process (/etc/php/php-fpm.conf)
           ├─2890 php-fpm: pool www
           └─2891 php-fpm: pool www

Now, you should create a PHP file, so run the following command.

root@linuxhelp1 /etc # vim /var/www/index.php
And add the following in it. 
[..]
Welcome to PHP
[..]

You should now restart the Apache service and PHP-FPM.

root@linuxhelp1 /etc # systemctl restart httpd
root@linuxhelp1 /etc # systemctl restart php-fpm


Now, open the browser.


Type local IP address with index.php

Go to the PHP page.

With this, the installation of LAMP on Solus 3 comes to an end.

Tag : LAMP Solus
Comment
Laurynas
Jun 09 2019
I was encountering httpd errors until I removed unnecessary spaces from php.conf
Add a comment
FAQ
Q
How do you register the variables into a session in LAMP stack?
A
To register variables in a session, you need to use the session_register() function

Ex: session_register($login_id)
Q
What is the difference between the functions unlink and unset?
A
The Unlink() function deletes the file whereas Unset() makes a set variable as undefined.
Q
How to install LAMP stack on Manjaro?
A
For the installation of the LAMP stack on Manjaro, use the following link as given below "https://www.linuxhelp.com/how-to-install-lamp-stack-on-manjaro-17-0-5/"
Q
How to install Lamp stack on Arch distro?
A
For the installation of the LAMP stack on Arch, use the following link as given below, https://www.linuxhelp.com/how-to-install-lamp-stack-on-archlinux/
Q
How to install and configure LAMP stack on OpenSUSE leap?
A
For the installation of the LAMP stack on OpenSUSE leap, use the following link as given below, https://www.linuxhelp.com/how-to-install-and-configure-lamp-in-open-suse-leap/