Installing Apache, PHP, and MySQL on Oracle Linux 8

WBOY
Release: 2024-08-09 00:08:12
Original
839 people have browsed it

Installing Apache, PHP, and MySQL on Oracle Linux 8

Bismillah...

Instructions to Install Apache, PHP, and MySQL on Oracle Linux 8

  1. Install Apache Web Server
sudo yum install -y httpd
Copy after login
  • Installs the Apache HTTP server.
  1. Enable and Start Apache
sudo systemctl enable httpd sudo systemctl restart httpd
Copy after login
  • Enables Apache to start on boot and restarts it to apply changes.
  1. Configure Firewall
sudo firewall-cmd --add-service=http --permanent sudo firewall-cmd --reload
Copy after login
  • Opens HTTP (port 80) on the firewall and reloads the firewall to apply the rule.
  1. Install PHP
dnf module list php sudo dnf module reset php sudo dnf install @php:7.4 sudo dnf install php-mysqli
Copy after login
  • Lists available PHP modules, resets the PHP module, and installs PHP 7.4 with MySQL support.
  1. Allow Apache to Connect to External Databases (optional)
setsebool -P httpd_can_network_connect_db 1
Copy after login
  • Configures SELinux to allow Apache to connect to databases over the network.
  1. Set Permissions for Apache
chown -R apache:apache * # if you have folder to store uploaded file (optional) sudo chcon -R -t httpd_sys_rw_content_t docsuploaded find /var/www/html -type d -exec chmod 755 {} \; find /var/www/html -type f -exec chmod 644 {} \; systemctl restart httpd
Copy after login
  • Changes ownership of files to Apache, sets security context for directories, adjusts file permissions, and restarts Apache.
  1. Install MySQL Server
yum install https://dev.mysql.com/get/mysql84-community-release-el8-1.noarch.rpm yum-config-manager --disable mysql-8.4-lts-community yum-config-manager --disable mysql-tools-8.4-lts-community yum-config-manager --enable mysql80-community yum-config-manager --enable mysql-tools-community yum repolist enabled | grep mysql sudo yum module disable mysql yum install mysql-community-server
Copy after login
  • Installs MySQL Community Edition, disables unnecessary repositories, and installs the MySQL server.
  1. Start MySQL and Check Status
systemctl start mysqld systemctl status mysqld
Copy after login
  • Starts the MySQL server and checks its status.
  1. Retrieve MySQL Temporary Root Password
sudo grep 'temporary password' /var/log/mysqld.log
Copy after login
  • Fetches the temporary root password for MySQL from the log file.

Buy Me A Coffee

The above is the detailed content of Installing Apache, PHP, and MySQL on Oracle Linux 8. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!