Installing MODX on Alpine Linux Latest
Prerequisites
Before you begin, you will need:
- A server running Alpine Linux Latest
- Root access or sudo privileges
- Basic command line knowledge
Step 1: Update your server
Ensure your server is up to date by running the following command:
sudo apk update && sudo apk upgrade
Step 2: Install LAMP stack
MODX requires a LAMP stack to run. Let's install it now.
sudo apk add apache2 mysql mysql-client php8 php8-apache2 php8-mysqli php8-json
Step 3: Configure Apache
Edit the Apache config file.
sudo nano /etc/apache2/httpd.conf
Find the following section:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
Replace it with:
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
Save and close the file.
Step 4: Download MODX
Head over to https://modx.com/download/ and download the latest version of MODX.
Unzip it:
unzip modx-<version>.zip -d /var/www/localhost/htdocs/
Step 5: Create a MySQL database
Log in to MySQL:
mysql -u root -p
Create a new database and user:
CREATE DATABASE modx;
CREATE USER 'modxuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON modx.* TO 'modxuser'@'localhost';
FLUSH PRIVILEGES;
Replace password with a strong password.
Step 6: Install MODX
Open your web browser and navigate to http://your-server-ip-address/setup/.
Follow the on-screen instructions to complete the installation process.
During the installation, you will be prompted to enter your database details.
- Database name:
modx - Database username:
modxuser - Database password:
<your-password> - Database host:
localhost
Once the installation is complete, remove the setup directory:
sudo rm -rf /var/www/localhost/htdocs/setup/
Step 7: Enable URL rewriting
Edit the Apache config file again:
sudo nano /etc/apache2/httpd.conf
Find the following line:
#LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
Uncomment it, save the file and exit.
Restart Apache:
sudo service apache2 restart
Step 8: Test MODX
Open your web browser and navigate to http://your-server-ip-address/.
You should see the MODX homepage.
Congratulations, you have successfully installed MODX on Alpine Linux Latest!