Note_Tech

All technological notes.


Project maintained by simonangel-fong Hosted on GitHub Pages — Theme by mattgraham

Project - Wordpress-Mysql-Appache2-Redhat

Back


Install packages

sudo yum upgrade -y

sudo yum install -y httpd

sudo systemctl enable httpd
sudo systemctl start httpd
sudo systemctl status httpd

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
sudo yum install -y php php-mysqlnd php-pdo php-gd php-mbstring
sudo systemctl restart httpd
sudo yum install -y mariadb-server mariadb

sudo systemctl enable mariadb
sudo systemctl start mariadb
sudo systemctl status mariadb
mysql_secure_installation
mysql -e "SHOW DATABASES;" -p

sudo mysql -u root -p
CREATE DATABASE wordpress_db;
GRANT ALL ON wordpress_db.* TO 'wordpress_user'@'localhost' IDENTIFIED BY 'wordpress123';
FLUSH PRIVILEGES;
exit;
cd ~
wget https://wordpress.org/latest.tar.gz
tar -xvf latest.tar.gz
cp wordpress/wp-config-sample.php wordpress/wp-config.php

vi wordpress/wp-config.php
sudo cp -R wordpress /var/www/html/
sudo chown -R apache:apache /var/www/html/wordpress
sudo chcon -t httpd_sys_rw_content_t /var/www/html/wordpress -R
sudo chmod -Rf 775  /var/www/html
sudo vi /etc/httpd/conf.d/wordpress.conf
<VirtualHost *:80>
    ServerAdmin rheladmin@localhost
    DocumentRoot /var/www/html/wordpress

    <Directory "/var/www/html/wordpress">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>

    ErrorLog /var/log/httpd/wordpress_error.log
    CustomLog /var/log/httpd/wordpress_access.log common
</VirtualHost>
sudo systemctl restart httpd
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/wordpress(/.*)?"
sudo restorecon -Rv /var/www/html/wordpress
sudo systemctl enable httpd
sudo systemctl enable mariadb