installeer je het LiteCart e-commerce platform op Ubuntu 20.04 LTS
LiteCart is een open-source en lichtgewicht e-commerce platform, geschreven in PHP, HTML 5, en CSS 3. Het is eenvoudig, gemakkelijk te gebruiken, en heeft een elegant en eenvoudig admin paneel. LiteCart is sneller dan 99% van alle websites ter wereld. Het komt met een rijke set functies waaronder, Innovatief, Hoge prestaties, Plug en play add-ons, SEO vriendelijk, One step checkout, Meerdere charset ondersteuning en nog veel meer.
In deze handleiding laten we je zien hoe je het LiteCart shopping cart platform installeert op Ubuntu 20.04.
Vereisten
- Een server waarop Ubuntu 20.04 draait.
- Een geldige domeinnaam die met je server is verbonden.
- Een root wachtwoord is op je server ingesteld.
Aan de slag
Alvorens te beginnen is het aan te raden je systeem te updaten met de laatste stabiele versie. Je kunt het bijwerken met het volgende commando:
apt-get update -y
apt-get upgrade -y
Zodra je systeem up-to-date is, herstart je het om de veranderingen toe te passen:
Installeer LAMP Server
Eerst moet je de Apache webserver, MariaDB server, PHP en andere vereiste PHP bibliotheken in je systeem installeren. Je kunt ze allemaal installeren met het volgende commando:
apt-get install apache2 mariadb-server php7.4 libapache2-mod-php7.4 php7.4-common php7.4-mbstring php7.4-xmlrpc php7.4-soap php7.4-gd php7.4-xml php7.4-intl php7.4-mysql php7.4-cli php7.4-zip php7.4-curl php7.4-soap unzip -y
Als alle pakketten geïnstalleerd zijn, bewerk je het php.ini bestand en pas je enkele gewenste instellingen aan:
nano /etc/php/7.4/apache2/php.ini
Verander de volgende regels:
memory_limit = 256M upload_max_filesize = 150M max_execution_time = 360 date.timezone = Asia/Kolkata
Sla het bestand op en sluit het als je klaar bent. Herstart dan de Apache dienst om de veranderingen toe te passen:
systemctl restart apache2
Configureer de MariaDB Database
Eerst moet je de MariaDB beveiligen en het MariaDB root wachtwoord instellen. Je kunt dat doen met het volgende commando:
mysql_secure_installation
Beantwoord alle vragen zoals hieronder aangegeven:
Enter current password for root (enter for none): Set root password? [Y/n]: N Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Als je klaar bent, log dan in op de MariaDB shell met het volgende commando:
mysql -u root -p
Geef je root wachtwoord als daarom wordt gevraagd en maak dan een database en gebruiker voor LiteCart met het volgende commando:
MariaDB [(none)]> CREATE DATABASE litecartdb;
MariaDB [(none)]> CREATE USER 'litecart'@'localhost' IDENTIFIED BY 'password';
Verleen vervolgens alle rechten aan de litecartdb met het volgende commando:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON litecartdb.* TO 'litecart'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Spoel vervolgens de privileges door en verlaat de MariaDB shell met het volgende commando:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
Als je database geconfigureerd is, kun je verder gaan met de volgende stap.
LiteCart downloaden
Op het moment van schrijven van deze handleiding is de nieuwste versie van LiteCart 2.2.3. Je kunt hem downloaden van zijn officiële website. Na het downloaden pak je het gedownloade bestand uit in de Apache web root directory met het volgende commando:
mkdir /var/www/html/litecart
unzip litecart-2.2.3.1.zip -d /var/www/html/litecart
Verander vervolgens het eigendom van de litecart directory in www-data en geef de juiste rechten met het volgende commando:
chown -R www-data:www-data /var/www/html/litecart/
chmod -R 755 /var/www/html/litecart/
Als je klaar bent, kun je verder gaan met de volgende stap.
Configureer Apache voor LiteCart
Maak eerst een nieuw Apache virtuele host configuratiebestand aan met het volgende commando:
nano /etc/apache2/sites-available/litecart.conf
Voeg de volgende regels toe:
<VirtualHost *:80> ServerAdmin [email protected] ServerName litecart.linuxbuz.com DocumentRoot /var/www/html/litecart/public_html/ <Directory /var/www/html/litecart/> AllowOverride All allow from all </Directory> ErrorLog /var/log/apache2/litecart_error.log CustomLog /var/log/apache2/litecart_access.log combined </VirtualHost>
Sla het bestand op en sluit het als je klaar bent. Schakel dan de LiteCart site, herschrijf en headers module in met het volgende commando:
a2ensite litecart.conf
a2enmod rewrite
a2enmod headers
Herstart tenslotte de Apache dienst om de veranderingen toe te passen:
systemctl restart apache2
Op dit punt is je Apache webserver geconfigureerd om LiteCart te serveren.
Beveilig LiteCart met Let’s Encrypt SSL
Het wordt aanbevolen om de LiteCart website te beveiligen met Let’s Encrypt gratis SSL. Om dit te doen installeer je de Certbot Let’s Encrypt Client met het volgende commando:
apt-get install certbot python3-certbot-apache -y
Zodra de Certbot geïnstalleerd is, voer je het volgende commando uit om de Let’s Encrypt SSL voor je domein te installeren:
certbot --apache -d litecart.linuxbuz.com
Je moet je e-mail adres opgeven en de servicevoorwaarden accepteren zoals hieronder:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator apache, Installer apache Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Obtaining a new certificate Performing the following challenges: http-01 challenge for litecart.linuxbuz.com Waiting for verification... Cleaning up challenges Created an SSL vhost at /etc/apache2/sites-available/litecart-le-ssl.conf Enabled Apache socache_shmcb module Enabled Apache ssl module Deploying Certificate to VirtualHost /etc/apache2/sites-available/litecart-le-ssl.conf Enabling available site: /etc/apache2/sites-available/litecart-le-ssl.conf
Vervolgens moet je kiezen of je HTTP verkeer wilt omleiden naar HTTPS of niet, zoals hieronder:
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Kies optie 2 en druk op Enter om de installatie te voltooien zoals hieronder:
Redirecting vhost in /etc/apache2/sites-enabled/litecart.conf to ssl vhost in /etc/apache2/sites-available/litecart-le-ssl.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://litecart.linuxbuz.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=litecart.linuxbuz.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/litecart.linuxbuz.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/litecart.linuxbuz.com/privkey.pem Your cert will expire on 2020-09-12. To obtain a new or tweaked version of this certificate in the future, simply run certbot again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Op dit punt is je LiteCart website beveiligd met Let’s Encrypt SSL. Je kunt nu verder gaan met de volgende stap.
Toegang tot LiteCart
Open nu je web browser en typ de URL https://litecart.linuxbuz.com. Je wordt doorverwezen naar de volgende pagina:
Geef je installatie pad op, database gegevens, winkel gegevens, admin gebruikersnaam, wachtwoord en klik op de Nu Installeren knop. Als de installatie met succes voltooid is, zou je de volgende pagina moeten zien:
Verwijder vervolgens de installatiemap met het volgende commando:
rm -rf /var/www/html/litecart/public_html/install/
Klik op de knop beheergebied. Je wordt doorverwezen naar de LiteCart login pagina zoals hieronder getoond:
Geef je beheerders gebruikersnaam en wachtwoord op en klik op de Inloggen knop. Je zou het LiteCart dashboard op de volgende pagina moeten zien:
Conclusie
In de bovenstaande gids heb je geleerd hoe je het LiteCart winkelkarretje op Ubuntu 20.04 kunt installeren en beveiligen. Je leerde ook hoe je het kunt beveiligen met Let’s Encrypt gratis SSL. Ik hoop dat je nu je eigen winkelwagentjestoepassing met LiteCart kunt hosten.