웹사이트 검색

Ubuntu 20.04 LTS에 LiteCart 전자상거래 플랫폼을 설치하는 방법


이 튜토리얼은 다음 OS 버전에 대해 존재합니다.

  • Ubuntu 20.04(Focal Fossa)
  • Ubuntu 18.04(Bionic Beaver)

이 페이지에서

  1. 전제 조건
  2. 시작하기\n
  3. LAMP 서버 설치
  4. MariaDB 데이터베이스 구성
  5. LiteCart 다운로드
  6. LiteCart용 Apache 구성
  7. Lets Encrypt SSL로 LiteCart 보호\n
  8. LiteCart 액세스
  9. 결론

LiteCart는 PHP, HTML 5 및 CSS 3으로 작성된 오픈 소스 경량 전자 상거래 플랫폼입니다. 간단하고 사용하기 쉬우며 우아하고 단순한 관리자 패널이 있습니다. LiteCart는 전 세계 모든 웹사이트의 99%보다 빠릅니다. 혁신적, 고성능, 플러그 앤 플레이 애드온, SEO 친화적, 원스텝 체크아웃, 다중 문자 세트 지원 등을 포함한 풍부한 기능 세트가 함께 제공됩니다.

이 튜토리얼에서는 Ubuntu 20.04에 LiteCart 장바구니 플랫폼을 설치하는 방법을 보여줍니다.

전제 조건

  • Ubuntu 20.04를 실행하는 서버.\n
  • 서버를 가리키는 유효한 도메인 이름입니다.\n
  • 서버에 루트 암호가 구성되어 있습니다.\n

시작하기

시작하기 전에 시스템을 최신 안정 버전으로 업데이트하는 것이 좋습니다. 다음 명령으로 업데이트할 수 있습니다.

apt-get update -y
apt-get upgrade -y

시스템이 최신 상태이면 시스템을 다시 시작하여 변경 사항을 적용하십시오.

램프 서버 설치

먼저 시스템에 Apache 웹 서버, MariaDB 서버, PHP 및 기타 필요한 PHP 라이브러리를 설치해야 합니다. 다음 명령으로 모두 설치할 수 있습니다.

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

모든 패키지가 설치되면 php.ini 파일을 편집하고 원하는 설정을 조정합니다.

nano /etc/php/7.4/apache2/php.ini

다음 줄을 변경합니다.

memory_limit = 256M
upload_max_filesize = 150M
max_execution_time = 360
date.timezone = Asia/Kolkata

완료되면 파일을 저장하고 닫습니다. 그런 다음 Apache 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart apache2

MariaDB 데이터베이스 구성

먼저 MariaDB를 보호하고 MariaDB 루트 암호를 설정해야 합니다. 다음 명령으로 수행할 수 있습니다.

mysql_secure_installation

아래와 같이 모든 질문에 답하십시오.

   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

완료되면 다음 명령을 사용하여 MariaDB 셸에 로그인합니다.

mysql -u root -p

프롬프트가 표시되면 루트 암호를 제공한 후 다음 명령을 사용하여 LiteCart용 데이터베이스 및 사용자를 생성합니다.

MariaDB [(none)]> CREATE DATABASE litecartdb;
MariaDB [(none)]> CREATE USER 'litecart'@'localhost' IDENTIFIED BY 'password';

그런 다음 다음 명령을 사용하여 litecartdb에 모든 권한을 부여합니다.

MariaDB [(none)]> GRANT ALL PRIVILEGES ON litecartdb.* TO 'litecart'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

그런 다음 권한을 플러시하고 다음 명령을 사용하여 MariaDB 셸을 종료합니다.

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

데이터베이스가 구성되면 다음 단계를 진행할 수 있습니다.

LiteCart 다운로드

이 튜토리얼을 작성할 당시 LiteCart의 최신 버전은 2.2.3입니다. 공식 웹 사이트에서 다운로드 할 수 있습니다. 다운로드 후 다음 명령을 사용하여 다운로드한 파일을 Apache 웹 루트 디렉터리에 추출합니다.

mkdir /var/www/html/litecart
unzip litecart-2.2.3.1.zip -d /var/www/html/litecart

그런 다음 litecart 디렉토리의 소유권을 www-data로 변경하고 다음 명령을 사용하여 적절한 권한을 부여하십시오.

chown -R www-data:www-data /var/www/html/litecart/
chmod -R 755 /var/www/html/litecart/

완료되면 다음 단계로 진행할 수 있습니다.

LiteCart용 Apache 구성

먼저 다음 명령을 사용하여 새 Apache 가상 호스트 구성 파일을 만듭니다.

nano /etc/apache2/sites-available/litecart.conf

다음 줄을 추가합니다.

<VirtualHost *:80>
     ServerAdmin 
     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>

완료되면 파일을 저장하고 닫습니다. 그런 다음 LiteCart 사이트를 활성화하고 다음 명령을 사용하여 헤더 모듈을 다시 작성합니다.

a2ensite litecart.conf
a2enmod rewrite
a2enmod headers

마지막으로 Apache 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart apache2

이 시점에서 Apache 웹 서버는 LiteCart를 제공하도록 구성됩니다.

Lets Encrypt SSL로 LiteCart 보호

Lets Encrypt 무료 SSL로 LiteCart 웹사이트를 보호하는 것이 좋습니다. 이렇게 하려면 다음 명령을 사용하여 Certbot Lets Encrypt Client를 설치합니다.

apt-get install certbot python3-certbot-apache -y

Certbot이 설치되면 다음 명령을 실행하여 도메인에 Lets Encrypt SSL을 설치합니다.

certbot --apache -d litecart.linuxbuz.com

이메일 주소를 제공하고 아래와 같이 서비스 약관에 동의해야 합니다.

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): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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

다음으로 아래와 같이 HTTP 트래픽을 HTTPS로 리디렉션할지 여부를 선택해야 합니다.

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

옵션 2를 선택하고 Enter 키를 눌러 아래와 같이 설치를 완료합니다.

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

이 시점에서 귀하의 LiteCart 웹사이트는 Lets Encrypt SSL로 보호됩니다. 이제 다음 단계를 진행할 수 있습니다.

LiteCart에 액세스

이제 웹 브라우저를 열고 URL https://litecart.linuxbuz.com을 입력하십시오. 다음 페이지로 리디렉션됩니다.

설치 경로, 데이터베이스 세부 정보, 스토어 정보, 관리자 사용자 이름, 암호를 제공하고 지금 설치 버튼을 클릭합니다. 설치가 성공적으로 완료되면 다음 페이지가 표시됩니다.

그런 다음 다음 명령을 사용하여 설치 디렉터리를 제거합니다.

rm -rf /var/www/html/litecart/public_html/install/

관리 영역 버튼을 클릭합니다. 아래와 같이 LiteCart 로그인 페이지로 리디렉션됩니다.

관리자 사용자 이름, 암호를 제공하고 로그인 버튼을 클릭합니다. 다음 페이지에서 LiteCart 대시보드를 볼 수 있습니다.

결론

위 가이드에서는 Ubuntu 20.04에서 LiteCart 장바구니를 설치하고 보호하는 방법을 배웠습니다. Lets Encrypt 무료 SSL로 보안을 유지하는 방법도 배웠습니다. 이제 LiteCart로 자신만의 쇼핑 카트 애플리케이션을 호스팅할 수 있기를 바랍니다.