Skip to content

Instantly share code, notes, and snippets.

@viseth89
Last active May 24, 2019 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save viseth89/da827991657c32e8e0dd0618a8e04b7b to your computer and use it in GitHub Desktop.
Save viseth89/da827991657c32e8e0dd0618a8e04b7b to your computer and use it in GitHub Desktop.
Centos 7 Lamp
# Complete Commands Toward Bottom with References
# TODOS
# 1. Add salt to config for Security
# 2. Enable firewall
# 3. Create User? / Disable Root User *
# 4. Enhance Apache Configs
# 5. Automate MYSQL Creation ??
# 6. Find and replace DB information in wp-config.php file
# 7. Establish Default/Generated Passwords for DB
# 8. Add Cron Jobs
# 9. SSL *
# Update Server
yum update -y
# Install Apache
yum install httpd -y
# Start Apache
systemctl start httpd.service
# Enable Apache on Boot
systemctl enable httpd.service
# Install mariadb (community version of MySQL [supposedly has improvements over regular MySQL])
yum install mariadb-server mariadb -y
# Secure mariadb
mysql_secure_installation
# Start mariadb
systemctl start mariadb
# Start mariadb on boot
systemctl enable mariadb.service
# PHP 7
yum install epel-release yum-utils -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
sudo yum-config-manager --enable remi-php73 && sudo yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd -y -y -y
** LAMP - Compiled
yum update -y && yum install httpd -y && systemctl start httpd.service && systemctl enable httpd.service && yum install mariadb-server mariadb -y && systemctl start mariadb && systemctl enable mariadb.service && mysql_secure_installation && yum install epel-release yum-utils -y && yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y &&
sudo yum-config-manager --enable remi-php73 && sudo yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd -y -y -y
Wordpress
# Create DB
mysql -u root -p
# DB Commands
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit;
# Installing PHP Modules for Wordpress
sudo yum install php-gd
# Restarting Apache Module
sudo service httpd restart
# Downloading -> Unzipping -> Moving Wordpress
cd ~
wget http://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
sudo rsync -avP ~/wordpress/ /var/www/html/
# Making Upload Director, Changing Ownership, Config File Settings
mkdir /var/www/html/wp-content/uploads
sudo chown -R apache:apache /var/www/html/*
cd /var/www/html
cp wp-config-sample.php wp-config.php
nano wp-config.php
** Wordpress - Compiled
yum install wget nano && mysql -u root -p && yum install php-gd service httpd restart && cd ~ && wget http://wordpress.org/latest.tar.gz && tar xzvf latest.tar.gz && sudo rsync -avP ~/wordpress/ /var/www/html/ && mkdir /var/www/html/wp-content/uploads && sudo chown -R apache:apache /var/www/html/* && cd /var/www/html && cp wp-config-sample.php wp-config.php && nano wp-config.php && service httpd restart
--------------------------------------------------
** Completion
# Copy and Paste and fill in DB Creation Steps and Make Changes to wp-config.php
yum update -y && yum install httpd -y && systemctl start httpd.service && systemctl enable httpd.service && yum install mariadb-server mariadb -y && systemctl start mariadb && systemctl enable mariadb.service && mysql_secure_installation && yum install epel-release yum-utils -y && yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y &&
sudo yum-config-manager --enable remi-php73 && sudo yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd -y -y -y && yum install wget nano -y && mysql -u root -p && yum install php-gd service httpd restart && cd ~ && wget http://wordpress.org/latest.tar.gz && tar xzvf latest.tar.gz && sudo rsync -avP ~/wordpress/ /var/www/html/ && mkdir /var/www/html/wp-content/uploads && sudo chown -R apache:apache /var/www/html/* && cd /var/www/html && cp wp-config-sample.php wp-config.php && nano wp-config.php && service httpd restart
Tested Working - 11:16AM ; May/24
---------------------------------------------------
References
#1 https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-centos-7
#2 https://blog.itanddevelopment.com/wordpress-centos7-selinux-vhost/ (firewall + enable on system start)
#3 https://www.tecmint.com/install-php-7-in-centos-7/ (php7 > php5 install)
#3a https://www.linuxtechi.com/install-php-7-centos-7-rhel-7-server/ (php7 >php5)
#3b https://linuxize.com/post/install-php-7-on-centos-7/ (php7 > php5)
#4 https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-centos-7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment