Akeneo PIM 系统安装部署笔记

上一次通过docker部署的不知道为什么挂了
今日尝试使用虚拟机部署一次
我们先解决ELASTICSEARCH的安装问题,因为这个比较麻烦,如果这个没办法启动后面的都可以不用做了

ELASTICSEARCH 8.4

  1. 检查JAVA是否安装

    1
    $ java -version 
  2. 安装Elasticsearch

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    $ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg

    添加 Elastic APT 存储库
    $ echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list

    再次更新包列表:
    $ sudo apt-get update

    安装包,因为我需要安装指定的包,所以我写了8.4.3
    $ sudo apt install elasticsearch=8.4.3

    修改 xpack.security.enabled 为 false
    $ sudo vim /etc/elasticsearch/elasticsearch.yml

    启动
    $sudo systemctl start elasticsearch

    等待几秒钟,让 Elasticsearch 启动,然后通过发送 HTTP 请求来验证它是否正常工作

    将 Elasticsearch 配置为开机启动
    $ sudo systemctl enable elasticsearch

mysql8

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

1.下载包
$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb


2.解压包
$ sudo dpkg -i mysql-apt-config_0.8.24-1_all.deb
$ sudo apt update

3. 安装包,记得要使用旧版身份验证方法
$ sudo apt install mysql-server
$ sudo apt update

4.配置一下mysql
$ mysql -u root -p
mysql> CREATE DATABASE akeneo_pim;
mysql> CREATE USER akeneo_pim@localhost IDENTIFIED WITH mysql_native_password BY 'akeneo_pim';
mysql> GRANT ALL PRIVILEGES ON akeneo_pim.* TO akeneo_pim@localhost;
mysql> EXIT

PHP 8.1

1
2
3
4
5
6
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt update

$ sudo apt-get install php8.1-cli php8.1-apcu php8.1-bcmath php8.1-curl php8.1-opcache php8.1-fpm php8.1-gd php8.1-intl php8.1-mysql php8.1-xml php8.1-zip php8.1-mbstring php8.1-imagick

COMPOSER V2

  1. 安装 Composer: 打开终端并运行以下命令来下载并安装 Composer:

    1
    2
    3
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"

    这将下载并安装 Composer。

  2. 移动 Composer 可执行文件: 执行以下命令将 Composer 可执行文件移动到系统的可执行路径中:

1
sudo mv composer.phar /usr/local/bin/composer

这使你可以在任何地方通过 composer 命令访问 Composer。

  1. 验证安装: 在终端中运行以下命令来验证 Composer 是否成功安装:
1
composer --version

如果你看到类似以下的输出,表示 Composer 已经成功安装并可以正常使用:

Composer version 2.x.x 20xx-xx-xx xx:xx:xx

APACHE2

1
2
3
$ apt-get install apache2
$ a2enmod rewrite proxy_fcgi
$ service apache2 restart

node 和 yarn 和make

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ apt-get install curl
$ curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
$ bash nodesource_setup.sh
$ apt-get install -y nodejs

$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo gpg --dearmor -o /usr/share/keyrings/yarn-archive-keyring.gpg
$ echo "deb [signed-by=/usr/share/keyrings/yarn-archive-keyring.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt update
$ sudo apt-get install yarn

$ sudo apt update
$ sudo apt install make






配置

1
2
3
4
5
$ id
$ sudo service php8.1-fpm stop
$ sudo sudo vi /etc/php/8.1/fpm/pool.d/www.conf
$ sudo service php8.1-fpm restart

配置PHP

1
2
3
4
5
6
7
8
9
$ sudo vim /etc/php/7.4/fpm/pool.d/www.conf
user = www-data
group = www-data
listen = /run/php/php7.4-fpm.sock
listen.owner = www-data
listen.group = www-data

$ sudo service apache2 restart
$ sudo service php7.4-fpm restart

将 Akeneo 站点添加到 Web 服务器:

1
2
$ sudo mv /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default.conf.bak
$ sudo vim /etc/apache2/sites-available/000-default.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<VirtualHost *:80>
ServerName akeneo-pim.local

DocumentRoot /var/www/html/public

<Directory /var/www/html/public>
AllowOverride None
Require all granted

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</Directory>

<Directory /var/www/html/public/bundles>
RewriteEngine Off
</Directory>

<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php7.1-fpm.sock|fcgi://localhost/"
</FilesMatch>

SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0

ErrorLog ${APACHE_LOG_DIR}/akeneo-pim_error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/akeneo-pim_access.log combined
</VirtualHost>

重载生效

1
2
$ sudo apache2ctl configtest
$ sudo service apache2 restart

安装 Akeneo-PIM:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ sudo rm /var/www/html/*
$ cd /var/www/html
$ sudo chown -R $USER:$USER /var/www/html
$ php -d memory_limit=4G /usr/local/bin/composer create-project --prefer-dist akeneo/pim-community-standard . "7.0.*@stable"

下载好了之后需要修改配置

$ sudo vim /var/www/html/.env.local
APP_ENV=prod
APP_DATABASE_HOST=localhost
APP_DATABASE_PORT=null
APP_DATABASE_NAME=akeneo_pim
APP_DATABASE_USER=akeneo_pim
APP_DATABASE_PASSWORD=akeneo_pim
APP_INDEX_HOSTS='localhost:9200'

以生产模式开始安装:

1
2
3
4
$ cd /var/www/html   
$ NO_DOCKER=true make prod
$ sudo chown -R www-data:www-data /var/www/html
$ sudo chmod ug+rw /var/www/html/var/cache /var/www/html/var/logs /var/www/html/public

创建管理员用户:

1
2
$ cd /var/www/html
$ sudo -u www-data php bin/console pim:user:create

Akeneo 的 Cron 作业:

1
2
sudo -u www-data /usr/bin/php /var/www/html/bin/console akeneo:batch:job-queue-consumer-daemon --env=prod -vvv >>/var/www/html/var/logs/daemon_logs.log 2>&1

https://github.com/akeneo/pim-community-dev/discussions/16165


本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!