| | 3 | For this tutorial we are assuming you already made a clean minimum |
|---|
| | 4 | installation of a RHEL 9.x OS (i.e. Red Hat Enterprise, Fedora, CentOS |
|---|
| | 5 | Stream, Alma Linux, or Rocky Linux). |
|---|
| | 6 | |
|---|
| | 7 | # How to setup the server |
|---|
| | 8 | |
|---|
| | 9 | # Update all OS components |
|---|
| | 10 | |
|---|
| | 11 | dnf update |
|---|
| | 12 | |
|---|
| | 13 | # Install stuff we need |
|---|
| | 14 | |
|---|
| | 15 | dnf -y install nano unzip |
|---|
| | 16 | |
|---|
| | 17 | # Install locales (Example: glibc-langpack-{language_code}) |
|---|
| | 18 | |
|---|
| | 19 | dnf -y install glibc-langpack-en |
|---|
| | 20 | |
|---|
| | 21 | # Install repository for extra packages like php-imagick |
|---|
| | 22 | |
|---|
| | 23 | dnf -y install epel-release |
|---|
| | 24 | |
|---|
| | 25 | # Install server daemons and extensions |
|---|
| | 26 | |
|---|
| | 27 | dnf -y install httpd mod_ssl mariadb-server php php-bcmath php-intl |
|---|
| | 28 | php-apcu php-gd php-json php-mysqlnd php-simplexml php-zip |
|---|
| | 29 | |
|---|
| | 30 | # Change PHP distribution to version 8.1 |
|---|
| | 31 | |
|---|
| | 32 | dnf module switch-to php:8.1 |
|---|
| | 33 | |
|---|
| | 34 | # Start our new services |
|---|
| | 35 | |
|---|
| | 36 | systemctl enable php-fpm systemctl start php-fpm |
|---|
| | 37 | |
|---|
| | 38 | systemctl enable httpd systemctl start httpd |
|---|
| | 39 | |
|---|
| | 40 | systemctl enable mariadb systemctl start mariadb |
|---|
| | 41 | |
|---|
| | 42 | # Run the guide for securing MariaDB/MySQL |
|---|
| | 43 | |
|---|
| | 44 | mysql_secure_installation |
|---|
| | 45 | |
|---|
| | 46 | # Alternatively run a handsfree command for securing MariaDB/MySQL |
|---|
| | 47 | (edit it first) |
|---|
| | 48 | |
|---|
| | 49 | mysql -uroot -e "ALTER USER 'root'@'localhost' IDENTIFIED BY |
|---|
| | 50 | '{desired_root_password_here}'; \ GRANT ALL PRIVILEGES ON *.* TO |
|---|
| | 51 | 'root'@'localhost' WITH GRANT OPTION; \ DROP USER IF EXISTS |
|---|
| | 52 | ''@'localhost'; \ DROP DATABASE IF EXISTS test; \ FLUSH |
|---|
| | 53 | PRIVILEGES;" |
|---|
| | 54 | |
|---|
| | 55 | # Allow outgoing traffic for the web server (SELinux) |
|---|
| | 56 | |
|---|
| | 57 | setsebool -P httpd_can_network_connect 1 setsebool -P httpd_unified 1 |
|---|
| | 58 | |
|---|
| | 59 | # Allow incoming connections to the webserver through the firewall |
|---|
| | 60 | |
|---|
| | 61 | firewall-cmd --permanent --add-service=http firewall-cmd --permanent |
|---|
| | 62 | --add-service=https firewall-cmd --permanent --list-all firewall-cmd |
|---|
| | 63 | --reload |
|---|
| | 64 | |
|---|
| | 65 | # Create a MySQL user, database, and grant privileges |
|---|
| | 66 | |
|---|
| | 67 | read -p "New database name: " newdb_name read -p "New database user: |
|---|
| | 68 | " newdb_user read -sp "Password for database user '$newdb_user': " |
|---|
| | 69 | newdb_password |
|---|
| | 70 | |
|---|
| | 71 | mysql -u root -p -e "CREATE DATABASE $newdb_name; \ CREATE USER |
|---|
| | 72 | '$newdb_user'@'localhost' IDENTIFIED BY '$newdb_password'; \ |
|---|
| | 73 | GRANT ALL PRIVILEGES ON $newdb_name.* TO |
|---|
| | 74 | '$newdb_user'@'localhost' WITH GRANT OPTION; \ FLUSH PRIVILEGES;" |
|---|
| | 75 | |
|---|
| | 76 | ## Install LiteCart |
|---|
| | 77 | |
|---|
| | 78 | Go to the document root for your site, remove default index page, |
|---|
| | 79 | download the LiteCart web installer and setting the correct permissions: |
|---|
| | 80 | |
|---|
| | 81 | # Go to the document root for your site |
|---|
| | 82 | |
|---|
| | 83 | cd /var/www/html |
|---|
| | 84 | |
|---|
| | 85 | # Download the LiteCart web installer |
|---|
| | 86 | |
|---|
| | 87 | curl --output index.php |
|---|
| | 88 | |
|---|
| | 89 | |
|---|
| | 90 | # Change owner of the files to apache |
|---|
| | 91 | |
|---|
| | 92 | chown -R apache:apache ./ |
|---|
| | 93 | |
|---|
| | 94 | 1. |
|---|
| | 95 | 2. Open your browser and visit your website to begin installing |
|---|
| | 96 | LiteCart. # |
|---|
| | 97 | 3. # |
|---|
| | 98 | 1. |
|---|
| | 99 | |
|---|
| | 100 | # When the LiteCart web installation is completed, do some cleanup: |
|---|
| | 101 | |
|---|
| | 102 | rm -Rf install/ |
|---|