LAMP Stack

From DikapediaV2
Jump to: navigation, search

How to install a LAMP stack:



For Red Hat Enterprise Linux version 8: RHEL8 includes PHP 7.2 so the standard PHP is fine and Software Collections isn't needed:

dnf install httpd php php-mysqlnd php-gd php-xml mariadb-server mariadb php-mbstring php-json

Ubuntu 16.04.2 LTS (Xenial) and Debian Stretch include PHP 7.0, and renamed many packages from "php5" to plain "php". In addition, some PHP modules are now in separate packages (xml, mbstring):

apt-get install apache2 mysql-server php php-mysql libapache2-mod-php php-xml php-mbstring


For instructions on installing php7.2 on RHEL 7, please refer to my PHP page.


How to install a LAMP stack



(old notes)


1. Install your choice of Linux (RHEL, Centos, Ubuntu, etc.) 2. Follow this guide to install Apache, MariaDB (Skip the PHP installation): http://www.servermom.org/install-lamp-centos-7/1741/

  • This guide will direct you to install PHP but you will install PHP version 5. You will run into trouble when trying to download phpMyAdmin with these instructions. Proceed to step 3 in order to install PHP successfully.

3. Install PHP: https://unityconstruct.org/uc/node/766
4. (Optional) You should now be able to install phpMyAdmin:

yum install phpmyadmin -y
apt-get install -y phpmyadmin

5. Configure phpMyAdmin and restart apache in steps 12, 13, and 14: http://www.servermom.org/install-lamp-centos-7/1741/



Install LAMP stack on Amazon Linux 2


Link: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html



(For local/home machine) Apache is unable to start due to new IP address:



If Apache is unable to start, and you have gotten a new IP address, you need to add the new IP address into the Apache config file:

vim /etc/httpd/conf/httpd.conf

Then change the “Listen” to Listen on ‘[LOCAL_IP_ADDR]:80’

Listen 192.168.0.17:80

Then change the ‘ServerName’ with the new IP address.

ServerName 192.168.0.17:80

Test by opening your browser and entering in URL the local IP address. If you get ‘Testing 123..’ This page is used to test the proper operation of the Apache HTTP server.


Test if Apache and PHP are running and able to process any *.php files:



To do this you first create a php info page using this command:

echo “<?php phpinfo(); ?>” > /var/www/html/info.php

Then restart Apache:

systemctl restart httpd

Then open your browser and enter the following; This will pull up the php info page:

loc.al.IP.Add/info.php

If you cannot reach your blog loc.al.IP.Add/info.php, then you must update the ‘wp-options’ with the new IP address for the 'home' & 'siteurl'. You can do this by logging into phpmyadmin or mysql, and/or hard coding it into the wp-config.php file.
In phpMyAdmin, it will show a login page, enter credentials and then go to the DB with ‘wp-options’ and update IP.



A Cloud Guru's WordPress Bootstrapping Script (user-data)



Run:

#!/bin/bash
yum update -y
yum install httpd php php-mysql -yumcd /var/www/html
echo "heatlhy" > healthy.html
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
cp -r wordpress/* /var/www/html/
rm -rf wordpressr -rf latest.tar.gz
chmod -R 755 wp-content
chown -R apache:apache wp-content
chkconfig httpd on 

# Not necessary parts
wget https://s3.amazonaws.com/bucketforwordpresslab-donotdelete/htaccess.txt
mv httaccess.txt .htaccess


If you get a new IP and you cannot reach your Wordpress site or the admin page


If you have recently gotten a new IP address and cannot reach your blog/site [localhost/ip_addr]/wordpress or [localhost/ip_addr]/wordpress/wp-admin, then you must update the ‘wp-options’ with the new IP address for the home & siteurl. Do this by opening your browser and going to: [local_IP_add or public DNS IP aws]/phpmyadmin


It will show a login page, enter credentials (ardika, ************) and then go to the DB with ‘wp-options’ and update IP.

You can also do this through MariaDB: https://mariadb.com/resources/blog/how-to-install-and-run-wordpress-with-mariadb/

Good mysql command line to modify wp-options: https://isabelcastillo.com/fix-local-ip-address-changed-cant-log-into-wordpress-in-ubuntu-lamp


Installing Software On Your LAMP Stack:


[+] WordPress
[+] MediaWiki