Setting up Magento 1 on a Linux server is a bit involved, especially since Magento 1 reached its end of life (EOL) in June 2020. Magento 1 installations are no longer officially supported by Adobe, so it’s essential to take additional security precautions and consider migrating to Magento 2 if possible. However, if you still need to set up Magento 1 on a Linux server, here’s a step-by-step guide:
Before you begin, ensure your server meets these minimum requirements:
sudo apt update
sudo apt upgrade
Install Apache:
sudo apt install apache2
Start and Enable Apache:
sudo systemctl start apache2
sudo systemctl enable apache2
Enable Apache Rewrite Module:
sudo a2enmod rewrite
sudo systemctl restart apache2
Install MySQL Server:
sudo apt install mysql-server
sudo systemctl start mysql
Secure the MySQL Installation:
sudo mysql_secure_installation
Create a Database and User for Magento:
mysql -u root -p
In the MySQL shell:
CREATE DATABASE magento1;
CREATE USER 'magento_user'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON magento1.* TO 'magento_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Magento 1 is compatible with PHP 5.6, which is no longer officially supported. So, consider using a repository that still offers PHP 5.6.
Add PHP 5.6 Repository (for Ubuntu):
sudo add-apt-repository ppa:ondrej/php
sudo apt update
Install PHP 5.6 and Required Extensions:
sudo apt install php5.6 php5.6-mysql php5.6-curl php5.6-xml php5.6-mbstring php5.6-intl php5.6-gd php5.6-soap php5.6-zip
Configure PHP Settings:
Edit the PHP configuration file (php.ini) to adjust settings for Magento:
sudo nano /etc/php/5.6/apache2/php.ini
Recommended changes:
memory_limit = 512M
max_execution_time = 18000
zlib.output_compression = On
Restart Apache:
sudo systemctl restart apache2
Download Magento 1:
You may need to get Magento 1 from a third-party repository, as the official download is no longer available.
Move the Files to the Web Root:
Assuming your Magento files are in ~/Downloads/magento1.zip:
unzip ~/Downloads/magento1.zip -d /var/www/html/
Set Permissions:
sudo chown -R www-data:www-data /var/www/html/magento1
sudo find /var/www/html/magento1 -type d -exec chmod 755 {} \;
sudo find /var/www/html/magento1 -type f -exec chmod 644 {} \;
Create a New Virtual Host File:
sudo nano /etc/apache2/sites-available/magento1.conf
Add the following configuration:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/magento1
ServerName yourdomain.com
<Directory /var/www/html/magento1>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Replace yourdomain.com with your actual domain name or server IP.
Enable the Virtual Host and Rewrite Module:
sudo a2ensite magento1.conf
sudo systemctl reload apache2
Access the Magento Web Installer:
Open your browser and go to http://yourdomain.com to start the Magento 1 installation process.
Follow the Setup Wizard:
Finish the Installation: Once you finish the installation wizard, Magento will set up the database and configure your store.
Delete the install.php File:
To prevent reinstallation, delete install.php:
rm /var/www/html/magento1/install.php
Enable SSL (HTTPS):
It’s highly recommended to use HTTPS. Install Certbot to obtain an SSL certificate from Let’s Encrypt:
sudo apt install certbot python3-certbot-apache
sudo certbot --apache -d yourdomain.com
Enable Caching:
Configure caching in Magento to improve performance:
System > Cache Management in the admin panel and enable caching options.Set Up Cron Jobs:
Magento 1 relies on cron jobs for tasks like reindexing, emails, and cache management.
sudo crontab -u www-data -e
Add the following lines:
*/5 * * * * /usr/bin/php /var/www/html/magento1/cron.php > /dev/null 2>&1
http://yourdomain.com/admin and log in with the admin credentials you created.http://yourdomain.com to view your store.Your Magento 1 store is now set up! Since Magento 1 is no longer supported, it’s critical to stay vigilant about security, keeping backups, and considering an eventual upgrade to Magento 2.
Let us know if you have any questions or if you need further assistance with any specific configuration.