Litecart商城安装

安装litecart商城,并添加加密货币支付功能。 主机:甲骨文amd,系统ubuntu22.04

一、系统初步配置

sudo -i
apt update
apt upgrade
apt -y install language-pack-es language-pack-fr language-pack-de language-pack-zh-hans

二、安装所需的组件,php,mysql等。

apt -y install curl nano unzip apache2 libapache2-mod-php mariadb-server php php-common php-cli php-fpm php-apcu php-curl php-dom php-gd php-imagick php-mysql php-simplexml php-mbstring php-intl php-zip php-xml

2.1开启相关环境

a2enmod rewrite headers proxy_fcgi setenvif
mysql_secure_installation

2.2配置数据库

mysql -u root - p <<END
ALTER USER 'root'@'localhost' IDENTIFIED BY '{desired_root_password_here}';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
DROP USER IF EXISTS ''@'localhost';
DROP DATABASE IF EXISTS test;
FLUSH PRIVILEGES;
END

配置数据库时注意,一定要设置好root密码,不同版本的mysql的设置方式也不同

2.3配置php

sed -ri 's/;?memory_limit\s*=\s*[^\s]*/memory_limit = 256M/' /etc/php/8.1/apache2/php.ini
sed -ri 's/;?upload_max_filesize\s*=\s*[^\s]*/upload_max_filesize = 64M/' /etc/php/8.1/apache2/php.ini
sed -ri 's/;?date\.timezone\s*=\s*[^\s]*/date.timezone = Europe\/Stockholm/g' /etc/php/8.1/apache2/php.ini

/php/8.1/的路径需要根据安装的不同php版本进行更改。

2.4添加litecart DB 到Mysql

read -p "New database name: " newdb_name
read -p "New database user: " newdb_user
read -sp "Password for database user '$newdb_user': " newdb_password

mysql -u root -p -e "CREATE DATABASE $newdb_name; \
CREATE USER '$newdb_user'@'localhost' IDENTIFIED BY '$newdb_password'; \
GRANT ALL PRIVILEGES ON $newdb_name.* TO '$newdb_user'@'localhost' WITH GRANT OPTION; \
FLUSH PRIVILEGES;"

三、配置apache

nano /etc/apache2/sites-enabled/000-default.conf

输入以下代码

 <VirtualHost *:80>
    ServerName youdomain.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/html/>
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
  </VirtualHost>

使更改生效

systemctl restart apache2

四、安装LITECART

cd /var/www/html
rm index.html
chown -R www-data:www-data ./

现在打开你Apache中配置的网站地址,进行下一步安装即可! 安装完成后,删除install文件,避免不必要的错误。

rm -Rf install/

五、配置SSL

5.1安装snapd 包管理工具

apt install -y snapd
snap install core
snap refresh core

5.2安装certbot

snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot

5.3使用以下命令安装一个证书:

certbot --apache -d yourdomain.com

Enjoy!